0
点赞
收藏
分享

微信扫一扫

如何还原处理火星车传来的黑白照片

如何还原火星车传来的黑白照片


1. 消除枕形失真

# 直接上代码
import numpy as np
import cv2

src = cv2.imread('../res/img/mars01.jpg')
width = src.shape[1]
height = src.shape[0]

distCoeff = np.zeros((4, 1), np.float64)

# 矩阵参数
k1 = -0.1e-3  # 复数消除桶形失真
k2 = 0.0
p1 = 0.0
p2 = 0.0

distCoeff[0, 0] = k1
distCoeff[1, 0] = k2
distCoeff[2, 0] = p1
distCoeff[3, 0] = p2

# assume unit matrix for camera
cam = np.eye(3, dtype=np.float32)

cam[0, 2] = width / 2.0  # define center x
cam[1, 2] = height / 2.0 - 100# define center y
cam[0, 0] = 10.  # define focal length x
cam[1, 1] = 10.  # define focal length y

# here the undistortion will be computed
dst = cv2.undistort(src, cam, distCoeff)
cv2.imwrite('m1007.jpg', dst)
cv2.imshow('src',src)
dst = cv2.resize(dst, (0, 0), fx=0.5, fy=0.5)
cv2.imshow('dst', dst)
cv2.waitKey(0)
cv2.destroyAllWindows()

处理完后,我们得到如下照片:


2. 黑白照片着色

有关这个的代码参见我以前的文章: 如何把一部黑白电影修复成彩色的

具体过程从略: 见效果图


举报

相关推荐

如何恢复 iPhone 删除的照片?

0 条评论