How to copy a ROI from the image when dealing with OpenCV?

Hello, here is my code:
img = cv2.imread('data\\Hunt.jpg', cv2.CAP_MODE_GRAY)
cv2.imshow('w', img)
ROI = []
Roi = 0

while (Roi != (0,0,0,0)):
 Roi = cv2.selectROI('w',img)
 if Roi != (0,0,0,0):
 ROI.append(img[Roi[0]:Roi[1] Roi[2]:Roi[3]])

It is seen that the allocation of ROI to a variable Roi recorded the four values of the first two, probably the coordinates of the upper left corner of the area, the latter two are, respectively, the lower right corner. Since the original image I need only the ROI, it is, I imagine, will act as their landlord, so to speak. However, I did not get the coordinates to all pixels of this black-and-white image. On off.the website OpenCV there is an example using
img[280:340, 330: 390]
And then assigned to the variable all is written normally, but there in the example color image, perhaps because of this, in my case this does not work, because only assigns an empty array
As I am interested in several areas of ROI, there is not suitable one-off function of cutting out pixels, if such a thing exists.
P. S: I Tried to use the function cv2.copyMakeBorder() which gives the original image and the coordinates, only where they are marked as top,bottom,left,right, but with all the flags this function, it merely copied all of the original image, which looked differently now
March 23rd 20 at 19:43
0 answer

Find more questions by tags OpenCVPython