Spectre
unread,Feb 8, 2012, 10:34:40 AM2/8/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-opencv
Hello everyone,
I'm trying to map polygonal region with 4 vertices to whole screen
after I detect it.
So I have captured screen in Mat mGray, do some preprocessing, find
contour of polygon. Now I want to map that region (inside polygon) to
whole mGray image and display it. I tried to use
getPerspectiveTransform to find transformation matrix like this:
...
Mat polygon = new Mat(4,1,CvType.CV_32FC2);
List<Point> approxPts = new ArrayList<Point>();
org.opencv.utils.Converters.Mat_to_vector_Point(approxContours.get(0),
approxPts);
polygon.put(0, 0, approxPts.get(0).x,approxPts.get(0).y,
approxPts.get(1).x,approxPts.get(1).y,
approxPts.get(2).x,approxPts.get(2).y,
approxPts.get(3).x,approxPts.get(3).y );
Mat screenMat = new Mat(4,1,CvType.CV_32FC2);
screenMat.put(0, 0, 0.0,0.0, mGray.width(),0.0,
mGray.width(),mGray.height(), mGray.width(),mGray.height());
Mat transMat = new Mat(3,3,CvType.CV_32FC2);
transMat = Imgproc.getPerspectiveTransform(polygon, screenMat);
...
now I want to use Imgproc.warpPerspective function but I actualy don't
know what shall I pass as src and dst. I'd be grateful if anyone can
give me an advice.
Thanks in advance.