variable section value give me some mean value but std is zero

bro i have the same coding in which the db variable section value give me some mean value but std is zero.and also during detection its detect same class (class 1) for all images.please any solution
function [F]=FeatureStatistical(im)
im = double(im(:));
m=mean(mean(im));
s=std(std(im));
F=[m s];

2 Kommentare

That's odd, I was sure that I had answered this Question, but nothing shows up. Ah well, my answer was the same as dpb's
Musta' not gotten saved, Walter--no Answer when I looked first; I sort on "Unanswered" rather than look at other stuff....

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

dpb
dpb am 26 Nov. 2016
Bearbeitet: dpb am 27 Nov. 2016
You've double-compensated for the 2D image in
im = double(im(:));
m=mean(mean(im));
s=std(std(im));
im is now a vector; so mean(im) --> single value. mean(value)-->value so the problem doesn't show up here but similarly s=std(std(im)); is taking the std deviation of a single value whose deviation is, in fact, zero.
Rewrite the function as
im = double(im(:));
m=mean(im);
s=std(im);
and all will be well...and just as a minor point since there's no further use in the function for the two temporaries, I'd write it as
F=[mean(im) std(im)];
eliminating them entirely.

1 Kommentar

For 2D images, you can use mean2() and std2(), both in the Image Processing Toolbox.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Gefragt:

am 26 Nov. 2016

Bearbeitet:

dpb
am 27 Nov. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by