function [mu,sigma,alpha] = activepixels(I,k)
%ACTIVEPIXELS Calculates the mean, standard deviation and active pixels of a postal image block.
%   [MU,SIGMA,ALPHA] = ACTIVEPIXELS(I,k) calculates the mean, standard deviation, 
%   and count of active pixels to enable classification of I.  
%
%   ALPHA is the count of pixels with intensity < MU-k*SIGMA.  
%
%   I is the matrix of pixel values of a grayscale image block.  
%
%   See also FEATURES

%   Author(s): K. R. Varshney
%   School of Electrical and Computer Engineering, Cornell University
%   $Date: 2002/08/15 $

sizeI = size(I);

%make vector of pixel values
vI = double(reshape(I,sizeI(1)*sizeI(2),1));

%calculate mean
mu = mean(vI);

%calculate standard deviation
sigma = std(vI);

%calculate active pixels
alpha = sum(vI<(mu-k*sigma));