function [map, stat] = locate_CFA(image, Bayer, Nb, Ns)
if (nargin ~= 4)
    error('Insert image, 2x2 CFA pattern on grenn channel, Nb and Ns');
end
Nm = 5; 
im = image(:,:,2);
[h, w] = size(im);
dim = [h, w];
pred_error = prediction(im);
var_map = map_var(pred_error, Bayer, dim);
stat = feature_extraction(var_map, Bayer, Nb);
[mu, sigma] = est_MOGE(stat);
loglikelihood_map = loglikelihood(stat, mu, sigma);
map = mapping(loglikelihood_map, Ns, Nm);
return