当前位置:网站首页>Opencv face recognition of ros2 foxy~galactic~humble
Opencv face recognition of ros2 foxy~galactic~humble
2022-06-13 09:20:00 【zhangrelay】
OpenCV Tools are widely used . About the ROS2 How to use the blog has not been updated :
Earliest ,2019 year :ROS2 Use OpenCV Basics
Recently updated some :
The exercises used in the simulation are as follows :
So how to achieve the following face recognition effects ?
Mona Lisa's smile , Always so mysterious ……
Problems encountered, such as :
[INFO] [1655036597.738995500] [face_detection]: Receiving image
Traceback (most recent call last):
File "/opt/ros/humble/local/lib/python3.10/dist-packages/cv_bridge/core.py", line 194, in imgmsg_to_cv2
res = cvtColor2(im, img_msg.encoding, desired_encoding)
RuntimeError: [8UC3] is not a color format. but [bgr8] is. The conversion does not make sense
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zhangrelay/ros_ws/opencv_ros2-main/opencv_ros2/face_detection.py", line 95, in <module>
main()
File "/home/zhangrelay/ros_ws/opencv_ros2-main/opencv_ros2/face_detection.py", line 84, in main
rclpy.spin(face_detection)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 222, in spin
executor.spin_once()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 712, in spin_once
raise handler.exception()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
self._handler.send(None)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 418, in handler
await call_coroutine(entity, arg)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 343, in _execute_subscription
await await_or_execute(sub.callback, msg)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
return callback(*args)
File "/home/zhangrelay/ros_ws/opencv_ros2-main/opencv_ros2/face_detection.py", line 53, in listener_callback
current_frame = self.br.imgmsg_to_cv2(data, "bgr8")
File "/opt/ros/humble/local/lib/python3.10/dist-packages/cv_bridge/core.py", line 196, in imgmsg_to_cv2
raise CvBridgeError(e)
cv_bridge.core.CvBridgeError: [8UC3] is not a color format. but [bgr8] is. The conversion does not make senseHow to solve it ?
Tips :
current_frame = self.br.imgmsg_to_cv2(data, "rgb8")
answer :
[8UC3] is not a color format. but [rgb8] is.
[email protected]:~$ ros2 node list
/face_detection
/image_publisher
/rqt_gui_py_node_1492
[email protected]:~$ ros2 node info /face_detection
/face_detection
Subscribers:
/image_raw: sensor_msgs/msg/Image
Publishers:
/parameter_events: rcl_interfaces/msg/ParameterEvent
/rosout: rcl_interfaces/msg/Log
Service Servers:
/face_detection/describe_parameters: rcl_interfaces/srv/DescribeParameters
/face_detection/get_parameter_types: rcl_interfaces/srv/GetParameterTypes
/face_detection/get_parameters: rcl_interfaces/srv/GetParameters
/face_detection/list_parameters: rcl_interfaces/srv/ListParameters
/face_detection/set_parameters: rcl_interfaces/srv/SetParameters
/face_detection/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically
Service Clients:
Action Servers:
Action Clients:
[email protected]:~$Basic concepts
What is face detection ? In computer vision , One of the basic problems that we try to solve is to automatically detect objects in images without human intervention . Face detection can be considered as the problem of detecting faces in images . There may be subtle differences in human faces , But on the whole , To be sure , Certain features are related to all human faces . There are many face detection algorithms .
Face detection is usually the first step of many face related technologies , For example, face recognition or verification . However , Face detection can have very useful applications . The most successful application of face detection is probably photographing . When you take pictures of your friends , The built-in face detection algorithm of the digital camera will detect the position of the face and adjust the focus accordingly .
What is? OpenCV In the field of artificial intelligence , Computer vision is one of the most interesting and challenging tasks . Computer vision is like a bridge between computer software and the visualization around us . It allows computer software to understand and understand the visualization of the surrounding environment . for example : According to color 、 Shape and size determine the fruit . This task may be easy for the human brain , But in the computer vision pipeline , First we collect data , Then perform data processing activities , Then train and teach the model to know how to distinguish fruits according to their size , The shape and color of the fruit .
at present , There are various software packages to perform machine learning 、 Deep learning and computer vision tasks . up to now , Computer vision is the best module for such complex activities . OpenCV It's an open source library . It is supported by various programming languages , for example R、Python. It can run on most platforms , for example Windows、Linux and MacOS.
边栏推荐
- Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
- Simulink variant model and variant subsystem usage
- Class loading overview
- Resolve importerror:lib*** so--cannot open shared object file: No such... (pycharm/clion reports an error but the shell does not)
- Sort() sort function
- @Value does not take effect and extend/implement other classes cannot inject beans manually
- 20211108 is transpose multiply a a a positive definite matrix? What are the necessary and sufficient conditions for a to be a positive definite matrix?
- 全新BMW i3的操控,能符合对3系之名产品的期待吗?
- Two good kids
- CAS无锁
猜你喜欢

C language: recursive function to realize Hanoi Tower

Some websites of QT (software download, help documents, etc.)

an error occurred while trying to rename a file in the destination directory code 5

攻防世界PWN play 条件竞争漏洞的利用

Heap
Drill down to protobuf - Introduction

Simulink variant model and variant subsystem usage

C language: Simulated Implementation of library function strcpy

Tutorial (5.0) 03 Security policy * fortiedr * Fortinet network security expert NSE 5

Storage mode of drawings
随机推荐
C language 7-13 day K candle chart (15 points)
C language: dynamic memory management
JUC Unsafe
20211104 why are the traces of similar matrices the same
LeetCode 5259. Calculate the total tax payable
C language: minesweeping
Two good kids
Spectre record
C language: five custom types
C language: summary of question brushing (1)
LeetCode 6097. 替换字符后匹配(字典)
[implementation of depth first search]
strcpy_ S precautions for use. (do not use strcpy_s where memcpy_s can be used)
Neo4j - CQL使用
Download address of QT source code of each version
Cisco, Huawei network equipment
Haproxy + keepalived for high availability load balancing of MySQL
BGP 联邦+Community
Longadder of the source code of JUC atomic accumulator
QT multithreaded TCP server