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 comentarios

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

Iniciar sesión para comentar.

 Respuesta aceptada

dpb
dpb el 26 de Nov. de 2016
Editada: dpb el 27 de Nov. de 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 comentario

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 26 de Nov. de 2016

Editada:

dpb
el 27 de Nov. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by