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

댓글을 달려면 로그인하십시오.

 채택된 답변

dpb
dpb 2016년 11월 26일
편집: dpb 2016년 11월 27일
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개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

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