matlab - How to apply transformation on rectangle coordinates -


i detecting object in code , drawing rectangle around it. have 4 variables draw rectangle: x, y, width, , height. have found transformation matrix needs applied on rectangle. transformation matrix returned 3*3 matrix this:

tinv =      1.0022    0.0018        0     -0.0018    1.0022         0     -0.4353   -0.9079    1.0000 

how apply transformation on rectangle using matrix?

what should calculate 4 vertices of rectangle , apply transformation on each individual vertex. should easy enough; if you're trying do, use following say:

x = 1; y = 2.34; w = 3.21; h = 2; 

the vertices (assuming (x,y) denotes top left vertex of rectangle base @ 0 radian:

(x1,y1) = (1,2.34) (x2,y2) = (4.21,2.34) (x3,y3) = (4.21,0.34) (x4,y4) = (1,0.34) 

this represented as:

[ 1.00    2.34    0.00 4.21    2.34    0.00 4.21    0.34    0.00 1.00    0.34    1.00 ] 

this transformed required simple matrix multiplication.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -