I have the following c code implementation and i want to port to c++ i want to use equivalent to cvSetImageROI ,cvResetImageROI
cvSetImageROI(pMainImg,cvROIRect);
cvMatchTemplate(pMainImg, pTempImg, res, CV_TM_CCOEFF_NORMED );
cvResetImageROI(pMainImg);
but i did not find the equivalent function in c++ implementation
is that the only way to create new matrix and path the ROI to the original Matrix such as
cv::Mat roiImg;
roiImg = img2(roi);
is there any other way to do my job directly inside the original matrix ?