Getting Started with OpenCV

Before running the sample program, you need to switch to the directory where the code is located. After SSH connects to the car, run in the terminal,

1.1, Image reading and saving

After the car terminal switches to the directory where the code is located, run the program,

After the program is run, it will read the figures/yahboom.jpg image and save the read image as figures/1_1.jpg.

In VSCode, SSH to the car and enter the path,

You can view the read image yahboom.jpg and the saved image 1_1.jpg:

1684999768676

[Note] There is also an important function cv.imshow() in opencv for image display. Since the car system does not have a graphical interface and cannot use this function for display, it will not be introduced here and will not be used later.

1.2, Camera reading and display

Note: This step is applicable to the car equipped with a depth camera.

After switching to the directory where the code is located in the car terminal, run the program,

After running, this program will read a frame of camera image data and save the read frame to figures/1_2.jpg.

1685001319891

1.3、Pixel reading and modification

After switching to the directory where the code is located in the car terminal, run the program,

The terminal outputs the coordinates (100, 100) position,

1685002015448

And the pixels in the upper left corner of the saved image are changed to black:

1685001980683