changed the method for getting an image, because in python cap.read returns a tuple of an image and a boolean.