使用 cv2.fisheye undistort 时无法重新映射保留所有黑色区域

问题描述

使用 cv2.fisheyeUndistortRectifyMap() 生成 map1 和 map2 后,使用 cv2.UndistortRectifyMap() 重新映射时,即使将 Balance 保持为 1,我也无法获取完整的黑色区域。 预期图像的所有角都应可见,包括缺失的左下角和左上角和右上角,使生成的图像显示为星形。

#Camera Matrix
mtx = np.array([[965.,0.,960.],[  0.,970.,540.],1.]])

#distortion Matrix
dist = np.array([[-0.07234645],[-0.00707313],[0.00762894],[-0.00343638]])

# Sample Image requiring the undistortion with black unwarp
img = cv2.imread("Sample.jpg")
img_shape = img.shape[:2][::-1]

# New camera matrix using fisheye
new_K = cv2.fisheye.estimateNewCameraMatrixForUndistortRectify(mtx,dist,img_shape,np.eye(3),balance=1)

# Overlaying the maps on a higher resolution to fetch the extensions
map1,map2 = cv2.fisheye.initUndistortRectifyMap(mtx,new_K,(int(1920*1.5),int(1080*1.5)),cv2.CV_32F)

# Using the remap function to overlay the resultant image
res_img = cv2.remap(img,map1,map2,interpolation=cv2.INTER_LINEAR,borderMode=cv2.BORDER_CONSTANT)

此处使用的示例与结果图像一起附在下面

Input to the code Sample.jpg:

input to the code 327_Sample.jpg

Output of the code appears as so:

output of the code appears as so

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...