当前位置:网站首页>ROS2之OpenCV人脸识别foxy~galactic~humble
ROS2之OpenCV人脸识别foxy~galactic~humble
2022-06-13 09:05:00 【zhangrelay】
OpenCV工具使用非常广。关于在ROS2中如何使用的博客一直没有更新:
最早,2019年:ROS2使用OpenCV基础
最近更新了一些:
仿真中使用习题如下:
那么如何实现如下的人脸识别效果呢?
蒙娜丽莎的微笑,永远那么神秘……
遇到的问题如:
[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如何解决呢?
提示:
current_frame = self.br.imgmsg_to_cv2(data, "rgb8")
答案:
[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]:~$基础概念
什么是人脸检测? 在计算机视觉中,试图解决的一个基本问题是在没有人工干预的情况下自动检测图像中的对象。人脸检测可以被认为是在图像中检测人脸的问题。人类的面部可能存在细微差异,但总的来说,可以肯定地说,某些特征与所有人类面部相关。人脸检测算法有很多种。
人脸检测通常是许多人脸相关技术的第一步,例如人脸识别或验证。然而,人脸检测可以有非常有用的应用。人脸检测最成功的应用可能是拍照。当您为朋友拍照时,数码相机内置的人脸检测算法会检测人脸的位置并相应地调整焦点。
什么是 OpenCV 在人工智能领域,计算机视觉是最有趣和最具挑战性的任务之一。计算机视觉就像计算机软件和我们周围的可视化之间的桥梁。它允许计算机软件理解和了解周围环境的可视化。例如:根据颜色、形状和大小确定水果。这项任务对人脑来说可能很容易,但是在计算机视觉管道中,首先我们收集数据,然后执行数据处理活动,然后训练和教授模型以了解如何根据大小区分水果,水果的形状和颜色。
目前,存在各种软件包来执行机器学习、深度学习和计算机视觉任务。到目前为止,计算机视觉是此类复杂活动的最佳模块。 OpenCV 是一个开源库。它受到各种编程语言的支持,例如 R、Python。它可以在大多数平台上运行,例如 Windows、Linux 和 MacOS。
边栏推荐
- Neo4j Environment Building
- redis 模糊查询 批量删除
- Necessary and sufficient conditions for diagonalization of 20211115 matrix; The full rank matrix does not necessarily have n linearly independent eigenvectors; Symmetric matrices must be diagonalized
- Figure introduction to database neo4j
- A very detailed blog about the implementation of bilinear interpolation by opencv
- Final principle
- C language: data storage in memory
- 20220524 how to install coppeliasim to disk D
- 批量读取文件夹下的全部语音文件
- 线上调试工具Arthas基础
猜你喜欢

Routing - static routing

How to become a white hat hacker? I suggest you start from these stages

20211104 why are the traces of similar matrices the same

turtle库的使用数字时钟模拟时钟动态显示

Neo4j - CQL使用

Figure introduction to database neo4j

IP address introduction

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

Longadder of the source code of JUC atomic accumulator

QObject::connect: Cannot queue arguments of type ‘QTextCursor‘ (Make sure ‘QTextCursor‘ is registere
随机推荐
C language: Simulated Implementation of library function strcpy
C language 7-13 day K candle chart (15 points)
Agile development practice summary-4
Routing - static routing
你不知道的stringstream的用法
JUC原子整数
Qvector shallow copy performance test
Solov2 nanny level tutorial (including environment configuration, training your own data set, code logic analysis, etc...) Updating ing
JUC 原子累加器
20211115 任意n阶方阵均与三角矩阵(上三角或者下三角)相似
Completely uninstall PostgreSQL under Linux
20211108 微分跟踪器
20220606 Young's inequality for Matrices
Number of parameters of pytorch statistical model
Simulink的Variant Model和Variant Subsystem用法
The Jenkins console does not output custom shell execution logs
Tutorial (5.0) 03 Security policy * fortiedr * Fortinet network security expert NSE 5
Tutorial (5.0) 04 Fortint cloud services and scripts * fortiedr * Fortinet network security expert NSE 5
C language: minesweeping
[QNX hypervisor 2.2 user manual] 4.5.1 build QNX guest