Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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 ?

no, cropping is almost for free, an operation like:

cv:: Mat cropped = image(cv::Rect(10,10,100,100));

does not copy any memory, it returns a new Mat header with updated sizes, while the data points to the original memory (with some offset)

( same for numpy "slices" like `image[10:110, 10:110] )

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 ?

no, cropping is almost for free, an operation like:

cv:: Mat cropped = image(cv::Rect(10,10,100,100));

does not copy any memory, it returns a new Mat header with updated sizes, while the data points to the original memory (with some offset)

( same for numpy "slices" like `image[10:110, 10:110] image[10:110, 10:110] )