C/C++Program Design - SUSTech

12
C/C++ Program Design CS205 Week 8 Prof. Shiqi Yu (于仕琪) <[email protected]>

Transcript of C/C++Program Design - SUSTech

Page 1: C/C++Program Design - SUSTech

C/C++ Program DesignCS205

Week 8

Prof. Shiqi Yu (于仕琪)<[email protected]>

Page 2: C/C++Program Design - SUSTech

ARM Development Board

Page 3: C/C++Program Design - SUSTech

ARM• ARM (previously an acronym for Advanced RISC Machine and

originally Acorn RISC Machine) is a family of reduced instruction set computing (RISC) architectures for computer processors1.• ARM is the most widely used instruction set architecture (ISA) and the

ISA produced in the largest quantity.

1. https://en.wikipedia.org/wiki/ARM_architecture

Page 4: C/C++Program Design - SUSTech

Raspberry Pi 4• Broadcom BCM2711, Quad core

Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz• 2GB, 4GB or 8GB LPDDR4-3200

SDRAM (depending on model)• 2.4 GHz and 5.0 GHz IEEE 802.11ac

wireless, Bluetooth 5.0, BLE• Gigabit Ethernet• 2 USB 3.0 ports; 2 USB 2.0 ports.• Raspberry Pi standard 40 pin GPIO

header (fully backwards compatible with previous boards)• 2 ×micro-HDMI ports (up to

4kp60 supported)

https://www.raspberrypi.org/

Page 5: C/C++Program Design - SUSTech

EAIDK-310

• ARM 4-core 64-bit, Cortex-A53,1.3GHz• LPDDR3 1GB RAM• 802.11 ac/a/b/g/n, 2.4G/5GHz• 1xUSB3, 3xUSB2, 1xMicro-USB• Bluetooth 5.0

http://www.eaidk.com/

Page 6: C/C++Program Design - SUSTech

How to develop programs with ARM Development boards

Almost the same with a PC with Linux OS.• gcc/g++• Makefile• cmake

Page 7: C/C++Program Design - SUSTech

Some Tricks in OpenCV

Page 8: C/C++Program Design - SUSTech

What’s an image?

Page 9: C/C++Program Design - SUSTech

cv:Mat class

• Matrix: 2D array? Much more than that.

• modules/core/include/opencv2/core/mat.hpp

class CV_EXPORTS Mat{public:

// some functionsint rows, cols;//pointer to datauchar* data;//size_t step.pMatStep step;

};

Page 10: C/C++Program Design - SUSTech

cv:Mat class

… … int flags int dims int rows int cols

uchar* data int* refcount

… … …

Matrix data Ref count

Page 11: C/C++Program Design - SUSTech

step in cv::Mat

•How many bytes for a row of Matrix 4(row)x3(col)?Ø Can be 3, 4, 8, and any other values >=3.Ø Memory alignment for SIMD

Page 12: C/C++Program Design - SUSTech

ROI: Region of interest • Mat A

Ø rows=100Ø cols=100Ø step=100Ø data=0xABCDEF00

• Mat BØ rows=100Ø cols=100Ø step=100Ø data=0xABCDEF00

• Mat BØ rows=30Ø cols=28Ø step=100Ø data=0xABCE0698

A

B

C

Mat

Matrix Data