resolution issues in importing TIFF image

Hi all,
I've a resolution issue while trying to import a TIFF image(size 9932 X 7015) into my GUI. My code is as follows.
handles.f = figure('visible','off',...
'Units','Normalized','Position',[25 25 1300 725],...
'numbertitle','off','Name','Sample_GUI','Menubar','None');
set(handles.f,'toolbar','figure');
handles.TabGroup = uitabgroup('Parent',handles.f, 'Position', [ .01 .01 .98 .975 ]);
handles.Tabs(1) = uitab('Parent',handles.TabGroup, 'Title',' Preprocessing ');
handles.ax2 = axes('Units','Normalized','Position',[0.50,0.40,0.80,0.80],...
'Parent',handles.Tabs(1),'Box','off');
handles.pop1 = uicontrol('style','popupmenu',...
'units','Normalized',...
'position',[.08 .8 .08 .02],...
'string',{'B01','B03'},...
'Parent',handles.Tabs(1),...
'Callback',{@pop1_Callback,handles});
handles.pop1.Visible = 'on';
%call back function for popup menu
function [] = pop1_Callback(varargin)
P = get(handles.pop1,'Value');
disp(P);
if P == 1
matlabImage = imread('B01.tiff');
axis (handles.ax2)
imshow(matlabImage);
elseif P == 2
matlabImage = imread('B03.tif');
axis (handles.ax2)
imshow(matlabImage)
axis off
end
end
I'm able to import the TIFF image into GUI and display, However the resolution so poor that I can barely see the picture.
Can someone help me in fixing this problem.
Thanks in advance.

 採用された回答

Image Analyst
Image Analyst 2015 年 12 月 21 日

0 投票

With an image that large, to see single pixel things on your monitor that is only a fraction as wide as the image, you'll have to zoom in. Otherwise it will subsample to fit onto your display and you'll lose some fine details of the image.
See my attached code on creating a zoom/scroll panel. I got it from the Mathworks and modified it slightly.

6 件のコメント

Bharath
Bharath 2015 年 12 月 21 日
Hi Mr. Image Analyst. Thanks for your answer. The image size is just 187KB. I've the deault toolbar of the figure where we can use the zoom in and zoom out options. I tried using that zoom to see if the figure and found it to be of very poor resolution. Does it always happen with the large physical dimensions image? Isn't there something like resize option where the image size is scaled down in terms of ratio.?
Bharath
Bharath 2015 年 12 月 21 日
I tried to run your code and I get the following errors.
Warning: Image is too big to fit on screen; displaying at 6%
> In images.internal.initSize (line 71)
In imshow (line 309)
In zoom_image (line 28)
Undefined function or variable 'imscrollpanel'.
Error in zoom_image (line 29)
hSP = imscrollpanel(hFig,hIm); % Handle to scroll panel.
Bharath
Bharath 2015 年 12 月 21 日
I installed Image processing toolbox and now its working. However, just curious if there are any work arounds without the toolbox?
Image Analyst
Image Analyst 2015 年 12 月 21 日
That was "Introduced before R2006a" in the Image Processing Toolbox. What release do you have, and do you have the Image Processing Toolbox installed?
Bharath
Bharath 2015 年 12 月 22 日
I installed the toolbox and I've 2015b. However, just wanted to know does it work without toolbox? Becasue in the end, I wanted to create a executable program, will there be any issues then?
Image Analyst
Image Analyst 2015 年 12 月 22 日
What does this say:
>> which -all imscrollpanel
If you do not get this:
C:\Program Files\MATLAB\R2015b\toolbox\images\imuitools\imscrollpanel.p
C:\Program Files\MATLAB\R2015b\toolbox\images\imuitools\imscrollpanel.m % Shadowed
then contact the Mathworks because it's not installed correctly.
There will be no problem using the Image Processing Toolbox in a compiled standalone program. I do it all the time.

サインインしてコメントする。

その他の回答 (1 件)

harjeet singh
harjeet singh 2015 年 12 月 21 日

0 投票

why not to use after re sizing with ratio
matlabImage = imread('B03.tif');
[m n x]=size(matlabImage);
ratio=70;
A=imresize(matlabImage,[(m/100)*ratio (n/100)*ratio]);
figure(2)
imshow(A)

4 件のコメント

Bharath
Bharath 2015 年 12 月 21 日
Hi Mr Hajeet. I get this error, if follow your approach
Subscript indices must either be real positive integers or logicals.
Error in sample_gui/pop1_Callback (line 301)
A = imresize(matlabImage,[(m/100)*ratio(n/100)*ratio]);
Error while evaluating UIControl Callback
harjeet singh
harjeet singh 2015 年 12 月 21 日
try to use now
matlabImage = imread('B03.tif');
[m n x]=size(matlabImage);
ratio=70;
A=imresize(matlabImage,[fix((m/100)*ratio) fix((n/100)*ratio)]);
figure(2)
imshow(A)
Walter Roberson
Walter Roberson 2015 年 12 月 22 日
Bharath you missed a space in the code. harjeet coded
A=imresize(matlabImage,[(m/100)*ratio (n/100)*ratio]);
but you coded
A = imresize(matlabImage,[(m/100)*ratio(n/100)*ratio]);
missing the space between "ratio" and "(n/100)"
harjeet singh
harjeet singh 2015 年 12 月 22 日
oh yes, thanks @walter

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

質問済み:

2015 年 12 月 21 日

コメント済み:

2015 年 12 月 22 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by