0
votes

I have question regrading undistortion of a single point using either Scaramuzza or Mei's opencv I have done the calibration on a dataset and extracted camera matrix and distortion coefficient (for mei) and the necessary parameters for Scaramuzza, after getting mapx (map1) and mapy (map2) I want to apply the undistortion on a single point.

for mei:

we have a position for a point (an intersection in a chess board) in a fisheye image, I was able to find its position using findchessboardcoreners (I know this can be used for calibration but I want to know a position for a well-known point in the image), now I have the undistorted image and I want to know the position of that point after the distortion correction, I have read many links, suggesting to use undistortpoints method, or by using remap method, and I read links describing that dst(x,y)=src(mapx(x,y),mapy(x,y)) and I applied them all but when I draw the resulted point it wasn't on the same intersection of the chessboard it was even out of the board closer to its position in the fisheye

for Scaramuzza:

I tried to understand world2cam and cam2world methods but still I can't get it right

so

is there a method to know the position of a single point after the distortion correction if we have its position before the distortion? also can someone explain in deep way mapx and mapy .. I have read examples about them and how they can be used but whenever I wanted to implement the mapping between the distorted point and the undistorted one I got confused, for example: mapx and mapy should have the size of the src (in my case it is a point) so how can I use remap method here? or I should get them form the camera matrix and distortion coefficient and use dst(x,y)=src(map1(x,y),map2(x,y) ?

note I have applied estimateNewCameraMatrixForUndistortRectify, initUndistortRectifyMap and remap successfully on images (for mei's) and I have also applied the undistortion method which was implemented by Scaramuzza on images with a very satisfying result (better than mei)

1
you can apply the distortion formula or take a lookup in the maps for that pixel locationMicka
The maps are given in the opposite direction: map1(x,y), map1(x,y) gives the X, Y coordinate in the source (distorted) image. Assume you are iterating the x,y destination image, and for each pixel you ask: Where is the pixel in the source image to place in x, y? the maps gives you the X, Y in the source image. (X,Y are not integers).Rotem
okay I can see, but if I have a point and its position is (50,60) (just as an example) and I have mapx and mapy and I want to know its new position in the undistorted image, how can I calculate it?sumaia
sorry, since map1 and map2 are giving the reverse direction, you'll have to compute the lookup-matrix manually with the distortion/undistortion formula.Micka
@Micka okay thank you very much, I will try to do thatsumaia

1 Answers

0
votes

I was able to solve it by undistortpoints openCV function, the problem was I did not use the fisheye::undistortPoints but I was using the original one, still the surrounded points are not in their right position but the result was kind of acceptable