Question

I am working with a fish-eye camera and need the reverse the distortion before any further calculation, In this question this is happening Correcting fisheye distortion

src = cv.LoadImage(src)
dst = cv.CreateImage(cv.GetSize(src), src.depth, src.nChannels)
mapx = cv.CreateImage(cv.GetSize(src), cv.IPL_DEPTH_32F, 1)
mapy = cv.CreateImage(cv.GetSize(src), cv.IPL_DEPTH_32F, 1)
cv.InitUndistortMap(intrinsics, dist_coeffs, mapx, mapy)
cv.Remap(src, dst, mapx, mapy, cv.CV_INTER_LINEAR + cv.CV_WARP_FILL_OUTLIERS,  cv.ScalarAll(0))

The problem with this is that this way the remap functions goes through all the points and creates a new picture out of. this is time consuming to do it every frame. They way that I am looking for is to have a point to point translation on the fish-eye picture to normal picture coordinates.

The approach we are taking is to do all the calculations on the input frame and just translate the result coordinates to the world coordinates so we don't want to go through all the points of a picture and create a new one out of it. (Time is really important for us)

In the matrices mapx and mapy there are some point to point translations but a lot of points are without complete translation. I tried to interpolate this matrices but the result was not what I was looking for.

Any help in would be much appreciated, even other approaches which are more time efficient than cv.Remap.

Thanks

Was it helpful?

Solution

I think what you want is cv.UndistortPoints().

Assuming you have detected some point features distorted in your distorted image, you should be able to do something like this:

cv.UndistortPoints(distorted, undistorted, intrinsics, dist_coeffs)

This will allow you to work with undistorted points without generating a new, undistorted image for each frame.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top