Does OpenCV blobFromImage preserve the aspect ratio of the input image?
I wonder if the cv::blobFromImage()
preserves the aspect ratio of the input image when it applies a resize or it stretches the image to the target size.
The documentation says "If crop is false, direct resize without cropping and preserving aspect ratio is performed". The word "and" makes the sentence a bit vague raising the question if "without" applies to the "preserving aspect ratio".
here's what it does
and maybe, one should say: it's preserving the train image ratio , not the aspect ratio of your input image
So, it does not preserve the aspect ratio. Thanks a lot.
yea, it's a bit backwards. in fact, setting crop to false would preserve your input ratio, but in most cases, this is not desirable, as your image could be one of a dog, 1024x256,with a 128x128 dog somewhere in the middle.