Effacer les filtres
Effacer les filtres

OVERLAY OF HISTOGRAMS error in variables

1 vue (au cours des 30 derniers jours)
sofia cirne
sofia cirne le 20 Juin 2017
Commenté : aditya sahu le 4 Oct 2017
im trying to overlay to histograms in one graph, but i have this error taht i cant understand.
x = handles.grey;
y = handles.binaria
nbins = 50;
bound = 1;
bins = linspace(-bound,bound,nbins);
% %b = histeq(X);
% first histogram
y1 = hist(x, bins);
% second histogram
y2 = hist(y, bins);
% overlay histograms
bar(y1.');
hold on;
bar(y2.','r');
the error given is
Error using hist (line 48)
Input arguments must be numeric.
Error in untitled>histograma_Callback (line 112)
y2 = hist(y, bins);
y is a black and white image, binary, it was converted to double, however it doesnt work. thank you!

Réponses (1)

Image Analyst
Image Analyst le 20 Juin 2017
Modifié(e) : Image Analyst le 20 Juin 2017
What does this say
whos y
Also, maybe you can try imhist(), histogram(), or histcounts().
Anyway, it makes no sense to have 50 bins, or actually bin edges which is what you're passing in, for a binary image. You will have no counts except in the bins for 0 and 1.
  3 commentaires
Image Analyst
Image Analyst le 20 Juin 2017
Are you going to answer my question about "whos y", or not?
And, like I said, use imhist() and the problem should go away.
counts = imhist(y);
bar(counts, 'BarWidth', 1)
aditya sahu
aditya sahu le 4 Oct 2017
are you trying for pdh analysis

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by