[关闭]
@StarSky 2017-06-16T03:51:49.000000Z 字数 561 阅读 859

2017-06-12 paste img on a bigger one

工作日记 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

  1. Mat binaryImg(height, width, CV_8U, Scalar(255));
  2. Mat imageROI = binaryImg(Rect(h0,w0,h,w));
  3. img.copyTo(imageROI);

Or use range

  1. Mat a(20, 20, CV_8UC1, cv::Scalar(0));
  2. 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

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注