Generate new centered image at one point

Asked

Viewed 56 times

3

I did a processing and found a point in the image that meets my criteria. I need to cut the original image into a smaller one (120x120) that has that center point. I tried to do the following:

img = cv2.imread(path,cv2.IMREAD_GRAYSCALE)
mx = pegarPontox()
my = pegarPontoy()
novaImagem = img[mx-60:mx+60][my-60:my+60]

However, it returns me an empty list. How do I cut?

1 answer

5


I searched the OS in English and saw that my slice in the array was wrong, I do the following:

array[inicio:fim][incio:fim]

But the right thing so:

array[inicio:fim, inicio:fim]

The idea of crop image is correct but my application was flawed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.