I want to read images from a gallery contain 20 color images and then convert these to gray scale images and finding histogram for each,how can I do it? making index for every image!!!
1 回表示 (過去 30 日間)
古いコメントを表示
clc
for i=1:20
g(i)=imread(D:\Master\Research\Practical-Matlab\1\m.jpg');%gallery images
f(i)=rgb2gray(g(i));
end
0 件のコメント
回答 (1 件)
Joseph Cheng
2015 年 11 月 16 日
you'll have to do something like this:
yourgalleryfolder = 'D:\Master\Research\Practical-Matlab\1\';
imagefiles = dir(fullfile(yourgalleryfolder,'*.jpg'));
Images = struct('data',[],'histogram',[]);
for ind = 1:numell(imagefiles)
Images(ind).data = imread(fullfile(yourgalleryfolder,imagefiles(ind).name));
Images(ind).histogram = hist(Images(ind).data);
end
2 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!