If you wanna protect the aspect ratio, its not possible because there can not be common divisor for width and height for couple iteration. After a while, it ll crash anyway(if width and height not equal). You can determine the ratio according to your requirements. I just chose 1.05 and tested, looks fine.
You can do it by using a loop. Each iteration(click) will resize it. Here is the code:
int main()
{
Mat imgIn;
imgIn = imread("/ur/image/directory/img.jpg");
while(1)
{
resize(imgIn,imgIn,Size(imgIn.cols/1.05,imgIn.rows/1.05));
imshow("imgIn",imgIn);
waitKey(0);
}
return 0;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.