如何在OpenCV中将图像调整为特定大小? [英] How to resize an image to a specific size in OpenCV?
本文介绍了如何在OpenCV中将图像调整为特定大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IplImage* img = cvLoadImage("something.jpg");
IplImage* src = cvLoadImage("src.jpg");
cvSub(src, img, img);
但源图像的大小不同于 img
。
But the size of the source image is different from img
.
是否有任何opencv函数将其调整为 img
size?
Is there any opencv function to resize it to the img
size?
推荐答案
您可以使用 cvResize
。或者更好地使用c ++接口(例如 cv :: Mat
而不是 IplImage
和 cv :: imread
而不是 cvLoadImage
),然后使用 cv :: resize
解除分配本身。
You can use cvResize
. Or better use c++ interface (eg cv::Mat
instead of IplImage
and cv::imread
instead of cvLoadImage
) and then use cv::resize
which handles memory allocation and deallocation itself.
这篇关于如何在OpenCV中将图像调整为特定大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文