Mapping Irregular Quadrilateral to a Rectangle

I have an electronic camera considering a computer system monitor from differing angles. Given that the electronic camera is a grid of pixels, I can specify the bounds of the monitor in the electronic camera photo as :

I wish that makes good sense. What I intend to do is think of an algorithm to convert factors within this form to this :

I have factors within the very same domain name as ABCD, as established from the electronic camera, yet I require to attract these factors in the domain name of the monitor is resolution.

Does that makes good sense? Any kind of suggestions?

2019-12-02 03:09:26
Source Share
Answers: 2

In basic there is no affine makeover that maps an approximate quadrangle onto a rectangular shape. Yet there is (specifically one) projective makeover $T$ that maps an offered quadrangle $(A, B, C, D)$ in the projective aircraft onto an offered quadrangle $(A', B', C' D')$ in the very same or an additional projective aircraft. This $T$ is ${\it collinear}$, i.e., it maps lines to lines. To do the estimations you need to present uniform works with $(x,y,z)$ such that $D=(0,0,1)$, $C=(1,0,1)$, $A=(0,1,1)$, $B=(1,1,1)$ and also in a similar way for $A'$, $B'$, $C'$, $D'$. Relative to these works with the map $T$ is straight and also its matrix is the identification matrix.

2019-12-03 05:09:13

I've been duke it outing a really comparable trouble in order to establish slopes in an uneven quad grid and also requiring to map factors within approximate quadrangles to a device square. On top of that, I call for the inverted mapping of the x and also y axis at the mapped stabilized coordinate area back right into the quad so I can establish the alignment of the quad grid then. i.e. if [x',y'] are the changed works with, I require to be able to do an inverted change on [0,y'],[1,y'] and also [x',0],[x',1]. Below is what I've thought of :

You can separate the quad right into 2 tris, and also make use of affine maps on these independently. This is uncomplicated. This will certainly create a noticable result at the department in between both tris, nonetheless.

If you desire a smooth mapping from a quad to a square (or rectangular shape), you require to make use of a non - affine change such as a projective change. There are various other changes apart from projective that will certainly additionally function, as well as additionally be colinear (maintain straight lines).

If [x1,y1],[x2,y2],[x3,y3],[x4,y4] are the 4 factors in the quad, after that the 4x4 matrix B in the the adhering to will certainly produce a mapping right into the square (on the RHS) that appears to function and also might be less complicated to calculate than the correct 3x3 projective matrix.

%     [x1 y1 x1*y1 1]              [0 0 0 1]
%     [x2 y2 x2*y2 1]   X  B  =    [1 0 0 1]
%     [x3 y3 x3*y3 1]              [0 1 0 1]
%     [x4 y4 x4*y4 1]              [1 1 1 1]

The inquiry I have is that if one does this, and afterwards intends to make use of the inverse of B to do the inverted change, just how do you compute the 3rd components of the area vectors for the orthogonal works with. (They are no more x *y.)

NOTE : If you intend to map right into any kind of various other (approximate) quadrilateral (such as a rectangular shape), after that simply change the RHS of what I have over with the new works with.

%     [x1 y1 x1*y1 1]              [x1' y1' x1'*y1' 1]
%     [x2 y2 x2*y2 1]   X  B  =    [x2' y2' x2'*y2' 1]
%     [x3 y3 x3*y3 1]              [x3' y3' x3'*y3' 1]
%     [x4 y4 x4*y4 1]              [x4' y4' x4'*y4' 1]
2019-12-03 03:18:40