How to crop an image like MATLAB's imcrop function?

I have to translate a MATLAB code to Python, and I have to crop an image by using a given window (a rectangle). In MATLAB, the syntax is the next:

recorte = imcrop(im, v)

recorte is the cropped image, im is the image and v the rectangle window I’m using to crop it. How it would work in CV? I’m looking everywhere and didn’t get a solution.

Thanks in advance.

hahahahaha you can have done much, if you missed that

it’s just a numpy slice here (look it up, please !):

crop = img[y:y+h, x:x+w]
1 Like

but how can I implement this with the code I have? I have seen this before but I don’t know it

we can only help with what we can see.