Let’s try to view an Image of size 1366
x 768.
To view the image:
I = imread('Vatican-City-Wallpaper_.jpg');
figure,imshow(I);
Reference:
The image is too big. I want to view the image part by part,
so that I can view the details in the image more clearly.
Method one:
I use MATLAB function ‘imshow’ and the ‘figure’ command.
To view the image:
I = imread('Vatican-City-Wallpaper_jpg');
figure,imshow(I);
Now click the ‘zoom in’ option to enlarge the image.
ZOOM IN |
Click the ‘pan’ option and drag the cursor to view the image
part by part.
Method two:
We can do the image viewing using our own code instead of
using ‘zoom in’ and ‘pan’ options.
We will define our own window and display the image alone.
%Read the Image
I=imread('Vatican-City-Wallpaper_.jpg');
Im=I;
%Get the Screen size and
define the window
scrsz = get(0,'ScreenSize');
figure('Position',[300 50
scrsz(3)-600 scrsz(4)-200],'Menu','none','NumberTitle','off','Name','VIEW PHOTO','Resize','off');
%Size of the Image Portion
Len=round(size(I,1)/4);
Flag=1;
x=1;
wid=Len;
y=1;
ht=Len;
%Display the image
ax=axes('Position',[0 .1 1 .8],'xtick',[],'ytick',[]);
imshow(Im(x:wid,y:ht,:));
Num=50;
while(Flag==1)
try
%User button click
waitforbuttonpress;
pt=get(ax,'CurrentPoint');
y1=round(pt(1,1));
x1=round(pt(1,2));
%Calculate the Next part of the
image based on the button press
if( x1 < Len && x1 > 0 && y1 < Len && y1 > 0)
x=x+x1;
y=y+y1;
if(x-Num>1)
x=x-Num;
end
if(y-Num>1)
y=y-Num;
end
if(x+wid>size(I,1))
x=size(I,1)-wid;
end
if(y+ht>size(I,2))
y=size(I,2)-ht;
end
%New Image Part
imshow(Im(x:x+wid,y:y+ht,:));
wid=Len;
ht=Len;
end
catch
Flag=0;
end
end
Click to the right from the above mentioned part |
2 comments:
It's useful & impressive. Thanks for your thoughtful content
That's very informative, thanks. You can also have a look at my projects and download them for free:
http://berksoysal.blogspot.com/p/deneme2.html
http://berksoysal.blogspot.com/p/blog-page_20.html
Enjoyed Reading? Share Your Views