简体   繁体   English

使用OpenCV使视频帧不失真

[英]Undistort video frames with OpenCV

I have been trying to calibrate my camera with OpenCV2 for a while now. 我一直在尝试使用OpenCV2校准摄像机。 I have searched all over the internet (especially the documentation) for some existing codes, which can give me the answer to my simple question, but have found nothing. 我已经在整个互联网(尤其是文档)中搜索了一些现有代码,这些代码可以为我的简单问题提供答案,但没有发现任何问题。 It might be useful for the others ! 对其他人可能有用!

I've followed this tutorial to generate a .xml file with all the stuff for the undistort function ( here it is ). 我已经按照本教程生成了一个.xml文件,其中包含undistort函数的所有内容( 这里是 )。

My questions are how should I use undistort(...) : 我的问题是应该如何使用undistort(...)

  • What matrix correspond to wich argument of undistort ? 什么矩阵对应于undistort的极点参数?

  • Do I have to call undistort at each new frame (object : Mat ) or there is a method in C++ in order to do it once on the camera (object : VideoCapture ) ? 我是否必须在每个新帧(对象: Mat )上调用undistort,或者在C ++中有一种方法才能在摄像机上进行一次处理(对象: VideoCapture )?

  • Is there any tool or OpenCV methods wich take .xml maxtrix and do it for us ? 是否有任何工具或OpenCV方法采用.xml maxtrix来为我们做?

PS: When we'll manage to do it, I'll upload some code here for the community, if such tool doesn't already exist. PS:当我们设法做到这一点时,如果该工具尚不存在,我将在此处为社区上传一些代码。

Answers inline: 内联答案:

  • What matrix correspond to wich argument of undistort ? 什么矩阵对应于undistort的极点参数?
    • Match the names: Camera_Matrix in the XML is cameraMatrix in undistort, Distortion_Coefficients is distCoeffs k1, k2, p1, p2, k3 匹配名称:XML中的Camera_Matrix是不失真的cameraMatrix,Distortion_Coefficients是distCoeffs k1,k2,p1,p2,k3
  • Do I have to call undistort at each new frame (object : Mat) or there is a method in C++ in order to do it once on the camera (object : VideoCapture) ? 我是否必须在每个新帧(对象:Mat)处调用undistort,或者在C ++中有一种方法才能在摄像机上进行一次处理(对象:VideoCapture)?
    • AFAIK yes, there is not a way to push the undistortion into the camera's DSP AFAIK是的,没有办法将不失真推入相机的DSP
  • Is there any tool or OpenCV methods wich take .xml maxtrix and do it for us ? 是否有任何工具或OpenCV方法采用.xml maxtrix来为我们做?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM