Ask Your Question
0

Why is image_proc only show the upper left half of my image?

asked 2014-07-14 06:49:02 -0600

PedroGusmao gravatar image

Hello,
I am currently publishing an image which is 1024x1024 pixels and I am trying to rectify it using image_proc. The output of my /camera/camera_info is:

header:
seq: 3692
stamp:
secs: 1405337388
nsecs: 154563950
frame_id: camera
height: 1024
width: 1024
distortion_model: plumb_bob
D: [-0.183149270183746, 0.139143255380374, 0.00225718725189143, 0.00131346587970189, 0.0]
K: [1189.58587069262, 0.0, 501.625685647322, 0.0, 1188.97100074168, 550.474655398214, 0.0, 0.0, 1.0]
R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]
P: [1151.62145996094, 0.0, 501.542604357335, 0.0, 0.0, 1150.24182128906, 553.703494449055, 0.0, 0.0, 0.0, 1.0, 0.0]
binning_x: 2
binning_y: 2
roi:
x_offset: 0
y_offset: 0
height: 0
width: 0
do_rectify: True

While the header of the output of /camera/image_raw is:
header:
seq: 7082
stamp:
secs: 1405337872
nsecs: 724561256
frame_id: camera
height: 1024
width: 1024
encoding: mono8
is_bigendian: 0
step: 1024

So the problem is that, when I run $ROS_NAMESPACE=camera image_proc image_proc I get images to be published at /camera/image_rect that have the following header:

header:
seq: 20
stamp:
secs: 1405338132
nsecs: 447977005
frame_id: camera
height: 512
width: 512
encoding: mono8
is_bigendian: 0
step: 512

I can see with image_view that the image in the rectified version is only the 512x512 upper left of the original 1024x1024 image_raw Does anyone know why image_proc is only grabbing only the first upper 512x512 pixels of my image? It seems to me to be some kind of ROI problem, but I cannot see where...

Thanks in advance, Pedro

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-14 10:19:59 -0600

PedroGusmao gravatar image

Hi, I think I have found the answer.

The problem is how to treat the "pixel binning" fields of the Camera Info Messages. The driver I am using actually publishes that the camera has already processed the original image and has used a 2x2 pixel binning to reduce the size of the image alongo with the new (reduced) dimension of the image. The package image_proc however, uses that information once again to generate an empty matrix for the rectified image. i.e.: My camera driver uses Format7 Video Mode 0 to produce a 1024x1024 image (after binning its original 2048x2048 using 2x2 bins).

The problem is that it also publishes the binning information, so

binning_x: 2
binning_y: 2

Which causes some problems for image_proc for it tries to generate a (1024/2)x(1024/2) empty matrix which will be partially filled up with the rectified frame...

See ya

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-14 06:49:02 -0600

Seen: 78 times

Last updated: Jul 14 '14