how can I display one of the images instead of displaying all? can anybody help me please

조회 수: 1 (최근 30일)
i am trying to read images from a folder and display one of them.
image_folder= 'C:\Octave\Octave-4.2.1\share\octave\packages\images' filename=dir(fullfile(image_folder,'*.jpg')); total_images=numel(filename);
for n=1:total_images f=fullfile(image_folder,filename(n).name); our_images=imread(f)
figure(n)
imshow(our_images)
end

채택된 답변

YT
YT 2018년 10월 28일
Well you've created a for-loop, so it shows all of the images in those figures. If you only want to display 1 specific image, you should just get rid of the loop and specify wich image you want to display.
image_folder= 'C:\Octave\Octave-4.2.1\share\octave\packages\images'
filename=dir(fullfile(image_folder,'*.jpg'));
n = 20; % from `filename`
f=fullfile(image_folder,filename(n).name);
my_image=imread(f);
figure();
imshow(our_images)
  댓글 수: 2
john khnayzir
john khnayzir 2018년 10월 28일
thank you very much and if i want to transform this image to 8*8 sub-blocks how can i do that?
YT
YT 2018년 10월 30일
This is another type of question, you should probably create a new post for this.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2018년 10월 30일

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by