Using getrect for Image Processing
이전 댓글 표시
I am trying to use the getrect function to replace a selected portion of one image with the corresponding portion in another image (provided the images are of the same size and class). getrect(...) returns the coordinates of the selected rectangle so we know what the starting and stopping rows and columns are. I used two sample images:
X=imread('office_1.jpg');
Y=imread('office_5.jpg');

Here is what I did:
imshow(X)
rect = getrect;
x1=rect(1);
x2=rect(2);
y1=rect(3);
y2=rect(4);
X(x1:x2, y1:y2)=Y(x1:x2, y1:y2);
Z = X;
imshow(Z)
However, after I select an area, the resulting image (Z) is just the first image (X). What is wrong here?
Any suggestions would be greatly appreciated.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Blocked Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!