MATLAB: How To Combine Cropped Image to the Original Image

Image Processing Toolboximcrop

Hi All,
I have cropped out a part from my original image and wish to combine it back to the original image.
A 36 by 36 image is cropped from the original image, A then I wish to combine it back to the exact position as it was cropped earlier.
Code as shown:
square = [55 88 35 35];
A = imread (label);
A = imcrop(A, square);
Anyone could please tell me how…
Thank you.

Best Answer

I = imread('cameraman.tif') ; % read image
[I1,rect] = imcrop(I) ; % crop the image
nx = round(rect(1)) ; % location

ny = round(rect(2)) ; % location
w = size(I1,2) ; % width
h = size(I1,1) ; % height
% replace
I(ny:ny+h-1,nx:nx+w-1,:) = I1+100 ;