Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
??? Error using ==> imread at 363

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 02:12:07

Message: 1 of 14

can help me

>> [namafile,direktori]=uigetfile({'*.jpg';'*.bmp';'*.png';'*.tif'},...
    ' Buka Gambar')

namafile =

Water lilies.jpg


direktori =

C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\

>> I=imread(namafile)
??? Error using ==> imread at 363
File "Water lilies.jpg" does not exist.
 

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 02:30:31

Message: 2 of 14

You forgot to use fullfile()

fullFileName = fullfile(direktori, namafile);
originalImage = imread(fullFileName);

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 02:33:10

Message: 3 of 14

You also forgot to use exist()

fullFileName = fullfile(direktori, namafile);
if exist(fullFileName, 'file')
    originalImage = imread(fullFileName);
    imshow(originalImage);
else
    errorMessage = sprintf('Error: file %s not found', fullFileName);
    fprintf(1, '%s\n', errorMessage );
    uiwait(msgbox(errorMessage));
end

Subject: ??? Error using ==> imread at 363

From: Steve Sachay

Date: 21 Mar, 2011 02:36:05

Message: 4 of 14

"wahyoe Unggul" <wahyoe_slipnot@yahoo.co.id> wrote in message <im6c5n$k98$1@fred.mathworks.com>...
> can help me
>
> >> [namafile,direktori]=uigetfile({'*.jpg';'*.bmp';'*.png';'*.tif'},...
> ' Buka Gambar')
>
> namafile =
>
> Water lilies.jpg
>
>
> direktori =
>
> C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\
>
> >> I=imread(namafile)
> ??? Error using ==> imread at 363
> File "Water lilies.jpg" does not exist.
>

Your image is not in the same directory as matlab, so when imread is looking for the file, it does not find it. Either change directory, move the image file to your current directory, or give imread the full path information (what you have in direktori).

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 03:28:04

Message: 5 of 14

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handle=guidata(gcbo)
[namafile,direktori]=uigetfile({'*.jpg';'*.bmp';'*.png';'*.tif'},...
    ' Buka Gambar')
fullFileName = fullfile(direktori, namafile);
originalImage = imread(fullFileName)
set(handle.fighistogram,'CurrentAxes',handle.axes1);
set(imshow(originalImage))
info=iminfo(namafile)
set(wahyoe.enama,'String',info.Filename)
set(wahyoe.eukuran,'String',info.FileSize)
set(wahyoe.eformat,'String',info.Format)
set(wahyoe.elebar,'String',info.Width)
set(wahyoe.etinggi,'String',info.height)
set(wahyoe.ebit,'String',info.BitDepth)
set(wahyoe.ewarna,'String',info.ColorType)
set(wahyoe.etanggal,'String',info.FileModDate)

set(wahyoe.fighistogram,'Userdata',originalImage)
set(wahyoe.ebit,'Userdata',info.BitDepth)

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 03:32:51

Message: 6 of 14

Uh, okay. But what do you think this does:
set(imshow(originalImage)) ???

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 03:58:04

Message: 7 of 14

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <043e2f71-746d-4168-9a7e-8072c466dd13@j13g2000yqj.googlegroups.com>...
> Uh, okay. But what do you think this does:
> set(imshow(originalImage)) ???

I want to display the image in a axes
I tried to create histograms in the GUI application

function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

function pushbutton1_Callback(hObject, eventdata, handles)
proyek=guidata(gcbo)
[namafile,direktori]=uigetfile({'*.jpg';'*.bmp';'*.png';'*.tif'},...
    ' Buka Gambar')
fullFileName = fullfile(direktori, namafile);
originalImage = imread(fullFileName)
set(proyek.fighistogram,'currentaxes',proyek.axes1);
set(imshow(originalImage))
info=iminfo(namafile)
set(proyek.enama,'String',info.Filename)
set(proyek.eukuran,'String',info.FileSize)
set(proyek.eformat,'String',info.Format)
set(proyek.elebar,'String',info.Width)
set(proyek.etinggi,'String',info.height)
set(proyek.ebit,'String',info.BitDepth)
set(proyek.ewarna,'String',info.ColorType)
set(proyek.etanggal,'String',info.FileModDate)

set(proyek.fighistogram,'Userdata',originalImage)
set(proyek.ebit,'Userdata',info.BitDepth)

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 10:26:51

Message: 8 of 14

Same response as before: "Uh, okay. But what do you think this does:
set(imshow(originalImage)) ???"

I don't think that set() does anything because you didn't specify a
property to set.

And are your last two posts supposed to be a question or what?

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 12:16:04

Message: 9 of 14

excuse me ImageAnalyst
I just learn GUI matlab, I tried one example of making GUI applications using Matlab, it was rather quite difficult to understand.
Can advise me, how to learn techniques Matlab GUI, how the ways manufacturing applications using matlab.
received previously, because it has helped me a lot.
Wahyoe

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 13:25:40

Message: 10 of 14

I'd recommend you use MAGIC. It's a nice framework to get you going
quickly. It has almost everything you need - you just need to replace
the boilerplate/template/demo code in the various callbacks with your
own code. But it handles displaying images, batch processing, reading
parameters such as radio buttons, saving results to Excel, etc.

http://www.mathworks.com/matlabcentral/fileexchange/24224

Description

This GUI will help the novice user get up to speed very quickly on
using GUI-based applications. Everything is laid out in a very simple
Step 1, Step 2, Step 3, etc. layout. It is a very good starting point
for a typical image analysis application. This application uses GUIDE
to do the user interface design, and has most of the basic controls
such as buttons, listboxes, checkboxes, radio buttons, scrollbars,
etc. It allows the user to select a folder of images, select one or
more images and display them, to select a series of options, and to
individually or batch process one or more images. The user can
optionally apply a mask (region of interest) to the image so that only
the area within the mask will be analyzed. The results are optionally
sent to Excel. In this demo, I do some very basic particle sizing but
in use, the user would replace that simple demo code in the function
AnalyzeSingleImage() with their own code. Works with Windows or Unix
since paths are all forward slashes. Requires the Image Processing
Toolbox to do the simple particle sizing demo, but if you delete that
demo code before using it, then the IP toolbox would not be required
and it would still demonstrate the basic GUI-based file processing
functionality.

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 13:37:07

Message: 11 of 14

ImageAnalyst
Thank you very much
you really helped me a lot

Subject: ??? Error using ==> imread at 363

From: Steven_Lord

Date: 21 Mar, 2011 13:59:01

Message: 12 of 14



"ImageAnalyst" <imageanalyst@mailinator.com> wrote in message
news:ce19abd3-f793-4965-9904-91758a9ed942@dn9g2000vbb.googlegroups.com...
> Same response as before: "Uh, okay. But what do you think this does:
> set(imshow(originalImage)) ???"
>
> I don't think that set() does anything because you didn't specify a
> property to set.

No, but it probably doesn't do what the OP expected (assuming the OP has an
expectation as to what this will do.)

http://www.mathworks.com/help/techdoc/ref/set.html

"a = set(h) returns the user-settable properties and possible values for the
object identified by h. a is a structure array whose field names are the
object's property names and whose field values are the possible values of
the corresponding properties. If you do not specify an output argument, the
MATLAB software displays the information on the screen. h must be scalar."

Since IMSHOW returns an image handle, that command will display that image's
settable properties.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: ??? Error using ==> imread at 363

From: wahyoe Unggul

Date: 21 Mar, 2011 14:23:04

Message: 13 of 14

hi Steven_Lord
I've tried the tutorial below
http://blogs.mathworks.com/videos/2007/10/16/matlab-basics-setting-a-background-image-for-a-gui/

??? Undefined variable "sunset" or class "sunset.tif".

Error in ==> untitled>axes1_CreateFcn at 84
imshow(sunset.tif)
Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> untitled at 42
    gui_mainfcn(gui_State, varargin{:});

Error in ==>
@(hObject,eventdata)untitled('axes1_CreateFcn',hObject,eventdata,guidata(hObject))

??? Error using ==> struct2handle
Error while evaluating axes CreateFcn

whether the cause?

Subject: ??? Error using ==> imread at 363

From: ImageAnalyst

Date: 21 Mar, 2011 14:42:14

Message: 14 of 14

Try putting it in quotes:

imshow('sunset.tif') ;

See if that fixes it. If not, then you need to prepend the folder
with the fullfile() function.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us