Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

WarpAffine

siddy
Beginner
274 Views
I am looking for some help to do the following: I have a 2D affine
transform obtained from an external source, and I am trying to use
this to resample an Image using WarpAffine. The transformation parameters
were calculated with reference to a center different from the origin. Since
WarpAffine has no parameter to specify thre center of the transform, I wanted
to know what sequence of steps I should pass my coeff[2][3] through, to ensure
that the transformation applied to the image is around the same center with
reference to which it was derived.

Thanks,
Sid.
0 Kudos
3 Replies
siddy
Beginner
274 Views
Hi again,
I though a bit more about the problem, and I figured out
that I will have to recenter the coordinates, i.e X-C, prior to
applying the resampling on the grid. To restate,
If the usual approach for resampling is X' = AX, where A is the
transform and X is the image grid (giving f(X') actually), how do
I go about implementing X' = A(X-C) using available ip primitives,
where C is the center of the transform.
Thanks again,
Sid.
0 Kudos
Yuri_Tikhomirov__Int
New Contributor I
274 Views
Hi Sid,

Let affine transform is
xD = c00*xS + c01*yS + c02
yD = c10*xS + c11*yS + c12

The coordinates of centers are (xScenter, yScenter) and (xDcenter, yDcenter).
So we should use:
xD = c00*(xS-xScenter) + c01*(yS-yScenter) + xDcenter
yD = c10*(xS-xScenter) + c11*(yS-yScenter) + yDcenter

Then the desired coefficients are
02 = xDcenter - c00*xScenter - c01*yScenter
12 = yDcenter - c10*xScenter - c11*yScenter

Thanks,
Beg
0 Kudos
siddy
Beginner
274 Views
Hi Beg,
Let me rejuvenate this thread, with reference to my latest thread regarding getAffineTransform for a quadilateral:

if the initial quad of Q = {(xi,yi), i=0,1,2,3}, and the final quad is Q'= {(x'i,y'i), i = 0,1,2,3}, and coeffs[2][3]
are obtained by ippiGetAffineTransform between Q and Q', to what center are this coeffs referred to? Am i right
in thinking : (x2-x1)/2 and (y2-y1)/2 ?

Thanks
Sid.

0 Kudos
Reply