Note that there are some explanatory texts on larger screens.

plurals
  1. POAffine Transform, Simple Rotation and Scaling or something else entirely?
    primarykey
    data
    text
    <p>The scenario goes like this: I have a picture of a paper that I would like to do some OCR. So take the image below as my input example:</p> <p><img src="https://i.stack.imgur.com/Spl0H.jpg" alt="orig_image"></p> <p>After successfully detecting the area that corresponds to the paper I'm left with a <code>vector&lt;Point&gt;</code> of 4 coordinates that define its location inside the image. Note that these coordinates will probably not correspond to a perfect rectangle due to the distance of the camera and angle when the picture was taken. For viewing purposes I connected the points in the sub-image so you can see what I mean:</p> <p><img src="https://i.stack.imgur.com/nVd0p.jpg" alt="detected_image"></p> <p>In this case, the points are: [1215, 43] , [52, 67] , [56, 869] and [1216, 884]</p> <p>At this moment, I need to adjust these points so they become aligned horizontally. What do I mean by that? If you notice the area of the sub-image above, it is a little rotated: the points on right side of the image are positioned a little higher than points on the other side.</p> <p>In other words, we have image <strong>A</strong>, which was exaggerated on purpose to look a little more distorted/rotated than reality, and then image <strong>B</strong> - which is what I would like as the final result of this procedure:</p> <p>A) <img src="https://i.stack.imgur.com/GJ575.jpg" alt="bad_rect"> B) <img src="https://i.stack.imgur.com/ijOyl.jpg" alt="ok_rect"></p> <p>I'm not sure <strong>which techniques</strong> could be used to achieve this transformation. The application also needs to <strong>detect automatically</strong> how much rotation needs to be done, as I don't have control over the image acquisition procedure. </p> <p>The purpose is to have a new <code>Mat</code> with the <em>normalized</em> sub-image. I'm not worried about a possible image distortion right now, I'm just looking for a way to identify how much rotation needs to be done on the sub-image and how to apply it and get a more <em>rectangular area</em>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload