• <small id='fJCJc'></small><noframes id='fJCJc'>

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

        使用 Chessboard 进行 OpenCV 转换

        时间:2023-09-18
          <tbody id='i86kE'></tbody>

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

        1. <tfoot id='i86kE'></tfoot>
          <legend id='i86kE'><style id='i86kE'><dir id='i86kE'><q id='i86kE'></q></dir></style></legend>
            <bdo id='i86kE'></bdo><ul id='i86kE'></ul>

              1. <i id='i86kE'><tr id='i86kE'><dt id='i86kE'><q id='i86kE'><span id='i86kE'><b id='i86kE'><form id='i86kE'><ins id='i86kE'></ins><ul id='i86kE'></ul><sub id='i86kE'></sub></form><legend id='i86kE'></legend><bdo id='i86kE'><pre id='i86kE'><center id='i86kE'></center></pre></bdo></b><th id='i86kE'></th></span></q></dt></tr></i><div id='i86kE'><tfoot id='i86kE'></tfoot><dl id='i86kE'><fieldset id='i86kE'></fieldset></dl></div>
                • 本文介绍了使用 Chessboard 进行 OpenCV 转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我刚刚开始尝试使用 OpenCV.我有一个带有静态位置的 LCD 设置,我想从图像中提取屏幕上显示的内容.我见过用于校准相机的棋盘图案,但它似乎是用来使图像不失真的,这不是我想要做的.

                  I have only just started experimenting with OpenCV a little bit. I have a setup of an LCD with a static position, and I'd like to extract what is being displayed on the screen from the image. I've seen the chessboard pattern used for calibrating a camera, but it seems like that is used to undistort the image, which isn't totally what I want to do.

                  我想我会在 LCD 上显示棋盘,然后找出将 LCD 图像直接在头顶上并裁剪成棋盘的理想视图所需的转换.然后我会存储转换,更改 LCD 显示的内容,拍照,执行相同的转换,并获得当前显示内容的理想视图.

                  I was thinking I'd display the chessboard on the LCD and then figure out the transformations needed to convert the image of the LCD into the ideal view of the chessboard directly overhead and cropped. Then I would store the transformations, change what the LCD is displaying, take a picture, perform the same transformations, and get the ideal view of what was now being displayed.

                  我想知道这听起来是不是个好主意?有没有更简单的方法来实现我想要做的事情?以及我应该使用哪些函数来找出转换、执行转换、存储转换(也许只是将转换矩阵保存在内存中或将它们写入文件)等方面的任何提示?

                  I'm wondering if that sounds like a good idea? Is there a simpler way to achieve what I'm trying to do? And any tips on the functions I should be using to figure out the transformations, perform them, store them (maybe just keep the transform matrices in memory or write them to file), etc?

                  推荐答案

                  我不确定我是否正确理解了您尝试做的所有事情,但请耐心等待.

                  I'm not sure I understood correctly everything you are trying to do, but bear with me.

                  有些相机的镜头会导致图像稍微失真,为此 OpenCV 提供了帮助 相机校准过程.

                  Some cameras have lenses that cause a little distortion to the image, and for this purpose OpenCV offers methods to aid in the camera calibration process.

                  实际上,如果您想编写一个可以自动校正图像失真的应用程序,首先,您需要发现需要哪些神奇的值用于撤消此效果.这些值来自正确的校准程序.

                  Practically speaking, if you want to write an application that will automatically correct the distortion in the image, first, you need to discover what are the magical values that need to be used to undo this effect. These values come from a proper calibration procedure.

                  棋盘图像 与 校准相机的应用程序.因此,在您拥有相机设备拍摄的棋盘图像后,将此图像传递给校准应用程序.该应用程序将识别正方形的角并计算失真值并返回您需要用来抵消失真效果的神奇值.此时,您对 calibrateCamera 返回的 2 个变量感兴趣():它们是cameraMatrixdistCoeffs.打印出来,把数据写在一张纸上.

                  The chessboard image is used together with an application to calibrate the camera. So, after you have an image of the chessboard taken by the camera device, pass this image to the calibration app. The app will identify the corners of the squares and compute the values of the distortion and return the magical values you need to use to counter the distortion effect. At this point, you are interested in 2 variables returned by calibrateCamera(): they are cameraMatrix and distCoeffs. Print them, and write the data on a piece of paper.

                  最后,您正在开发的系统需要有一个函数/方法来使图像不失真,这两个变量将在函数内部进行硬编码,然后调用 cv::undistort()(如果你使用的是 OpenCV 的 C++ API):

                  At the end, the system you are developing needs to have a function/method to undistort the image, where these 2 variables will be hard coded inside the function, followed by a call to cv::undistort() (if you are using the C++ API of OpenCV):

                  cv::Mat undistorted;
                  cv::undistort(image, undistorted, cameraMatrix, distCoeffs);
                  

                  就是这样.

                  自动检测旋转可能有点棘手,但首先要做的是找到您感兴趣的对象的坐标.但如果相机处于固定位置,这将很容易.

                  Detecting rotation automatically might be a bit tricky, but the first thing to do is find the coordinates of the object you are interested in. But if the camera is in a fixed position, this is going to be easy.

                  有关 OpenCV 的透视变化和旋转的更多信息,我建议查看以下其他问题:

                  For more info on perspective change and rotation with OpenCV, I suggest taking a look at these other questions:

                  在一组 cv::Point 上执行 cv::warpPerspective 以进行伪校正

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

                  使用 cv::warpAffine 偏移目标图像旋转 cv::Mat

                  这篇关于使用 Chessboard 进行 OpenCV 转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何从图像中检测文本区域? 下一篇:将 2D 像素阵列旋转 90 度

                  相关文章

                  最新文章

                      <tfoot id='KCvNL'></tfoot>
                    1. <small id='KCvNL'></small><noframes id='KCvNL'>

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