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 view (last 30 days)
Show older comments
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 Comment
Aniruddha Katre
on 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?
Answers (1)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!