How can I create a .mat file in which I store the colour images and the corresponding histograms?

1 view (last 30 days)
I want to create the .mat file in which I need to store the Colour images and corresponding each colour image I need to store 4 histograms in row form. Can any one help me with code how to store color image and corresponding histogram in row form?

Accepted Answer

Image Analyst
Image Analyst on 5 Mar 2014
Make a 2D array of 1024 column by 50 rows
output = zeros(totalNumberOfImages, 1024); % Initialize
for imageNumber = 1 : totalNumberOfImages
% Compute the 4 histograms...
% Now save them
output(imageNumber, :) = [count1, count2, count3, count4];
end
do for all images, then save output (or whatever you want to call it) to a mat file
save(matFullFileName, 'output');
  57 Comments
Image Analyst
Image Analyst on 11 Mar 2014
In out(i,:)=[1 2 3 4]; the right hand side needs to be 1024 elements long, not 4. If you have 4 histograms of 256 elements each, then it will be 1024 elements long.
radha
radha on 11 Mar 2014
Exactly I had not changed that 1024 that is why I was getting error. Because my histograms has only 59 values. So not getting done my .matfile.
Now it's working fine.
Sir I am bit late to share my happiness because I was running my entire project.
It is good news for me that I have completed my project. I am very happy.
I don't know how much to say thanks to you. Without your help of my project would not be completed within deadline.
Sorry I disturbed you lot....
But Thanks a Lottttttttttt Image Analyst!!!!!!!!!!!!!!
Now I am developing GUI.
Thanks again....
You played very important role for my project. I never forget your help. Because only this .matfile work was left and you helped me to do that.
Again Thanks a Loootttt!!!!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!