yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
Transbot SE📖
01.Introduction to Transbot SE
  • 01. Introduction to Transbot SE
  • 02. Precautions for use and battery safety
  • 03. First Trial
02.First Trial
  • 2.1.APP control
  • 2.2.USB wireless handle control(Optional)
  • 2.3.Handle video control Transbot(Optional)
  • 2.4.Network configuration tutorial in hotspot mode
03.Hardware control course
  • 3.1About expansion board and update firmware
  • 3.2.Close self-starting process
  • 3.3.Install Transbot library
  • 3.4.Control buzzer and button
  • 3.5.Control PWM servo
  • 3.6.Control bus servo
  • 3.7.Control motor
  • 3.8.Control robot movement
04.Linux operating system
  • 1. Virtual machine installation and use
  • 2. Linux basics
  • 3. Remote control
  • 4. Multi-machine communication configuration
  • 5. Static IP and hotspot mode
  • 6. Web page real-time monitoring
  • 7. Expansion tutorial
  • 8. Write system images
05.Docker couse(For Pi5)
  • 1.Docker overview and docker installation
  • 2.Common commands for docker image containers
  • 3.Docker images deeply understand and publish images
  • 4.Docker hardware interaction and data processing
  • 5.Start the transbot se container
06.ROS basic course
  • 1.ROS introduction
  • 2.Project file structure
  • 3.Common commands and tools
  • 4.Publisher
  • 5.Subscribers
  • 6.Customize topic messages and use
  • 7.Client
  • 8.Server
  • 9.Custom service messages and usage
  • 10.TF release and monitoring
07.OpenCV courses
  • 1. Getting started with Open Source CV
  • 2. Open Source CV geometric transformation
  • 3. Open Source CV image processing and drawing text line segments
  • 4. Open Source CV image beautification
  • 5. Opencv application
  • 6. AR vision
  • 7. AR QR code
  • 8. ROS+Opencv foundation
  • 9. ROS+Opencv application
  • 10. MediaPipe development
08.ROS robot course
  • 1.PID algorithm
  • 2.Basic communication
  • 3.Keyboard control
  • 4.Handle control(Optional)
  • 5.Robot state estimation
  • 6.Data calibration
09.ROS simple camera course
  • 1.HD camera calibration
  • 2.HD camera color tracking
  • 3.HD camera color tracking (robotic arm)
  • 4.HD camera object tracking
  • 5. KCF target tracking
  • 6.HD camera face tracking
  • 7.HD camera robotic arm carrying
  • 8.HD camera Autopilot
10.ROS robotic arm control tutorial
  • 1.MoveIt configuration
  • 2.MoveIt control the real machine
  • 3.MoveIt moves randomly
  • 4.MoveIt kinematics design
  • 5.MoveIt cartesian path
  • 6.MoveIt avoiding
  • 7.MoveIt scene design
  • 8.MoveIt trajectory planning
  • 9.Mediapipe palm control car
  • 10.Mediapipe gesture control robotic arm
  • 11.Mediapipe gesture control car
  • 12.Mediapipe arm attitude control robotic arm
11.ROS multi-robot control(Optional)
  • 1. Multi-robot control(Optional)
  • 2. Multi-robot queue performance(Optional)
  • 3. Multi-robot robot arm dancing(Optional)
12.Deep learning courses
  • 1.KNN recognizes handwritten digits
  • 2.Basic use of TensorFlow
  • 3.Basic use of PyTorch(jetson)
  • 4.yolov5 model training(jetson)
  • 5.yolov5+tensorrt acceleration(jetson)
  • 6.yolov4-tiny
13.Installation Video
  • Part18
  • Part1-6
  • Part7-12
  • Part13.1-13.3.3
  • Part13.4.1-17
14.FAQnew
  • 1.Using your own Jetson board,Transbot-SE cannot start normally
Download
  • APP(iOS/Android)
  • System_File-Pi5
  • System_File-Pi4
  • System_File-Jetson
  • VM_File
  • Appendix
  • Code
  • InstructionManual
  • Jetson_Boot_USB.tar.gz
  • Hardware_Info
Download ZIP

Welcome to Transbot SE repository

9. ROS+Opencv application

9. ROS+Opencv application

9. ROS+Opencv application9.1. Overview9.2. Use9.2.1. Start9.2.2. Display method9.2.3. Effect display9.3. Node9.3.1. Edge detection algorithm9.3.2. Contour moment9.3.3. Face recognition

9.1. Overview

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

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

Function package: ~/software/transbot_library/src/opencv_apps

Most of the code was originally taken from https://github.com/Itseez/opencv/tree/master/samples/cpp

The opencv_apps program provides various nodes that internally run the functions of opencv and publish the results to a ROS topic. When using the opencv_apps program, you only need to run a launch file according to your own business needs, so you don't have to write program codes for these functions.

ROS Wiki has related node analysis, topic subscription and topic publishing of the corresponding node, introduction of related parameters, etc. See the ROS WiKi for details.

image-20210903181852659

9.2. Use

9.2.1. Start

Step 1: Start the camera

jetson motherboard/Raspberry Pi 4B

roslaunch transbot_visual opencv_apps.launch camDevice:=USBCam

Raspberry Pi 5

Before running, please confirm that the large program has been permanently closed

Enter docker

Note: If there is a terminal that automatically starts docker, or there is a docker terminal that has been opened, you can directly enter the docker terminal to run the command, and there is no need to manually start docker

Start docker manually

xxxxxxxxxx
./run_docker.sh

xxxxxxxxxx
roslaunch transbot_visual opencv_apps.launch camDevice:=USBCam

[camDevice]: The high frame rate camera is [USBCam];

If the web page cannot be viewed, check whether there is no [web_video_server] node. If not, run the following command

jetson motherboard/Raspberry Pi 4B

xxxxxxxxxx
rosrun web_video_server web_video_server

Raspberry Pi 5

Enter the same docker from multiple terminals

Keep the program of the previous docker terminal running and open a new terminal

Enter the following command

xxxxxxxxxx
docker ps

Enter the same docker and use the following 18870bc3dc00 to modify the ID displayed on the actual terminal.

xxxxxxxxxx
docker exec -it 18870bc3dc00 /bin/bash

Step 2: Start the function of Opencv_apps

jetson motherboard/Raspberry Pi 4B

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 moments
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 filtering
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 filtering
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-related 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

Raspberry Pi 5

Enter the same docker from multiple terminals

Keep the program of the previous docker terminal running and open a new terminal

Enter the following command

xxxxxxxxxx
docker ps

Enter the same docker and use the following 18870bc3dc00 to modify the ID displayed on the actual terminal.

xxxxxxxxxx
docker exec -it 18870bc3dc00 /bin/bash

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 moments
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 filtering
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 filtering
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-related 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 functional case will have a parameter [debug_view], Boolean type, whether to use Opencv to display pictures, which is displayed by default.

If no display is required, set it to [False], for example

xxxxxxxxxx
roslaunch opencv_apps contour_moments.launch debug_view:=False

However, after starting in this way, some cases cannot be displayed in other ways, because in the source code, some [debug_view] is set to [False], which will turn off image processing.

9.2.2. Display method

  • rqt_image_view

Enter the following command to select the corresponding topic

jetson motherboard/Raspberry Pi 4B

xxxxxxxxxx
rqt_image_view

Raspberry Pi 5

Enter the same docker from multiple terminals

Keep the program of the previous docker terminal running and open a new terminal

Enter the following command

xxxxxxxxxx
docker ps

Enter the same docker and use the following 18870bc3dc00 to modify the ID displayed on the actual terminal.

xxxxxxxxxx
docker exec -it 18870bc3dc00 /bin/bash

xxxxxxxxxx
rqt_image_view
  • opencv

The system displays it by default, no need to do anything.

  • Web viewing

(Same as under LAN) Enter IP+port in the browser, for example:

xxxxxxxxxx
192.168.2.102:8080

9.2.3. Effect display

  • Optical flow detection algorithm

Move the screen and observe the phenomenon.

image-20210903215736978

  • Feature point tracking

image-20210903215933659

  • Hough circle detection

image-20210903220054380

  • Hough linear detection

The lower the threshold, the more lines there are and the easier it is for the picture to freeze.

image-20210903220336691

  • Phase dependent 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 and the system will automatically distinguish them.

image-20210903220528108

9.3. Node

Each case in this section will have a topic for subscribing images and publishing images.

9.3.1. Edge detection algorithm

ParametersTypeDefaultParse
~use_camera_infobooltrueSubscribe to the topic [camera_info] and 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
~L2gradientboolFalsecanny's parameters
~queue_sizeint3Queue size

image-20210903212838217

image-20210903212947694

9.3.2. Contour moment

ParametersTypeDefaultParse
~use_camera_infobooltrueSubscribe to the topic [camera_info] and 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

9.3.3. Face recognition

This case involves autonomous training and real-time recognition by collecting images of people in real time, and the steps are slightly complicated.

ParametersTypeDefaultParse
~approximate_syncboolfalseSubscribe to the topic [camera_info] and get the default coordinate system ID, otherwise use the image information directly.
~queue_sizeint100The queue size of the subscription topic
~model_methodstring"eigen"Face recognition method: "eigen", "fisher" or "LBPH"
~use_saved_databooltrueLoad training data from ~data_dir path
~save_train_databooltrueSave the training data to the ~data_dir path for retraining
~data_dirstring"~/opencv_apps/face_data"Save training data path
~face_model_widthint190Width of training face image
~face_model_heightint90Height of training face image
~face_paddingdouble0.1The padding ratio of each face
~model_num_componentsint0Number of components for the face recognizer model (0 is considered unlimited)
~model_thresholddouble8000.0Face recognition model threshold
~lbph_radiusint1Radius parameter (only for LBPH method)
~lbph_neighborsint8Neighborhood parameters (only for LBPH method)
~lbph_grid_xint8Grid x parameter (only for LBPH method)
~lbph_grid_yint8Grid y parameter (only for LBPH method)
~queue_sizeint100Image subscriber queue size

Steps:

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

If you need to enter the recognized identifications, cycle through steps 1 to 5 until all identified persons have been entered, and then proceed to step six.

image-20210903213928003

Step 3: Ensure that faces can be recognized

image-20210906103107655

final recognition effect

image-20210906103143423

ROS+Opencv foundation
MediaPipe development

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
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文