I have a problem. I have an image. Then I have to split the image into two equal parts. I made this like that (the code is compiled, everything is good):
Mat
How about this:
Mat newImage = image.clone();
Mat image_temp1 = newImage(Rect(0, 0, image.cols, image.rows/2));
Mat image_temp2 = newImage(Rect(0, image.rows/2, image.cols, image.rows/2));
By not using clone()
to create the temp images, you're implicitly modifying newImage
when you modify the temp images without the need to merge them again. After changing image_temp1
and image_temp2
, newImage
will be exactly the same as if you had split, modified, and then merged the subimages.