I keep working on monitoring code and I can't find a good way to compare images. Best I've got so far is nrmse but nrmse doesn't do well when sun hides behind clouds. What is the best approach to compare images when camera sits still in one place?
counter = 0
camera_name = "Pi"
camera_fps = 30
# Create a VideoCapture object
camera_feed = cv2.VideoCapture(0)
# Check if camera opened successfully
if (camera_feed.isOpened() == False):
print("Unable to read camera feed")
# Default resolutions of the frame are obtained.The default resolutions are system dependent.
frame_width = int(camera_feed.get(3))
frame_height = int(camera_feed.get(4))
out = cv2.VideoWriter('outpy.flv', cv2.VideoWriter_fourcc('F', 'L', 'V', '1'), camera_fps, (frame_width, frame_height))
while (True):
ret, frame = camera_feed.read()
if ret == True:
counter += 1
if not counter % camera_fps:
for image in source_images:
print(counter)
nrmse_of_frame = nrmse(get_image_from(frame), source_images[image])
if nrmse_of_frame < 0.95:
print("NRMSE of %s:" % image, nrmse_of_frame)
# Display the resulting frame
cv2.imshow('frame', frame)
# Press Q on keyboard to stop recording
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Break the loop
else:
break
camera_feed.release()
cv2.destroyAllWindows()