Ask Your Question

Revision history [back]

What is the difference between cropping an image and applying an ROI (region of interest) on the image

Having a base image (640x640) I want to know if applying a ROI with a rectangular shape (100x100) compared to cropping the image in the same rectangular shape (100x100) has any difference on performance.

I think that, because after applying the ROI, the resulting image has the same dimensions as the original one (640x640), applying some function on this image will take more time compared to applying the same function on the cropped image (which has only 100x100). The question that arises immediately is: wouldn't the operation of cropping the image compensate the time needed to compute the rest of the 640x640 - 100x100 pixels?

Hope I was clear enough. Thanks in advance

What is the difference between cropping an image and applying an ROI (region of interest) on the image

EDIT:

Having a base image (640x640) (640x640) I want to know if applying a rectangular white shape mask of (100x100), in another words, a ROI with a rectangular shape (100x100) is more time consuming compared to cropping the image in the same rectangular shape (100x100) has any difference on performance.(100x100).

What I consider as being a ROI

mask = np.zeros_like(original_image)
shape = np.array([[a,b,c,d]])
cv2.fillPoly(mask, shape, (255,255,255))
cv2.bitwise_and(original_image, mask)

The way of cropping

cropped = original_image[x:y, z:t]

I want to apply a function (e.g transform to grayscale) or apply a color filter on the image.

I think that, because after applying the ROI, the that doing so on the ROIed image will be more time consuming as there are many more pixels (the resulting image has the same dimensions as the original one (640x640), (640x640)).

On the other hand, applying some function on this the cropped image will take more less time compared to applying the same function on the cropped image (which has only 100x100). the latter.

The question that arises immediately is: wouldn't the operation of cropping the image compensate the time needed to compute the rest of the 640x640 640x640 - 100x100 100x100 pixels?

Hope I was clear enough. Thanks in advance

What is the difference between cropping an image and applying an ROI (region of interest) on the image

EDIT:

Having a base image (640x640) I want to know if applying a rectangular white shape mask of (100x100), in another words, a ROI is more time consuming compared to cropping the image in the same rectangular shape (100x100).

What I consider as being a ROI

mask = np.zeros_like(original_image)
shape = np.array([[a,b,c,d]])
cv2.fillPoly(mask, shape, (255,255,255))
cv2.bitwise_and(original_image, mask)

The way of cropping

cropped = original_image[x:y, z:t]

I want to apply a function (e.g transform to grayscale) or apply a color filter on the image.

I think that doing so on the ROIed image will be more time consuming as there are many more pixels (the resulting image has the same dimensions as the original one (640x640)).

On the other hand, applying some function on the cropped image will take less time compared to the latter.

The question is: wouldn't the operation of cropping the image compensate the time needed to compute the rest of the 640x640 - 100x100 pixels?

Hope I was clear enough. Thanks in advance

What is the difference between cropping an image and applying an ROI (region of interest) on the image

EDIT:

Having a base image (640x640) I want to know if applying a rectangular white shape mask of (100x100), in another words, a ROI is more time consuming compared to cropping the image in the same rectangular shape (100x100).

What I consider as being a ROI

mask = np.zeros_like(original_image)
shape = np.array([[a,b,c,d]])
cv2.fillPoly(mask, shape, (255,255,255))
cv2.bitwise_and(original_image, mask)

The way of cropping

cropped = original_image[x:y, z:t]

I want to apply a function (e.g transform to grayscale) or apply a color filter on the image.

I think that doing so on the ROIed image will be more time consuming as there are many more pixels (the resulting image has the same dimensions as the original one (640x640)).

On the other hand, applying some function on the cropped image will take less time compared to the latter.

The question is: wouldn't the operation of cropping the image compensate the time needed to compute the rest of the 640x640 - 100x100 pixels?

Hope I was clear enough. Thanks in advance