Closed ghost closed 3 years ago
@awesomebytes to test, I reproduced what image_proc does in python, using the projection and distortion matrices given by calibration.
Sure enough, I am only able to correctly undistort images of size 640x360
, which means this node is telling camera_calibration
to use that same image size, not the 640x480
I am requesting/forcing.
So is there anyway to force the width? Or is this due to a known limitation? My camera says it supports 640x480
, so I'm just confused where 360
width is even coming from?
I doubt the OpenCV backend can change the resolution of a RTSP stream remotely. The image width and height comes from these lines of code: https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L78-L85
Which is called here: https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L214-L217
Which you'll see that is basically getting the size from an actual image received from the stream. video_stream_opencv just reports the size received. Maybe there is some way to force your camera to do 640x480 from the driver side?
@awesomebytes thanks for your assistance. It appears the latest manufacturer firmware must have a bug. I've independently verified with a trivial rospy node just printing the image shape that in fact it is oddly having a height of 360, but that was never the case before the firmware update.
Facing a similar issue here.
However, openCV by default seems to request only the lowest setting 640x480
, and ignores the previous v4l2 configuration.
Turns out OpenCV can indeed change resolution of stream remotely. I do think we should add lines like this here
...
cap->set(CV_CAP_PROP_FRAME_WIDTH, latest_config.width);
cap->set(CV_CAP_PROP_FRAME_HEIGHT, latest_config.height);
I would gladly open a PR if that'll work @awesomebytes
Camera displays properly but forced image width is not accepted. I'm concerned this might hurt the accuracy of a camera calibration that uses the topics published by this node if it's publishing the wrong image width?
I do not have a calibration file because I'm trying to create one from the rtsp stream using this node.