Deep pseudo-color image

Before starting this function, you need to close the process of the big program and APP. Enter the following program in the terminal to close the process of the big program and APP.

If you need to start the big program and APP again later, start the terminal.

 

1. Function description

After the program is started, the subscribed black and white depth image will be converted into a pseudo-color image. According to the information of the depth, the image will show different degrees of color.

 

2. Start and operate

Terminal input,

Successful startup is shown in the figure below, and a window will be generated to display the pseudo-color image,

image-20240923160916355

From the actual distance, it can be seen that the difference in depth information is very intuitively reflected by color.

 

3. Program flow chart

image-20240923162455919

 

4. Core code analysis

The code path is as follows, /home/jetson/dofbot_pro_ws/src/dofbot_pro_RGBDCam/scripts/Depth2Color.py

Code analysis,

Import necessary libraries

Define image encoding format

Create subscriber and CvBridge object

Callback function, specifically processes the received image message data and converts the image and displays it

cv2.convertScaleAbs: used to process images to enhance contrast or adjust brightness, the parameters passed in are:

cv2.applyColorMap: a function used to apply pseudo-color mapping to grayscale images, which can enhance the visualization of images. The parameters passed in are:

You can change the default COLORMAP_JET in the program to the above parameters and test to see the different effects.