cv::Mat originalMat = cv::imread("image.jpg"); cv::Mat cloneMat = originalMat.clone();
cv::Mat originalMat = cv::imread("image.jpg"); cv::Rect roi(10, 10, 100, 100); cv::Mat roiMat = originalMat(roi).clone();In this example, we read an image from a file and create a `Rect` object defining a region of interest. We then create a new matrix called `roiMat` by cloning the section of the original matrix identified by the ROI. Package library: OpenCV (cv)