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 个评论

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....

请先登录,再进行评论。

 采纳的回答

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 个评论

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

请先登录,再进行评论。

更多回答(0 个)

类别

标签

Community Treasure Hunt

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

Start Hunting!

Translated by