How to zoom in the Image by ROI in MATLAB -
i have 2 images. want see more detail in special region (roi). hence, draw red rectangular , zoom in original size (256 256) , display in second row below expected result. me solve in matlab? current code
img1 = imread('peppers.png'); img2 = imread('coins.png'); img1=imresize(img1,[256 256]); img2=imresize(img2,[256 256]); %%draw rectangle subplot(221);imshow(img1); rectangle('position',[100 50 20 20], 'linewidth',2, 'edgecolor','r'); subplot(222);imshow(img2);rectangle('position',[100 50 20 20], 'linewidth',2, 'edgecolor','r'); %% zoom in image
try (when images appears, use mouse select region of interest):
img1 = imread('peppers.png'); img1=imresize(img1,[256 256]); f=figure; imshow(img1); rect = getrect(f); %//select roi mouse img1_roi = img1( rect(2) : (rect(2)+rect(4)) , rect(1) : (rect(1)+rect(3)) , : ); %//store roi in matrix img2 = imread('coins.png'); img2= imresize(img2,[256 256]); f=figure; imshow(img2); rect = getrect(f); %//select roi mouse img2_roi = img2( rect(2) : (rect(2)+rect(4)) , rect(1) : (rect(1)+rect(3)) , : ); %//store roi in matrix %//plot subplot(2,2,1) imshow(img1) subplot(2,2,2) imshow(img2) subplot(2,2,3) imshow(img1_roi) subplot(2,2,4) imshow(img2_roi) 
Comments
Post a Comment