i have 10 folders and in each folder i have 20 images...for a folder i need to extract histogram normalization values of images and i need to store them for further use...i have written code but im unable to get stored values...help me ..thanks

2 次查看(过去 30 天)
clear all;
close all;
Folder='G:\C\New folder (2)\(2)';
file1=fullfile(Folder,'*.png');
pngimages1=dir(file1);
numOfFiles=length(pngimages1);
for i=1:length(pngimages1)
FileName1=pngimages1(i).name;
fullFileName1=fullfile(Folder,FileName1);
im1=imread(fullFileName1);
im11=rgb2gray(im1);
im111=imhist(im11)./numel(im11);
im112=im111(i,:);
end
xlswrite('myFile.xlsx',im112);

采纳的回答

Jan
Jan 2017-7-25
Do you mean
im112(i,:) = im111;
instead of
im112=im111(i,:);
  7 个评论
Jan
Jan 2017-7-27
@Gohan: Okay. Then what exactly is your question? Creating a loop over the folders? Before I could suggest some code for this, you have to explain, how the set of folders is recognized. Perhaps all subfolders of a specific base folder?
FolderList = dir(BaseFolder);
FolderList = FolderList([FolderList.isdir]);
FolderName = fullfile(BaseFolder, {FolderList.name});
Then run a loop over the folders.
Please explain "but im unable to get stored values" with any details. It is much easier to fix a problem than to guess what the problem is.
Image Analyst
Image Analyst 2017-7-27
I don't even know what "histogram normalization values" are. Please explain in detail. The histogram() function can return 'pdf' and 'probability' versions of the histogram, if that's what you want - see its options.

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

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

Start Hunting!

Translated by