OpenCV used to have function GetSubRect see e.g. https://docs.opencv.org/2.4/modules/core/doc/old_basic_structures.html
So the following lines where valid:
top = cv.GetSubRect(tmp, (0, 0, W, H/4))
left = cv.GetSubRect(tmp, (0, 0, W/4, H))
bottom = cv.GetSubRect(tmp, (0, H*3/4, W, H/4))
right = cv.GetSubRect(tmp, (W*3/4, 0, W/4, H))
whitenesses = []
whitenesses.append(cv.Sum(top)[2])
whitenesses.append(cv.Sum(left)[2])
whitenesses.append(cv.Sum(bottom)[2])
whitenesses.append(cv.Sum(right)[2])
Now OpenCV has moved on and uses numpy array all over.
https://stackoverflow.com/a/58211775/1497139 tries to explain this but has no upvotes.
ROI = image[y1:y2, x1:x2]
Would now be the new approach. But then it should be possible to write a GetSubRect function that is compatible to the old style this way.
How would such a GetSubRect function look like?
Why is there no such function in OpenCV any more to ease the migration?