美文网首页
OpenCV 中剪切图片

OpenCV 中剪切图片

作者: 我是传奇lz | 来源:发表于2019-02-14 09:15 被阅读2次

这个创建的mat指针就是纸箱原图像, 意味着对剪切后的图片修改是会影响原图片的, 如果这不你想要的那么需要 copy 一份。

// 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);

https://stackoverflow.com/a/8268062/4435159

相关文章

网友评论

      本文标题:OpenCV 中剪切图片

      本文链接:https://www.haomeiwen.com/subject/rgsseqtx.html