资源简介
基于简单高斯肤色模型进行肤色检测的代码,需要指定四个参数就可以准确检测出图片中的肤色区域,亲测可用。
代码片段和文件信息
function [skin1 skin2 optimalThreshold] = SegmentSkin(filename bmean rmean brcov)
% Assume the skinmodel.m is run
% Produce two images skinlikelihood greyscale image skin1
% and skin segment binary image skin2
im = imread(filename);
imycbcr = rgb2ycbcr(im);
dim = size(im);
skin1 = zeros(dim(1) dim(2));
for i = 1:dim(1)
for j = 1:dim(2)
cb = double(imycbcr(ij2));
cr = double(imycbcr(ij3));
x = [(cb-bmean); (cr-rmean)];
skin1(ij) = exp(-0.5* x‘*inv(brcov)* x);
end
end
lpf= 1/9*ones(3);
skin1 = f
评论
共有 条评论