¡@

Home 

2014/10/15 ¤U¤È 10:12:28

iphone Programming Glossary: paperwidth

adjust corners and crop the image openCV

http://stackoverflow.com/questions/13098073/adjust-corners-and-crop-the-image-opencv

the paper you want to extract. In my example I assume you're extracting a DIN A4 paper 210x297mm . Feel free to edit paperWidth and paperHeight inside my code. Combining everything looks like this Helper cv Point getCenter std vector cv Point points.. return sqrt dx dx dy dy cv Mat getPaperAreaFromImage cv Mat image std vector cv Point square declare used vars int paperWidth 210 in mm because scale factor is taken into account int paperHeight 297 in mm because scale factor is taken into account.. paperHeight we always want to scale the image down to maintain the best quality possible paperImage cv Mat paperWidth scaleFactor paperHeight scaleFactor CV_8UC3 paperVertices 0 cv Point 0 0 paperVertices 1 cv Point paperHeight scaleFactor..