我试图比较一个图像和另一个文件的所有图像,得到差异百分比最小的差异百分比和打印文件名。。。。如果我试图将输出差异附加到列表中。。。我得到一个错误说“浮点值不能迭代”。。。。这是我迄今为止所做的。。。。在from itertools import izip
import os
import numpy as np
import cv2
from matplotlib import pyplot as plt
from PIL import Image
import math
res = 0
def take_and_save_picture(im_save):
'''Take a picture and save it
Args:
im_save: filepath where the image should be stored
'''
camera_port = 0
ramp_frames = 30
cap = cv2.VideoCapture(camera_port)
def get_image():
retval, im = cap.read()
return im
for i in xrange(ramp_frames):
temp = get_image()
print("Taking image...")
# Take the actual image we want to keep
camera_capture = get_image()
#im_save_tmp = im_save + '.jpg