using opencv2.4.11 java API i am trying to truncate part of an image and then place it on another image.
the code posted below shows, the truncate Mat object is a truncated part of the img_1 posted below. and img_2 is the image that should host the truncated part of the "truncated" Mat object.
When i run the code, the result is the img_3, and i exepected to see img_2 overlapped with the "truncated" Mat object.
please let me know how to achieve this properly.
static final String PATH5 = "c:.../images/CannyDest.jpg";
static final String PATH6 = "c:.../images/BlurredDest.jpg";
public static void main(String[] args) {
....
....
....
Mat temp = Highgui.imread(PATH5);//img_1
Mat trunctaed = temp.submat(new Rect(0, 0, 30, 30));
Mat target = Highgui.imread(PATH6);//img_2
trunctaed.copyTo(target);
Highgui.imwrite(PATH6, trunctaed);//img_3
}
img_1
img_2
img_3