当前位置:网站首页>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 sense
How 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.
边栏推荐
- 全新BMW i3的操控,能符合对3系之名产品的期待吗?
- 马斯克的「元宇宙」梦
- Tutorial (5.0) 02 Management * fortiedr * Fortinet network security expert NSE 5
- 批量讀取文件夾下的全部語音文件
- 时间戳转localDate
- 20211018 some special matrices
- JUC原子引用与ABA问题
- Some websites of QT (software download, help documents, etc.)
- LeetCode 5289. 公平分发饼干(DFS)
- Neo4j environment construction
猜你喜欢
线上调试工具Arthas高级
阿里高级专家剖析 | Protocol的标准设计
Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
C language: deep understanding of character functions and string functions (2)
Online debugging tool Arthas advanced
Class loading overview
C language: minesweeping
QT multithreaded TCP server
基于微信小程序的图书馆管理系统.rar(论文+源码)
20211104 why are the traces of similar matrices the same
随机推荐
Figure introduction to database neo4j
20211006 linear transformation
20211104 why is the trace of a matrix equal to the sum of eigenvalues, and why is the determinant of a matrix equal to the product of eigenvalues
LeetCode 6098. 统计得分小于 K 的子数组数目(前缀和+二分查找)
C language: Simulated Implementation of library function strcpy
C/S模型与P2P模型
turtle库显示系统时间
20211115 any n-order square matrix is similar to triangular matrix (upper triangle or lower triangle)
20211028 adjustment and tracking
C language: file operation
JUC 字段更新器
HAProxy + Keepalived实现MySQL的高可用负载均衡
CAS无锁
LeetCode 6097. 替换字符后匹配(字典)
Exporting MySQL data table documents using Navicat
A static variable is associated with a class and can be used as long as the class is in memory (the variable does not exist as long as your application terminates). (heap body, stack reference)
20211028 Stabilizability
Agile development practice summary-4
202012 CCF test questions
C language: minesweeping