AprilRobotics / apriltag_ros

A ROS wrapper of the AprilTag 3 visual fiducial detector
Other
358 stars 338 forks source link

Support for UYVY and/or handling image/camera_info synchronization? #129

Closed mbrymer closed 2 years ago

mbrymer commented 2 years ago

Hi, I have two semi related issues.

Issue 1: I have a video stream coming from a camera in UYVY format that I'm trying to do detection on. When I try to run the continuous detection node I get the following error:

` NODES / apriltag_ros_continuous_node (apriltag_ros/apriltag_ros_continuous_node)

ROS_MASTER_URI=http://localhost:11311

process[apriltag_ros_continuous_node-1]: started with pid [23411] [ INFO] [1654025171.983084432]: Initializing nodelet with 4 worker threads. [ INFO] [1654025172.625500993]: Loaded tag config: 1, size: 0.1595, frame_name: tag1 [ INFO] [1654025172.625622196]: Loaded tag config: 2, size: 0.1595, frame_name: tag2 [ WARN] [1654025172.628601114]: remove_duplicates parameter not provided. Defaulting to true OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp, line 9748 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/imgproc/src/color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cvtColor

[apriltag_ros_continuous_node-1] process has died [pid 23411, exit code -6, cmd /home/matt/AprilTag_Test/devel/lib/apriltag_ros/apriltag_ros_continuous_node image_rect:=/basler_camera/image_raw camera_info:=/basler_camera/camera_info __name:=apriltag_ros_continuous_node __log:=/home/matt/.ros/log/49ee0aa4-e117-11ec-ae5d-5ca6e636641b/apriltag_ros_continuous_node-1.log]. log file: /home/matt/.ros/log/49ee0aa4-e117-11ec-ae5d-5ca6e636641b/apriltag_ros_continuous_node-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done ` Looking around this seems to be an error message OpenCV throws when it gets a malformatted image. I'm able to confirm that the image is read properly by ROS with both rqt_image_view and image_proc. Does the AprilTag node not support the UYVY format or is there potentially something weird with my message?

Issue 2: To troubleshoot the above I tried piping it through image_proc to convert it to RGB and see if it could get it to work. The image conversion succeeds, but the AprilTag node then throws a warning about the camera_info and image messages being unsynchronized and I don't get any detections. The tag_detections_image comes out blank and I get nothing on any of the tag_detections topics when doing a rostopic echo `NODES / apriltag_ros_continuous_node (apriltag_ros/apriltag_ros_continuous_node)

ROS_MASTER_URI=http://localhost:11311

process[apriltag_ros_continuous_node-1]: started with pid [24442] [ INFO] [1654025751.325617814]: Initializing nodelet with 4 worker threads. [ INFO] [1654025751.877781595]: Loaded tag config: 1, size: 0.1595, frame_name: tag1 [ INFO] [1654025751.877901130]: Loaded tag config: 2, size: 0.1595, frame_name: tag2 [ WARN] [1654025751.880990558]: remove_duplicates parameter not provided. Defaulting to true [ WARN] [1654025762.001268287]: [image_transport] Topics '/basler_camera/image_color' and '/basler_camera/camera_info' do not appear to be synchronized. In the last 10s: Image messages received: 148 CameraInfo messages received: 269 Synchronized pairs: 0 [ WARN] [1654025771.985753513]: [image_transport] Topics '/basler_camera/image_color' and '/basler_camera/camera_info' do not appear to be synchronized. In the last 10s: Image messages received: 151 CameraInfo messages received: 271 Synchronized pairs: 0 `

Does the AprilTag node require that the image and camera_info messages be synchronized and will it not do tag detection otherwise? What's the workaround if you were to need to do some intermediate image processing, say like rectification with an existing node that may not want to resync and republish your camera_info topic?

As a misc point, I have not yet calibrated the camera and so I'm just supplying a made up focal length with the image size for now but that should only affect the pose estimation, not the ability to detect tags I would think? I tested running the single detector node and got successful tag detections so I don't think that's the issue.

If it matters I'm on the Jetson Nano running Melodic + Jetpack 4.6.1 / Ubuntu 18.04

mbrymer commented 2 years ago

Issues sorted, mostly misunderstandings on my part