Capture and compare images within the script