• <tfoot id='D1w1Y'></tfoot>
    1. <legend id='D1w1Y'><style id='D1w1Y'><dir id='D1w1Y'><q id='D1w1Y'></q></dir></style></legend>

          <bdo id='D1w1Y'></bdo><ul id='D1w1Y'></ul>

        <i id='D1w1Y'><tr id='D1w1Y'><dt id='D1w1Y'><q id='D1w1Y'><span id='D1w1Y'><b id='D1w1Y'><form id='D1w1Y'><ins id='D1w1Y'></ins><ul id='D1w1Y'></ul><sub id='D1w1Y'></sub></form><legend id='D1w1Y'></legend><bdo id='D1w1Y'><pre id='D1w1Y'><center id='D1w1Y'></center></pre></bdo></b><th id='D1w1Y'></th></span></q></dt></tr></i><div id='D1w1Y'><tfoot id='D1w1Y'></tfoot><dl id='D1w1Y'><fieldset id='D1w1Y'></fieldset></dl></div>

        <small id='D1w1Y'></small><noframes id='D1w1Y'>

        仿射变换、简单旋转和缩放或其他完全不同的东

        时间:2023-09-19
          <tbody id='7lj2k'></tbody>

          <small id='7lj2k'></small><noframes id='7lj2k'>

          • <tfoot id='7lj2k'></tfoot>
            • <bdo id='7lj2k'></bdo><ul id='7lj2k'></ul>
              <legend id='7lj2k'><style id='7lj2k'><dir id='7lj2k'><q id='7lj2k'></q></dir></style></legend>

                • <i id='7lj2k'><tr id='7lj2k'><dt id='7lj2k'><q id='7lj2k'><span id='7lj2k'><b id='7lj2k'><form id='7lj2k'><ins id='7lj2k'></ins><ul id='7lj2k'></ul><sub id='7lj2k'></sub></form><legend id='7lj2k'></legend><bdo id='7lj2k'><pre id='7lj2k'><center id='7lj2k'></center></pre></bdo></b><th id='7lj2k'></th></span></q></dt></tr></i><div id='7lj2k'><tfoot id='7lj2k'></tfoot><dl id='7lj2k'><fieldset id='7lj2k'></fieldset></dl></div>
                  本文介绍了仿射变换、简单旋转和缩放或其他完全不同的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  场景是这样的:我有一张纸的图片,我想做一些 OCR.所以以下面的图片作为我的输入示例:

                  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:

                  在成功检测到与纸张对应的区域后,我留下了一个 vector 的 4 个坐标,用于定义其在图像内的位置.请注意,由于拍摄照片时相机的距离和角度,这些坐标可能不会对应于完美的矩形.出于查看目的,我连接了子图像中的点,以便您了解我的意思:

                  After successfully detecting the area that corresponds to the paper I'm left with a vector<Point> 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:

                  在这种情况下,点是: [1215, 43] , [52, 67] , [56, 869] 和 [1216, 884]

                  In this case, the points are: [1215, 43] , [52, 67] , [56, 869] and [1216, 884]

                  此时,我需要调整这些点,使它们水平对齐.我是什么意思?如果您注意到上面子图像的区域,它会稍微旋转:图像右侧的点比另一侧的点略高.

                  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.

                  换句话说,我们有图像A,它被故意夸大以看起来比现实更扭曲/旋转,然后是图像B - 这就是我想作为这个程序的最终结果:

                  In other words, we have image A, which was exaggerated on purpose to look a little more distorted/rotated than reality, and then image B - which is what I would like as the final result of this procedure:

                  A) B)

                  我不确定哪些技术可用于实现这种转变.应用程序还需要自动检测需要完成多少旋转,因为我无法控制图像采集过程.

                  I'm not sure which techniques could be used to achieve this transformation. The application also needs to detect automatically how much rotation needs to be done, as I don't have control over the image acquisition procedure.

                  目的是拥有一个带有标准化子图像的新Mat.我现在并不担心可能的图像失真,我只是在寻找一种方法来确定需要在子图像上进行多少旋转以及如何应用它并获得更多矩形区域.

                  The purpose is to have a new Mat with the normalized 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 rectangular area.

                  推荐答案

                  我认为 http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/ 和 http://felix.abecassis.me/2011/10/opencv-bounding-box-skew-angle/ 会派上用场.上述帖子不包括透视扭曲(仅旋转).为了获得最佳结果,您必须使用 warpPerspective(可能与 getRotationMatrix2D 结合使用).使用线段之间的角度来确定需要多少扭曲透视.这里的假设是它们应该始终为 90 度,并且就透视而言,最接近 90 度的向量是最近的"向量.

                  I think http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/ and http://felix.abecassis.me/2011/10/opencv-bounding-box-skew-angle/ will come in handy. The aforementioned posts don't cover perspective warping (only rotation). To get the best results, you'll have to use warpPerspective (maybe in conjunction with getRotationMatrix2D). Use the angles between line segments to find out how much you need to warp the perspective. THe assumption here is that they should always be 90 degrees and that the closest one to 90 degrees is the "closest" vector as far as the perspective is concerned.

                  不要忘记归一化你的向量!

                  Don't forget to normalize your vectors!

                  这篇关于仿射变换、简单旋转和缩放或其他完全不同的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:openCV 2.4.10 bwlabel - 连接组件 下一篇:POCO C++ - NET SSL - 如何发布 HTTPS 请求

                  相关文章

                  最新文章

                  <small id='vyCUl'></small><noframes id='vyCUl'>

                • <i id='vyCUl'><tr id='vyCUl'><dt id='vyCUl'><q id='vyCUl'><span id='vyCUl'><b id='vyCUl'><form id='vyCUl'><ins id='vyCUl'></ins><ul id='vyCUl'></ul><sub id='vyCUl'></sub></form><legend id='vyCUl'></legend><bdo id='vyCUl'><pre id='vyCUl'><center id='vyCUl'></center></pre></bdo></b><th id='vyCUl'></th></span></q></dt></tr></i><div id='vyCUl'><tfoot id='vyCUl'></tfoot><dl id='vyCUl'><fieldset id='vyCUl'></fieldset></dl></div>
                  1. <tfoot id='vyCUl'></tfoot>
                      • <bdo id='vyCUl'></bdo><ul id='vyCUl'></ul>
                      <legend id='vyCUl'><style id='vyCUl'><dir id='vyCUl'><q id='vyCUl'></q></dir></style></legend>