ROI region opencv c++ vs python
Define ROI:
Mat roi(image,Rect(corners[0].x,corners[0].y,s,s));
if(roi.rows<1||roi.cols<1)
return empty;
I need to find ROI using above code
This is what I'm trying to do in python
x,y,w,h= [corners[0][0], corners[0][1],s,s]
roi = image[y:y+h, x:x+w]
(the values of x,y,w,h) is ((1161.4393398282202, -1.0606601717798214, 2.121320343559643, 2.121320343559643) but getting error "TypeError: slice indices must be integers or None or have an __index__ method" Then I convert the value of x,y,w,h into int but doesn't work
I also tried to use cv2.selectROI(winsize,image)
winsize = x,y,w,h but still dosent work getting error "TypeError: only size-1 arrays can be converted to Python scalars"
please tell me what should I do.