Can you cancel/stop a resize function? Say if开发者_高级运维 it is resizing an image for 4 seconds and I would like to cancel it after 2 seconds (timing does not matter) because I do not want to resize this particular image, is there a method of doing so?
cvResize(srcImg, dstImg, CV_INTER_AREA); //Cancel this function
If you're on a platform that supports POSIX threads, you could start a new thread to
perform the cvResize operation, then use pthread_cancel if you need to stop
it before it runs to completion. There's nothing built into standard C++ or OpenCV
to do what you're asking.
What @Jim says is the way to go. But another approach that might work for you is simply to check the size of the image before executing cvResize(). You probably know which image takes 4 seconds to process, so what you can do is always check the size of the image and if it's too big, you just don't call cvResize().
加载中,请稍侯......
精彩评论