''' height, width = self.coeffs['shape'] ux,uy = self.getDeflection(width, height) r = self.coeffs['reprojectionError']#is RMSE of imgPoint-projectedPoints #transform to standard uncertainty #we assume rectangular distribution: ux = ux/(2 * 3**0.5) uy = uy/(2 * 3**0.5) return (ux,r), (uy,r), () if __name__ == '__main__': from fancytools.os.PathStr import PathStr import sys folder = PathStr(imgProcessor.__file__).dirname().join( 'media', 'lens_distortion') imgs = folder.all() l = LensDistortion() l.calibrate(board_size=(4,11), method='Asymmetric circles', images=imgs, sensorSize_mm=(18,13.5) ) print l.getCoeffStr() img = l.drawChessboard() if 'no_window' not in sys.argv: cv2.imshow('chessboard', img) cv2.waitKey(0)
(1x,2x), (1y, 2y), (intensity:None) 1. px-size-changes(due to deflection) 2. reprojection error ''' height, width = self.coeffs['shape'] fx, fy = self.getDeflection(width, height) # is RMSE of imgPoint-projectedPoints r = self.coeffs['reprojectionError'] t = (sharpness**2 + r**2)**0.5 return fx * t, fy * t if __name__ == '__main__': from fancytools.os.PathStr import PathStr import sys folder = PathStr(imgProcessor.__file__).dirname().join( 'media', 'lens_distortion') imgs = folder.all() l = LensDistortion() l.calibrate(board_size=(4, 11), method='Asymmetric circles', images=imgs, sensorSize_mm=(18, 13.5)) print(l.getCoeffStr()) img = l.drawChessboard() if 'no_window' not in sys.argv: cv2.imshow('chessboard', img) cv2.waitKey(0)