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 件のコメント

Walter Roberson
Walter Roberson 2016 年 11 月 26 日
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
dpb
dpb 2016 年 11 月 26 日
Musta' not gotten saved, Walter--no Answer when I looked first; I sort on "Unanswered" rather than look at other stuff....

サインインしてコメントする。

 採用された回答

dpb
dpb 2016 年 11 月 26 日
編集済み: dpb 2016 年 11 月 27 日

1 投票

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 件のコメント

Image Analyst
Image Analyst 2016 年 11 月 26 日
For 2D images, you can use mean2() and std2(), both in the Image Processing Toolbox.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2016 年 11 月 26 日

編集済み:

dpb
2016 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by