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 views (last 30 days)
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);

Accepted Answer

Jan
Jan on 25 Jul 2017
Do you mean
im112(i,:) = im111;
instead of
im112=im111(i,:);
  7 Comments
Jan
Jan on 27 Jul 2017
@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 on 27 Jul 2017
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!