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));
Or use range
Mat a(20, 20, CV_8UC1, cv::Scalar(0));
An import thing is using
copyTo() to assignment value between Mat.