problem whit read pictures in matlab

Status
Not open for further replies.

b3hrad

Newbie level 2
Joined
Apr 23, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
hi
some one kindly guide me regardint read pictures in matlab
i have 10 pictures and i want to read pictures but matlab give an error that

??? Error using ==> imread at 363
File "1" does not exist.

Error in ==> PCA at 5
database,:,i)=imread(tmp,'.tif');

i copy all images in matlab directory in c:\my document\MATLAB

my question is that ... where shoud i put images ? in matlab directory or other directory
if other dircetory , i shoud write the address of directory ?



why matlab cant read images from MATLAB directory
??? Error using ==> imread at 363
File "1" does not exist.


this is my code :
clear all

for i=1:10
tmp=int2str(i);
database,:,i)=imread(tmp,'.tif');
end

this is picture show errors ===>
 

hi

supose that , you have a1.jpg ... a10.jpg

for i=1:10
name=['a' num2str(i) '.jpg'];
I=imread(name);
end

 

    b3hrad

    Points: 2
    Helpful Answer Positive Rating
The problem, you are facing with, is that MatLab reads files from Current Directory (top toolbar C:\Documents and Settings\b3hrad\....), unless other specified.
 

Here is a simple code to load your images:
Code:
dir_name='C:\MAT\proj1\datafiles';
for n=1:N
    file_name=sprintf('%s/%d.jpg',dir_name,n);
    I=imread(file_name); 
    ...
end
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…