srv / avt_vimba_camera

ROS Driver for AVT cameras using VIMBA SDK
23 stars 93 forks source link

Image is wrongly formed #6

Closed qbranchmaster closed 9 years ago

qbranchmaster commented 9 years ago

I wrote my ros node, which subscribes /camera/image_raw topic. Sometimes I get error: "Image is wrongly formed: step < width * byte_depth * num_channels or 1917 != 1920 * 1 * 1". The same error I get in image_view node (http://wiki.ros.org/image_view). I changed this line of code: VmbUint32_t step = nSize / height; to: VmbUint32_t step = width; in VimbaROS::frameToImage() function (vimba_ros.cpp) and now everything works fine. What is the problem?

miquelmassot commented 9 years ago

Hi @qbranchmaster! I think you're not the first to point that out. However, the step is defined as the full row lenght in bytes in sensor_msgs. And VIMBA API returns the whole image size in bytes from

 vimba_frame_ptr->GetImageSize(nSize);

So, in order to calculate the number of bytes in one row, I needed the total size and the number of rows (the height). If you write that t_step equals to width you are asumming that each pixel occupies one byte.

Could you please print the values of size, step, width and height before one of these errors please?

qbranchmaster commented 9 years ago

I normally get these values: SIZE = 2764800, STEP = 1920, WIDTH = 1920, HEIGHT = 1440 After some random time I get these values: SIZE = 2758176, STEP = 1915, WIDTH = 1920, HEIGHT = 1440 and my application crashes.

miquelmassot commented 9 years ago

The size is obtained from the image frame data received from the camera. If the number of bytes drops, it may be caused by lost packages in the network. I don't know if your camera is GigE, but I guess it is, so I'd like to know first how the camera is connected to the computer and if the network interface is completely dedicated to the camera. Could you check if, connecting the camera directly to the network card in the computer returns this same errors?

qbranchmaster commented 9 years ago

You are right. I am using GigE network card, but my PoE supply is only 100mb. Changing 100mb PoE to GigE PoE fixed the problem.

miquelmassot commented 9 years ago

Fantastic @qbranchmaster! If you are careful with the bandwidth I'm sure your 100Mb PoE should also work. I'll close the issue now. Thanks for reporting!

AlexisTM commented 7 years ago

The solution for people without 1Gbit PoE, is to reduce the stream_bytes_per_second in the launchfile.

If you have a 100MBit ethernet, keep the sum of all stream_bytes_per_second under 85MBits to avoid framedrop & malformed images.