Distortion Correction without any camera information

8 Ansichten (letzte 30 Tage)
Richard
Richard am 2 Okt. 2020
Kommentiert: Richard am 3 Okt. 2020
I have a image which has pincushion distortion. I know nothing about the camera parameters, e.g. focal length, projection, etc.
I can, using SVD (singular value decomposition), successfully compute the coefficients of the polynomial that correct the image at the point centers, since I know the relative positions of the ideal points - point correspondences between points.
So, the polynomial is of the form
x = a0 + a1x + a2y + a3xy + a4x^2 + a5y^2;
y = b0 + b1x + b2y + b3xy + b4x^2 + b5y^2;
There are 6 different sets of of 12 coefficients, on set for each line of dots.
When I apply the coefficients with polynomials to the center of ground truth points, they map perfectly to the center of the distorted points.
So far so good.
My question is, what is the way to get the coefficients "between" the dots, to map the points between the dots to the ideal points?
My idea was to interpolate weights between each row:
weightA = 1 - n weightB = n
where n is from 0 - 1.0.
So for instance the first row would have a weight of 1, with n= 0. and row 2 coefficients would have a weight of 1, as weightA would be 0.
e.g. weightA *a0 + weightB b0, for all coeffients.
And the middle, would be half of each coefficient summed.
middle coefficients = 0.5*a0 + 0.5b0...0.5a5+0.5b5
So a linear weighting between the two.
This however, in my tests seems to give me the wrong results.
So, my question is, is the approach correct and my calculations incorrect, or is the approach for interpolating / weighting the coefficients wrong?
Thanks

Antworten (1)

Bjorn Gustavsson
Bjorn Gustavsson am 3 Okt. 2020
To my understanding you are supposed to fit the polynomials to the full set of points, not row-by-row but all 36 points. That should give you 2 correction-polynomials to apply for each image coordinate.
HTH
  4 Kommentare
Richard
Richard am 3 Okt. 2020
thank you for for your answer.
the data is being prescaled to be centered and mean distance of 2^1/2 from center to minimize the effects raising the pixel coordinate to the nth power, in this case n is 2.
the svd does the fit.
these are x ray calibration patterns and algorithms as described in this lecture @10 minutes in
the algorithm is well explained, at least well enough, except how to get only 2 sets of coefficients as you mention, and he does too in the lecture, is at this time not understood by me.
thanks
Richard
Richard am 3 Okt. 2020
i was just pointed to
Domingo Montgomery git hub, and his XVis package has similar code to mine, and i see i was setting up my matrix incorrectly - your first comment about getting only 1 set of pairs of cefficients was correct, of course, and i think i see where inset things up incorrectly.
thanks for your advice.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by