yahboom
HomeTutorialsProduct
Solution
Blog
Online Store
About Us
EN/中文
Store
Realsense Depth Camera📖
1.Installation video
  • Installation video
2.Tutorials
  • 2.0 How to use camera
  • 2.1 Opencv application
  • 2.2 Color recognition-object tracking
  • 2.3 ARTag
  • 2.4 ROS+Opencv basic course
  • 2.5 ROS+OpenCV application
  • 2.6 Data conversion and point cloud
Download
  • Code
  • Datasheet
  • Software
  • VM file
Download ZIP

Welcome to Realsense Depth Camera repository

2.5 ROS+OpenCV application

5、ROS+OpenCV application

5、ROS+OpenCV application5.1、Overview5.2、Usage5.2.1、Start up5.2.2、Display method5.2.3、Effect show5.3、Node5.3.1、Edge detection algorithm5.3.2、Contour moment5.3.3、Face recognition

5.1、Overview

wiki:http://wiki.ros.org/opencv_apps

Source code:[https://github.com/ros-perception/opencv_apps.git]

opencv_apps provides various nodes that run internally OpenCV's functionalities and publish the result as ROS topics. With opencv_apps, you can skip writing OpenCV application codes for a lot of its functionalities by simply running a launch file that corresponds to OpenCV's functionality you want.

 

image-20210903181852659

5.2、Usage

5.2.1、Start up

Step 1: Start the camera

roslaunch transbot_visual opencv_apps.launch camDevice:=USBCam

Step 2: Start the function of Opencv_apps

xxxxxxxxxx
roslaunch opencv_apps face_recognition.launch             # Face recognition
roslaunch opencv_apps corner_harris.launch                # harris corner detection
roslaunch opencv_apps camshift.launch                     # Target tracking algorithm
roslaunch opencv_apps contour_moments.launch              # Contour moment
roslaunch opencv_apps convex_hull.launch                  # Polygon outline
roslaunch opencv_apps discrete_fourier_transform.launch   # Discrete Fourier Transform Algorithm
roslaunch opencv_apps edge_detection.launch               # Edge detection algorithm
roslaunch opencv_apps face_detection.launch               # Face detection algorithm
roslaunch opencv_apps fback_flow.launch                   # Optical flow detection algorithm
roslaunch opencv_apps find_contours.launch                # Contour detection
roslaunch opencv_apps general_contours.launch             # General contour detection
roslaunch opencv_apps goodfeature_track.launch            # Feature point tracking
roslaunch opencv_apps hls_color_filter.launch             # HLS color filter
roslaunch opencv_apps hough_circles.launch                # Hough circle detection
roslaunch opencv_apps hough_lines.launch                  # Hough line detection
roslaunch opencv_apps hsv_color_filter.launch             # HSV color filter
roslaunch opencv_apps lk_flow.launch                      # LK optical flow algorithm
roslaunch opencv_apps people_detect.launch                # Human detection algorithm
roslaunch opencv_apps phase_corr.launch                   # Phase correlation displacement detection
roslaunch opencv_apps pyramids.launch                     # Image pyramid sampling algorithm
roslaunch opencv_apps rgb_color_filter.launch             # RGB color filtering
roslaunch opencv_apps segment_objects.launch              # Clear background detection algorithm
roslaunch opencv_apps simple_flow.launch                  # Simplified optical flow algorithm
roslaunch opencv_apps smoothing.launch                    # Simple filter
roslaunch opencv_apps threshold.launch                    # Threshold image processing
roslaunch opencv_apps watershed_segmentation.launch       # Watershed segmentation algorithm

Almost every function case will have a parameter [debug_view], boolean type, whether to use Opencv to display the picture, it is displayed by default.

If you don’t need to display it, set it to [False], for example

xxxxxxxxxx
roslaunch opencv_apps contour_moments.launch debug_view:=False

5.2.2、Display method

  • rqt_image_view

Enter the following command to select the corresponding topic

xxxxxxxxxx
rqt_image_view
  • opencv

The system displays it by default.

  • Web view

(At the same LAN) Enter IP+port in the browser, for example:

xxxxxxxxxx
192.168.2.102:8080

5.2.3、Effect show

  • Optical flow detection algorithm

Move the screen and observe the phenomenon.

image-20210903215736978

  • Feature point tracking

image-20210903215933659

  • Hough circle detection

image-20210903220054380

  • Hough line detection

The lower the threshold, the more lines there are, and the more easily the picture gets stuck.

image-20210903220336691

  • Phase correlation displacement detection

The faster the camera moves, the larger the radius of the circle.

image-20210903220246064

  • Watershed segmentation algorithm

Use the mouse to select different objects, the system automatically distinguishes them.

image-20210903220528108

5.3、Node

5.3.1、Edge detection algorithm

ParameterTypeDefaultAnalyze
~use_camera_infobooltrueSubscribe to the topic [camera_info] to get the default coordinate system ID, otherwise use the image information directly.
~debug_viewboolfalseWhether to create a window to display the node image
~edge_typeint0Specify the edge detection method: 0: Sobel operator, 1: Laplacian operator, 2: Canny edge detection
~canny_threshold1int100Specify the second canny threshold
~canny_threshold2int200Specify the first canny threshold
~apertureSizeint3The aperture size of the Sobel operator.
~apply_blur_preboolTrueWhether to apply blur() to the input image
~postBlurSizedouble3.2Input image aperture size
~apply_blur_postboolFalseWhether to apply GaussianBlur() to the input image
~L2gradientboolFalseParameters of canny
~queue_sizeint3Queue size

image-20210903212838217

image-20210903212947694

5.3.2、Contour moment

ParameterTypeDefaultAnalyze
~use_camera_infobooltrueSubscribe to the topic [camera_info] to get the default coordinate system ID, otherwise use the image information directly.
~debug_viewboolfalseWhether to create a window to display the node image
~canny_low_thresholdint0Canny edge detection low threshold
~queue_sizeint3Queue size

image-20210903212751344

5.3.3、Face recognition

ParameterTypeDefaultAnalyze
~approximate_syncboolfalseSubscribe to the topic [camera_info] to get the default coordinate system ID, otherwise use the image information directly.
~queue_sizeint100Queue size for subscribed topics
~model_methodstring"eigen"Face recognition method: "eigen", "fisher" or "LBPH"
~use_saved_databooltrueLoad training data from the ~data_dir path
~save_train_databooltrueSave the training data to the ~data_dir path for retraining
~data_dirstring"~/opencv_apps/face_data"保存训练数据路径
~face_model_widthint190Train the width of the face image
~face_model_heightint90Training the height of the face image
~face_paddingdouble0.1Fill ratio of each face
~model_num_componentsint0The number of components of the face recognizer model (0 is considered unlimited)
~model_thresholddouble8000.0Face recognition model threshold
~lbph_radiusint1Radius parameter (only applicable to LBPH method)
~lbph_neighborsint8Neighborhood parameters (only applicable to LBPH method)
~lbph_grid_xint8Grid x parameters (only applicable to LBPH method)
~lbph_grid_yint8Grid y parameter (only applicable to LBPH method)
~queue_sizeint100Image subscriber queue size

Steps:

  1. First, after the colon in the figure below, enter the character's name: Yahboom
  2. Confirm name: y
  3. Then place the face in the center of the image and click OK.
  4. Cycle to add a photo: y, click to confirm.
  5. To end the picture collection, enter: n and click to confirm.
  6. Close the launch file and restart.

If you need to enter the recognition, cycle 1~5 in turn until all the recognition personnel are entered, and then perform step 6.

image-20210903213928003

Step 3: Ensure that the face can be recognized

image-20210906103107655

Recognition effect

image-20210906103143423

 

ROS+Opencv basic course
Data conversion and point cloud

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文