Jonathan Le Cornichone
Jonathan Le Cornichone

Reputation: 372

Use WarpPerspective() on a point (PointF ?)

I wish to use WarpPerspective() on a single point.

Currently I am using it on an image and it's working :

Mat warpMatrix = CvInvoke.GetPerspectiveTransform(_srcCorners, _destCorners);

Image<Bgra, byte> dstImg = new Image<Bgra, byte>(width, height);
CvInvoke.WarpPerspective(img, dstImg, warpMatrix, new System.Drawing.Size(width, height),
   Inter.Linear, Warp.Default, BorderType.Transparent);

I wish to do the same on a point (Pointf). I have made some test but everytime I get 0,0 :/. Example :

Mat warpMatrix = CvInvoke.GetPerspectiveTransform(_srcCorners, _destCorners);

VectorOfPointF src = new VectorOfPointF(new PointF[] { point });
VectorOfPointF ret = new VectorOfPointF();
CvInvoke.WarpPerspective(src, ret, warpMatrix, new Size(1,1),
   Inter.Linear, Warp.Default, BorderType.Transparent);

Please, can you help me ? :)

Upvotes: 0

Views: 544

Answers (1)

gnodab
gnodab

Reputation: 878

OpenCV uses a different function for transforming points and/or vectors. See the perspectiveTransform section of the documentation.

Upvotes: 1

Related Questions