我有一个图像转换为CvMat
矩阵说CVMat source
。一旦我得到一个感兴趣的区域source
我希望算法的其余部分仅应用于该感兴趣的区域。为此,我想我将不得不以某种方式裁剪source
我无法这样做的矩阵。有没有一种方法或函数可以裁剪CvMat
矩阵并返回另一个裁剪后的矩阵CvMat
矩阵?谢谢。
OpenCV 具有您可能会觉得有用的感兴趣区域函数。如果您正在使用cv::Mat
那么你可以使用类似下面的东西。
// You mention that you start with a CVMat* imagesource
CVMat * imagesource;
// Transform it into the C++ cv::Mat format
cv::Mat image(imagesource);
// Setup a rectangle to define your region of interest
cv::Rect myROI(10, 10, 100, 100);
// Crop the full image to that image contained by the rectangle myROI
// Note that this doesn't copy the data
cv::Mat croppedImage = image(myROI);
提取子图像的文档
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)