Reading image files-batch

조회 수: 1 (최근 30일)
as hz
as hz 2012년 9월 23일
Hi,
I am trying to read image files from a folder (not Matlab working folder) but it does not work
Code: files = dir('C:\Users\ell\Desktop\segon\seg_array\Tv*.png') rgbl = imread('C:\Users\ell\Desktop\segn\seg_array\', files(1).name);
Can someone please tell me what is the problem.
Thanks

채택된 답변

Image Analyst
Image Analyst 2012년 9월 23일
Please see the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F for several ways. They'll have lines like this
folder = ''C:\Users\ell\Desktop\segon\seg_array';
filePattern = fullfile(folder, 'Tv*.png');
fileNames = dir(filePattern);
In the loop:
fullFileName = fullfile(folder, fileNames(k).name);
rgbImage = imread(fullFileName);

추가 답변 (1개)

Rodrigo
Rodrigo 2012년 9월 23일
second line should read: imread(strcat('C:\Users\ell\Desktop\segn\seg_array\', files(1).name));

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by