【发布时间】:2021-01-30 18:50:05
【问题描述】:
我在没有改变任何环境条件以及没有重新对焦的情况下,从固定相机一张一张地拍摄了两张图像,图像在人眼看来完全一样。我比较了得分为 0.74 和均方误差为 330 而不是 1 和 0 的结构相似性。我认为这是由于相机的连拍、快门或任何其他属性。
我使用的代码。
def compare_images(imageA, imageB,title,mulichanel=True):
# compute the mean squared error and structural similarity
# index for the images
m = mse(imageA, imageB)
s = measure.compare_ssim(imageA, imageB,multichannel=mulichanel)
# setup the figure
fig = plt.figure(title)
plt.suptitle("MSE: %.2f, SSIM: %.2f" % (m, s))
# show first image
ax = fig.add_subplot(1, 2, 1)
plt.imshow(imageA, cmap = plt.cm.gray)
plt.axis("off")
# show the second image
ax = fig.add_subplot(1, 2, 2)
plt.imshow(imageB, cmap = plt.cm.gray)
plt.axis("off")
# show the images
plt.show(
)
客户代码:
img_1 = cv2.imread('/path/to/image1')
img_2 = cv2.imread('path/to/image2')
img_1 = cv2.cvtColor(img_1, cv2.COLOR_BGR2RGB)
img_2 = cv2.cvtColor(img_2, cv2.COLOR_BGR2RGB)
compare_images(img_2,img_1,"2 similer images")
输出:
为了得到具有精确结构相似性的连续图像 (1) 什么 所有相机参数需要控制或任何其他方式
图片来源
图片 1:https://drive.google.com/file/d/1chGP6Ia5ryRV1eRcg6iiCchcFlMg1k9F/view?usp=sharing
图片 2:https://drive.google.com/file/d/1gk6ibwI7hkU2frAFDyg4YD2-Pvl10u1B/view?usp=sharing
最好的问候,
莫希特
【问题讨论】:
-
抱歉,不清楚您的问题是什么。
标签: python image-processing camera computer-vision android-camera