Perspective transform of SVG paths (four corner distort)

This is my drag distort proposal (share you knowledge, Q&A-style). Live example is in http://jsfiddle.net/xjHUk/278/ and the main code is this: (only output window: http://jsfiddle.net/xjHUk/279/embedded/result/) function transferPoint (xI, yI, source, destination) { var ADDING = 0.001; // to avoid dividing by zero var xA = source[0].x; var yA = source[0].y; var xC = source[2].x; var … Read more

Perspective Transform + Crop in iOS with OpenCV

So after a few days of trying to solve it, I came up with a solution (Ignore the blue dots on the second image): As promised, here’s a complete copy of the code: – (void)confirmedImage { cv::Mat originalRot = [self cvMatFromUIImage:_sourceImage]; cv::Mat original; cv::transpose(originalRot, original); originalRot.release(); cv::flip(original, original, 1); CGFloat scaleFactor = [_sourceImageView contentScale]; CGPoint … Read more

How does perspective transformation work in PIL?

To apply a perspective transformation you first have to know four points in a plane A that will be mapped to four points in a plane B. With those points, you can derive the homographic transform. By doing this, you obtain your 8 coefficients and the transformation can take place. The site http://xenia.media.mit.edu/~cwren/interpolator/ (mirror: WebArchive), … Read more

Executing cv::warpPerspective for a fake deskewing on a set of cv::Point

So, first problem is corner order. They must be in the same order in both vectors. So, if in the first vector your order is:(top-left, bottom-left, bottom-right, top-right) , they MUST be in the same order in the other vector. Second, to have the resulting image contain only the object of interest, you must set … Read more