필터 지우기
필터 지우기

how can i use imdisp to display images from the folder?

조회 수: 2 (최근 30일)
hp
hp 2017년 6월 29일
편집: Walter Roberson 2017년 7월 3일
I have code which saves matched images into a folder... how can retrieve images from the folder and display multiple or all images of folder using "imdisp" ...
[MATLAB 7]

답변 (1개)

Walter Roberson
Walter Roberson 2017년 6월 29일
편집: Walter Roberson 2017년 6월 29일
imdisp is a File Exchange contribution which has been replaced by SC
Be careful if your images are named something img_9.bmp img_10.bmp and so on instead of img_09.bmp img_10.bmp (with fixed number of digits). If you use variable number of digits you will probably want to use https://www.mathworks.com/examples/matlab/community/19425-natsortfiles-examples
  댓글 수: 4
hp
hp 2017년 7월 3일
편집: Walter Roberson 2017년 7월 3일
sorry some lines were missing in the above code:
dir_in = 'C:\Program Files\hemaMATLAB\R2007b\work\capinput\';
dir_out = 'C:\Program Files\hemaMATLAB\R2007b\work\output\';
file_ext = 'jpg';
listing = dir(strcat(dir_in,'i*.',file_ext));
numfile = length(listing);
>> image_stack = [];
>> for k = 1 : numfile
thisfile = listing(k).name;
thisimage = imread(thisfile);
image_stack(1:size(thisimage,1), 1:size(thisimage,2), :, k) = thisimage;
end
??? Error using ==> imread at 315
File "i1.jpg" does not exist.
Guillaume
Guillaume 2017년 7월 3일
Don't use strcat use fullfile instead.
Don't use length use numel instead.
Your error is because you haven't specified the full path of the file in your imread call.
thisimage = imread(fullfile(dir_in, thisfile));

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

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by