Generate new image centered on a point

2

I did a rendering and found a dot in the image that meets my criteria. I need to cut the original image into a smaller one (120x120) centered at this point. I tried 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 make this cut?

    
asked by anonymous 18.09.2018 / 17:24

1 answer

4

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 correct way is this:

array[inicio:fim, inicio:fim]

The idea of crop in the image is correct but my application has failed.

    
18.09.2018 / 18:49