필터 지우기
필터 지우기

How do I make a function read all the images in a directory?

조회 수: 3 (최근 30일)
yen
yen 2011년 5월 16일
I have an images directory. What function can be used to read all of the images in that directory?
  댓글 수: 1
yen
yen 2011년 5월 17일
Thanks for yours answers.
How can I save all the images this image directory on a two-dimensional array as input to train neural networks?

댓글을 달려면 로그인하십시오.

답변 (3개)

Matt Fig
Matt Fig 2011년 5월 16일
I = dir('*.jpg'); % or jpeg or whatever.
for ii = 1:length(I)
C{ii} = imread(I(ii).name); % Store in a cell array.
end
Now the first image is stored as C{1}, the second as C{2}, etc...

Doug Hull
Doug Hull 2011년 5월 16일

Walter Roberson
Walter Roberson 2011년 5월 17일
Please read this FAQ
  댓글 수: 1
yen
yen 2011년 5월 17일
Thanks for your help.I have a directory consist 44 images code39 barcodes encode the characters 0 -> 9, A-> Z ,%,$, space ,+,-,. My images were taken on a binary image with 0 is black bar, 1 is the white bars, after I read all images in this directory, pleaase help me how to save all the images were read on a vector-specific for barcode image to input training artificial neural network
this is my code:
myFolder = 'Tapmau';
filePattern = fullfile(myFolder, '*.bmp');
bmpFiles = dir(filePattern);
for k = 1:length(bmpFiles)
baseFileName = bmpFiles(k).name;
fullFileName = fullfile(myFolder, baseFileName);
% fprintf(1, 'Now reading %s\n', fullFileName);
imageArray = imread(fullFileName);
% imshow(imageArray); % Display image.
% drawnow;
% Force display to update immediately.
end
for i=1:length(bmpFiles)
baseFileName=bmpFiles(i).name;
fullFileName = fullfile(myFolder, baseFileName);
image=reshape(imageArray,[],1)
end
targets=eye(44);
can you fix it for me
Hope your help. Thanks so much

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by