matlab - how to produce projective transformation matrix best fit for multiple 4-point sets? -


normally using kind of matlab code projective transformation single set of reference points:

fixedpoints = [0 0; 50 0; 50 100; 0 100]; movingpoints= [752 361; 888 361; 885 609; 736 609]; transformationtype='projective'; tform = fitgeotrans(movingpoints,fixedpoints,transformationtype); imagepr = imwarp(image,tform); 

now have photo shows (for example 10) jumbled paper sheets, each known size, situated on plain large table. distances between these sheets unknown.

so have 10 4-reference-point sets obtain projective transformation matrix , later projected image of 2d table surface.

how can produce optimized transformation matrix (and later projected image), include 4-points sets kind of best fit?

thanks in advance.

i feel need reformulate problem follows: have table rectangular sheets of same size* in arbitrary positions , image taken camera in arbitrary position. want compute homographic transform maps plane of table image (or conversely). coordinates of 4 corners of every sheet known in image, not on table, , point correspondences not available. reference coordinate system of table arbitrary.

as hinted op, problem can solved every sheet independently assigning "table" coordinates corners. equations linear. (anyway 2 solutions possible swapping long , short sides of sheets.)

it appears impossible combine various per-sheet solutions, relative placement of sheets unknown, , coefficients unrelated.

starting initial solution, 1 can think of using least-squares approach refine solution, minimizing total discrepancy between known side lengths , estimated transform. (we can use known sides , diagonals, though 1 of these 6 elements can derived other five. orientation ambiguity solved taking orientation gives minimum discrepancy.)

unfortunately, equations aren't nice, calling levenberg-marquardt or constrained minimization: sledge hammers.

the op made excellent suggestion: solve projection problem sheets , compute discrepancy metric each , keep solution lowest discrepancy. reminds of ransac, instead of random attempts, exhaustive search made**.

if 1 wants further improve solution (presumably pretty one), 1 can think of derivative-less methods simplex (nelder–mead), hooke-jeeves patterns or sequential descent, trying improve discrepancy metric.

taking few best solutions has benefit of giving order of magnitude increments apply coefficients. difficulty appears, due fact "table" coordinate system isn't fixed. avoid drift of solutions, 1 should add constrains, such distances corners of reference sheet.

*if sheets of different sizes, can use same approach if sheet correspondence known (but exact corner correspondence unnecessary).

**if necessary, increased robustenss, should possible integrate outlier rejection process in minimization.


the projection of plane onto image described homographic relation

x = (a x + b y + c) / (g x + h y + 1)  y = (d x + e y + f) / (g x + h y + 1) 

there 8 unknown parameters, , takes 4 point correspondences determine them.

these equations linearized as

a x + b y + c                 - g x x - h x y = x                 d x + e y + f - g y x - h y y = y 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -