function N_features=cp_laws(x,FeatureFN,NonlinId,SmoothId,NormId,Decimation)
% CP_LAWS  Comparative texture measure study: Laws features
%	N_features=cp_laws(x,FeatureFN,NonlinId,SmoothId,NormId,Decimation)

FilterIds=['L5';'E5';'S5';'W5';'R5'];
N_f=size(FilterIds,1);
N_features=0;

for fid_v=1:N_f
  for fid_h=1:N_f
    N_features=N_features+1;
    fprintf(1,'.');
    [y,h_v,h_h]=laws(x,[FilterIds(fid_v,:) FilterIds(fid_h,:)]); % Filtering

    % Determine the center frequencies
    H_v=abs(fft(h_v));
    H_h=abs(fft(h_h));
    f_0_v=mean(0.5*(0:2)/2 .* H_v(1:3)'/mean(H_v(1:3)));
    f_0_h=mean(0.5*(0:2)/2 .* H_h(1:3) /mean(H_h(1:3)));
    f_0=min(f_0_v,f_0_h);
    
    % Local energy function
    v=cp_energy(y,NonlinId,SmoothId,NormId,f_0);
    
    % Write feature file
    catframe(v,FeatureFN,[],'Interm',Decimation);
  end
end

