Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_view crashes with encoding yuv422_yuy2 #1021

Open
christianrauch opened this issue Aug 7, 2024 · 4 comments
Open

image_view crashes with encoding yuv422_yuy2 #1021

christianrauch opened this issue Aug 7, 2024 · 4 comments
Labels

Comments

@christianrauch
Copy link
Contributor

christianrauch commented Aug 7, 2024

Using the image_view / image_view::ImageViewNode with image encoding yuv422_yuy2 causes exception:

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.6.0) ./modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<3, 4>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = cv::impl::<unnamed>::NONE; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 2

This is probably easiest reproducible with the camera_ros node:

# start camera with YUYV
ros2 run camera_ros camera_node --ros-args -p format:=YUYV
# start image view node
ros2 run image_view image_view --ros-args -r /image:=/camera/image_raw

The exception is thrown by cv::imshow.

@quic-zhaoyuan
Copy link

Hi @christianrauch,
I have test the step on my laptop(ubuntu22.04, ros2 humble), seems it is working, cannot reproduce the issue you description
image

@quic-zhaoyuan
Copy link

Is this issue based on specific Platform or ROS version

@christianrauch
Copy link
Contributor Author

Is this issue based on specific Platform or ROS version

I tested this on Ubuntu 24.04 / ROS jazzy with and compiled the node from source.

@christianrauch
Copy link
Contributor Author

I can reproduce this also with the v4l2_camera package on jazzy:

# 'v4l2_camera' package, 'sudo apt install ros-jazzy-v4l2-camera'
ros2 run v4l2_camera v4l2_camera_node --ros-args -p output_encoding:=yuv422_yuy2
ros2 run image_view image_view --ros-args -r /image:=/image_raw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants