Undistorting a depth map

asked 2018-04-16 13:36:00 -0600

laxn_pander gravatar image

Hey guys,

I am currently trying to undistort a floating point mat (CV_32F) with the distortion map of the camera. It works well with the RGB image, but produces strange results with the floating point depth map. I always thought, the x/y position gets corrected, independent of the value at the position. But it seems like this is not the case, is it?

(Note: The color map might influence the appearance of the result, but i don't think that much.)

Before undistort:

image description

After undistort:

image description

edit retag flag offensive close merge delete


You may get more attention to this question if you cut and paste some code into your question which serves as a simple reproducer for your issue, and the input data it needs.

opalmirror gravatar imageopalmirror ( 2018-04-16 13:43:32 -0600 )edit

Okay, it is answered. I used CV_INTER_LINEAR and my depth map has extreme outliers. These outliers seem to dominate over the inliers. Changed to CV_INTER_NN and it looks good now!

laxn_pander gravatar imagelaxn_pander ( 2018-04-16 13:53:42 -0600 )edit

Good to hear it. I'm curious what the improved output looks like.

Also (I see you are new here)... If you have enough Karma (QA Forum points) to able to answer your own question by adding an answer below (it may take 24 hours for your previous points to add up so you can answer your own question), then you may get a bunch more Karma points, which means you have more choices of action next time you have a question. I'm interested in some of the same things you are and am fairly new to OpenCV myself (ROS indigo and kinetic, Ubuntu 14 and 16, disparity, object recognition, etc.).

opalmirror gravatar imageopalmirror ( 2018-04-16 14:06:42 -0600 )edit

The improved one looks very similiar to the first image (distortion of the camera was low). That's also what I expected. Can't show a good result, a little bit difficult to grab from my framework. :D

laxn_pander gravatar imagelaxn_pander ( 2018-04-16 14:34:31 -0600 )edit