I am writing a piece of code to extract a submatrix from a matrix. As modules, I imported scipy and Image. When I run the script, I got the error
submatrix = im[x_min:x_max, y_min:y_max]
TypeError: an integer is required
I checked and the min and max values are effectively integers... do you have any suggestion on how to fix this?
x_min = int(x - 50)
x_max = int(x + 50)
y_min = int(y - 50)
y_max = int(y + 50)
if x_min < 0:
x_min = 0
continue
if y_min < 0:
y_min = 0
continue
if x_max > 2160:
x_max = 2160
continue
if y_max > 2592:
y_max = 2592
continue
submatrix = im[x_min:x_max, y_min:y_max]
figure(1)
imshow(submatrix)
break