2019-12-06 07:26:10 -0600 | received badge | ● Famous Question (source) |
2015-06-21 12:06:51 -0600 | received badge | ● Notable Question (source) |
2014-10-10 10:02:45 -0600 | received badge | ● Popular Question (source) |
2013-07-14 04:03:15 -0600 | received badge | ● Editor (source) |
2013-07-14 03:55:51 -0600 | asked a question | Android OpenCV find Square edges in contour then getPerspectiveTransform and warpPerspective Hello, I have asked this question in stackoverflow (http://stackoverflow.com/questions/17637730/android-opencv-getperspectivetransform-and-warpperspective) but I think there will be a lot of people who can help me with my problem. I am a bit confused with the parameters of getPerspectiveTransform as I cannot see a proper image. Here is my code. The original_image variable is the image that contains a square object (and some others) that I want to crop and create a new image (something like this http://stackoverflow.com/questions/17512234/android-opencv-find-largest-square-or-rectangle). The variables p1, p2, p3, and p4 are the coordinates of the corners of the largest square/rectangle in the image. p1 is the upper left, p2 is the upper right, p3 is the lower right, and p4 is the lower left (clockwise assigning). When I try to display cropped_image, I get a "I don't know what it is" image. I think my parameters in getPerspectiveTransform() are incorrect (or is it). Please help. Thanks! Update: When I debugged my code, I found out that the edges of my square/rectangle are incorrect, well some are quite right except for p4. This is my code to detect the edges of the square or rectangle in the image. My image is all black except for the contour of the largest square/rectangle which has a white outline. Here is my sample image. ignore the colored circles as they are drawn after the edges are detected: |