def transform(self, img, k1=0.22, k2=0.24):
"""Apply barrel distortion using OpenCV's Undistort operation
This counteracts the pincushion distortion that the Oculus lens
applies. The distortion coefficients k1 and k2 are the main
action here.
[1]: http://docs.opencv.org/trunk/doc/py_tutorials/py_calib3d/\
py_calibration/py_calibration.html
"""
return cv2.undistort(
img,
self.d_matrix,
np.array([k1, k2, 0, 0, 0])
)
评论列表
文章目录