Azzera filtri
Azzera filtri

OVERLAY OF HISTOGRAMS error in variables

1 visualizzazione (ultimi 30 giorni)
sofia cirne
sofia cirne il 20 Giu 2017
Commentato: aditya sahu il 4 Ott 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!

Risposte (1)

Image Analyst
Image Analyst il 20 Giu 2017
Modificato: Image Analyst il 20 Giu 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 Commenti
Image Analyst
Image Analyst il 20 Giu 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 il 4 Ott 2017
are you trying for pdh analysis

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by