When we have an image to be used as an input to a CNN and we want to classify only part of the image, we usually feed the classifier with a crop of the image.
Lets say my image is called frame and x
, y
, w
and h
are xmin
, ymin
, xmax
and ymax
, respectively:
frame = frame[y:y + h, x:x + w] #Crop a part of the image
What does y:y
or x:x
mean and why do we sum them to h
and w
, respectively?
I've been seeing some people performing the crop in the following way:
frame = frame[y:h, x:w] #Crop a part of the image without adding to `w` and `h`
I saw the second approach being used in some places like in the following line: https://github.com/balajisrinivas/Face-Mask-Detection/blob/master/detect_mask_video.py#L51
What's the difference?