@StarSky
2017-06-16T03:51:49.000000Z
字数 561
阅读 861
工作日记
OpenCV
Actually,I need extend a img with white pixs arround,what my colleague done is creating a new img,loop the old one pixel by pixel and set them into the new image, I think there must be a function in OpenCV can implement it
Mat binaryImg(height, width, CV_8U, Scalar(255));
Mat imageROI = binaryImg(Rect(h0,w0,h,w));
img.copyTo(imageROI);
Or use range
Mat a(20, 20, CV_8UC1, cv::Scalar(0));
a.copyTo(grayImg(Range(10,30),Range(10,30)));
An import thing is using copyTo()
to assignment value between Mat.
ref:
https://stackoverflow.com/questions/10481411/copy-an-cvmat-inside-a-roi-of-another-one