MATLAB Answers

How to combine different histograms ?

95 views (last 30 days)
Jenny
Jenny on 25 Jan 2013
Commented: Image Analyst on 8 Jan 2016
I have several different histograms and I want to take as a result a final histogram. I am looking for a way to combine the different histograms and manage to make it one.

  1 Comment

jasche
jasche on 25 Jan 2013
how do you want to combine these images ? on what context ?

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 Jan 2013
As long as the bins cover the same ranges, you can simply add them. If they don't, then you'll have to align the ranges some how, which might mean taking the histograms again with histc and making sure all the bins are in the same places.

  6 Comments

Show 3 older comments
sweta arya
sweta arya on 8 Jan 2016
i=imread('138.jpg'); i=rgb2gray(i); size(i) binranges = 0:255; [bincounts] = histc(x,binranges); figure bar(binranges,bincounts,'histc') giving error in this code, Error using barV6 (line 13) Inputs must be 2-D.
Error in bar (line 47) h = barV6(cax, args{:});
sweta arya
sweta arya on 8 Jan 2016
i=imread('138.jpg');
i=rgb2gray(i);
size(i)
binranges = 0:255;
[bincounts] = histc(x,binranges);
figure
bar(binranges,bincounts,'histc')
giving error in this code,
Error using barV6 (line 13)
Inputs must be 2-D.
Error in bar (line 47)
h = barV6(cax, args{:});
Hello, what is the code for addition of different histograms
Image Analyst
Image Analyst on 8 Jan 2016
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
bar(grayLevels, pixelCount); % Plot it as a bar chart.
grid on;
title('Histogram of gray scale version of image', 'FontSize', fontSize, 'Interpreter', 'None');
xlabel('Gray Level', 'FontSize', fontSize);
ylabel('Pixel Count', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.

Sign in to comment.

More Answers (0)

Sign in to answer this question.