Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

change

trunctaed.copyTo(target);   // erases all content  of target and keeps truncated part only.

to

trunctaed.copyTo(target(cv::Rect(0, 0, 30, 30))); // replace specified rect with truncate.

change

trunctaed.copyTo(target);   // erases all content  of target and keeps truncated part image only.

to

trunctaed.copyTo(target(cv::Rect(0, 0, 30, 30))); // replace specified rect of target with truncate.
truncate image.

change

trunctaed.copyTo(target);   // erases all content  of target and keeps truncated image only.

to

trunctaed.copyTo(target(cv::Rect(0, 0, 30, 30))); // replace specified rect of target with truncate image.

above change gives.

image description

change

trunctaed.copyTo(target);   // erases all content  of target and keeps truncated image only.

to

trunctaed.copyTo(target(cv::Rect(0, 0, 30, 30))); // replace specified rect of target with truncate image.
Highgui.imwrite(PATH6, target); //img_3  result is in target.

above change gives.

image description

change

trunctaed.copyTo(target);   // erases all content  of target and keeps truncated image only.

to

trunctaed.copyTo(target(cv::Rect(0, 0, 30, 30))); // replace specified rect of target with truncate image.
Highgui.imwrite(PATH6, target); //img_3  result is in target.

above change gives.

image description

Update :

    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(cv::Rect(0, 0, 30, 30))); 
    Highgui.imwrite(PATH6, target); //img_3