OpenCV 中剪切图片

2019-02-14  本文已影响2人  我是传奇lz

这个创建的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

上一篇 下一篇

猜你喜欢

热点阅读