Ok, so I changed my code, see below.
Also I calculated the percentages for read, crop and show. It is now more clear that the read time drops significantly At 1280x704 and 640x480.
And another question. Is it possible to read just a part of the sensor? Instead of capturing full resolution and then cropping? I came across CAP_PROP_ZOOM but print(feed.get(cv2.CAP_PROP_ZOOM)) returns -1
while True:
start = cv2.getTickCount()
frame = read_frame()
print(f'read: {cv2.getTickCount() - start}')
start = cv2.getTickCount()
frame = crop(frame, roi_x, roi_y, roi_w, roi_h)
print(f'crop: {cv2.getTickCount() - start}')
start = cv2.getTickCount()
show(frame)
print(f'show: {cv2.getTickCount() - start}')