Closed izeemeen closed 3 months ago
In the launch file, the CameraNode
and ImageViewNode
communicate via the raw topics. The function compressImageMsg
should not be called unless you also manually subscribe to the compressed topic. Is this exception maybe thrown in the ImageViewNode
?
Could you run the camera node individually (without the viewer) and subscribe to the raw and compressed topics manually to see if the exceptions originates indeed in the camera node? On the raw topic you can check encoding
of the Image
message to see the original image encoding.
If this still throws the exception, can you run the node with full debug information and paste the output here?
I can reproduce this exception in the ImageViewNode
with the YUYV
format.
Terminal A: start camera_node
with YUYV:
ros2 run camera_ros camera_node --ros-args -p format:=YUYV
Terminal B: start image_view
:
ros2 run image_view image_view --ros-args -r /image:=/camera/image_raw
causes:
> Invalid number of channels in input image:
> 'VScn::contains(scn)'
> where
> 'scn' is 2
The published image encoding is yuv422_yuy2
:
$ ros2 topic echo /camera/image_raw --field encoding
yuv422_yuy2
---
See issue report: https://github.com/ros-perception/image_pipeline/issues/1021/
Thanks for answer, @christianrauch!
I check rpicam-hello --list-camera
:
0 : ov9281 [1280x800 10-bit MONO] (/base/axi/pcie@120000/rp1/i2c@88000/ov9281@60) Modes: 'R8' : 640x400 [309.79 fps - (0, 0)/1280x800 crop] 1280x720 [171.79 fps - (0, 0)/1280x720 crop] 1280x800 [143.66 fps - (0, 0)/1280x800 crop] 'R10_CSI2P' : 640x400 [247.83 fps - (0, 0)/1280x800 crop] 1280x720 [137.42 fps - (0, 0)/1280x720 crop] 1280x800 [114.93 fps - (0, 0)/1280x800 crop]
Open camera.launch.py and change:
ComposableNode( package='camera_ros', plugin='camera::CameraNode', parameters=[{ "camera": 0, "width": 640, "height": 400, "format": 'XBGR8888, }], extra_arguments=[{'use_intra_process_comms': True}], ),
After this it works!
Or manually run:
ros2 run camera_ros camera_node --ros-args -p width:=640 -p height:=400 -p format:=XBGR8888
ros2 run image_view image_view --ros-args -r /image:=/camera/image_raw
Open camera.launch.py and change:
ComposableNode( package='camera_ros', plugin='camera::CameraNode', parameters=[{ "camera": 0, "width": 640, "height": 400, "format": 'XBGR8888, }], extra_arguments=[{'use_intra_process_comms': True}], ),
The launch file has a parameter format
. You can directly provide the desired pixel format without needing to change the launch file:
ros2 launch camera_ros camera.launch.py format:=XBGR8888
In any case, this is a bug in the image viewer node. I am going to close this since the issue is unrelated to the camera node.
Hi all!
I use this mono camera: https://www.waveshare.com/OV9281-160-Camera.htm
After launching:
ros2 launch camera_ros camera.launch.py
I get this output:I fixed the compressImageMsg function in the CameraNode.cpp file:
but it had no effect
Where can I be wrong and how can I see the
cv_ptr->encoding
?