Resize while Keeping Ratio
Hello,
How to do a resize with Opencv while keeping the aspect ratio ?
Is it automatically integrated ?
Thank you, Christophe
The aspect ratio is preserved when both width and height are scaled by the same factor.
To resize an image to a fixed width (similar logic for fixed height), scale both the width and height by a scale factor given by:
double scale = float(width)/input.size().width;
cv::resize(inputArray, outputArray, cv::Size(0, 0), scale, scale);
Asked: 2019-03-04 05:13:23 -0600
Seen: 12,848 times
Last updated: Mar 04 '19