In Past of times, to Read the image from the ‘cap’ class and not real-time read will cause read the past image.
To solve this, all you need to do is change the size of imgae buffer.
cap = cv2.VideoCapture(device)
# set the size of buffer area
cap.set(cv2.CAP_PROP_BUFFERSIZE,1)