I want to obtain RGB histogram from mutiple image.Find the mean histogram for each of the 3 channel,Red, Green and Blue and store in 3 different histogram.I have created some code but it only work on ONE image..How do I proceed from this?

2 views (last 30 days)
clc; clear all; a = imread('01_test.tif'); h = fspecial('average', 6); a = imfilter(a, h); imtool(a);
% breakpoint
r = cropped(:,:,1); g = cropped(:,:,2); b = cropped(:,:,3);
[counts1, ~] = imhist(r); [counts2, ~] = imhist(g); [counts3, ~] = imhist(b);
save('templateData', 'counts1', 'counts2', 'counts3')
  1 Comment
hawkar kheder
hawkar kheder on 23 Mar 2018
Edited: hawkar kheder on 23 Mar 2018
Change your code as follows:
counts1 = imhist(r);
counts2 = imhist(g);
counts3 = imhist(b);
save('templateData', 'counts1', 'counts2', 'counts3')

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 23 Mar 2018
My attached demo plots RGB histograms for all images in a folder. Adapt as needed.

Community Treasure Hunt

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

Start Hunting!