LensDistortion.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:imgProcessor 作者: radjkarl 项目源码 文件源码
def getUndistortRectifyMap(self, imgWidth, imgHeight):

        if self.mapx is not None and self.mapx.shape == (imgHeight, imgWidth):
            return self.mapx, self.mapy

        cam = self.coeffs['cameraMatrix']
        d = self.coeffs['distortionCoeffs']

        (newCameraMatrix, self.roi) = cv2.getOptimalNewCameraMatrix(cam,
                                                                    d, (imgWidth,
                                                                        imgHeight), 1,
                                                                    (imgWidth, imgHeight))

        self.mapx, self.mapy = cv2.initUndistortRectifyMap(cam,
                                                           d, None, newCameraMatrix,
                                                           (imgWidth, imgHeight), cv2.CV_32FC1)
        return self.mapx, self.mapy
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号