Welcome to USB Industrial Grade AI Vision Camera repository
9.Contour moment
Contour moment
Moment functions are widely used in image analysis, such as pattern recognition, target classification, target recognition and orientation estimation, image encoding and reconstruction, etc. The moment set calculated from an image can not only describe the global characteristics of the image shape, but also provide a large amount of different geometric feature information about the image, such as size, position, direction and shape. The description ability of image moments is widely used in target recognition and orientation estimation in various fields of image processing, computer vision and robotics.
First moment: related to shape;
Second moment: shows how much the curve extends around the mean of the straight line;
Third-order moment: a symmetry measurement about the mean value; 7 invariant moments can be derived from the second-order moment and the third-order moment. The invariant moment is a statistical characteristic of the image, which satisfies the invariance of translation, expansion and contraction, and rotation, and is widely used in the field of image recognition.
1. Use
Code path:~/yahboomcar_ws/src/opencv_apps/launch
- Start the camera
roslaunch yahboomcar_visual opencv_apps.launch img_flip:=false
- img_flip parameter: whether the image needs to be flipped horizontally, the default is false.
The [usb_cam-test.launch] file opens the [web_video_server] node by default, and you can directly use the [IP:8080] web page to view images in real time.
- Start the corner detection function of Opencv_apps
xroslaunch opencv_apps contour_moments.launch # Contour moment
The debug_view for some functions is disabled, and there is no screen appearing. You can view the effect in the following two ways.
xThe reason for closing debug_view is that it will generate errors on the terminal, but the actual effect has not been affected.
- Local View Screen
Enter the following command to select the corresponding topic
xxxxxxxxxxrqt_image_view
- LAN viewing screen
Enter IP+port in the browser, for example:
xxxxxxxxxx192.168.2.150:8080 # IP是宿主机的IP
2. Effect display
Contour moments use parameters. There will be a topic for subscribing images and publishing images.
| Parameter | Type | Default | Analyze |
|---|---|---|---|
| ~use_camera_info | bool | true | Subscribe to the topic [camera_info] to get the default coordinate system ID, otherwise use the image information directly. |
| ~debug_view | bool | false | Whether to create a window to display the node image |
| ~canny_low_threshold | int | 0 | Canny edge detection low threshold |
| ~queue_size | int | 3 | Queue size |
Effect picture:
