function Hu0 = mComputeEntropy( image ); image_real_min = min(min( real( image ) ) ); image_real_max = max(max( real( image ) ) ); image_imag_min = min(min( imag( image ) ) ); image_imag_max = max(max( imag( image ) ) ); zero_bin = zeros( image_real_max-image_real_min+1, image_imag_max-image_imag_min+1 ); [ row_total, col_total ] = size( image ); image_size = row_total*col_total; bin = zero_bin; image_real_offset = image_real_min-1; image_imag_offset = image_imag_min-1; for row = 1:row_total for col = 1:col_total bin_real_index = real( image( row, col ) ) - image_real_offset; % zero index not allowed bin_imag_index = imag( image( row, col ) ) - image_imag_offset; % zero index not allowed bin( bin_real_index, bin_imag_index ) = bin( bin_real_index, bin_imag_index ) + 1; end end bin = reshape( bin, 1, prod(size(bin)) ); % Normalize to find pdf PDF = bin/sum(bin); % x*log(x) = log(x^x) PlogP = log(PDF.^PDF)./log(2); Hu0 = -sum( PlogP );