I want to get the luminance value for a limited no of images[for example 100 images] and want to save those 5 values in a text file.I can get this value for one single image but cant for multiple images

1 Ansicht (letzte 30 Tage)
function fnc= characteriscits(str,name,st,en)
img=imread([str,'\',name,'_',num2str(1),'.bmp']);
fileID=fopen('feature_vector.txt','a');
for num_images=st:en
r=img(:,:,1);
g=img(:,:,2);
b=img(:,:,3);
luminance = 0.299*r + 0.587*g + 0.114*b;
fprintf(fileID,'%d\n',luminance);
end
fclose(fileID);
end
  1 Kommentar
Aniruddha Katre
Aniruddha Katre am 2 Sep. 2014
Can you please clarify the expected output for the code? Based on your question, it seems that you want to get a single luminance value for each image. But then you mention that you want to save "five" values in a text file. Do you expect a single value for luminance or multiple values?
Also, why are you unable to get luminance values for multiple images? Are you receiving any error messages when executing code that analyzes multiple images?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 2 Sep. 2014

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by