Example #1
0
        public static Image <Gray, Byte> HistSkinDetect(BGRTree skinTree, Image <Bgr, Byte> inputImg, double minThresh)
        {
            Image <Gray, Byte> resultImg = new Image <Gray, Byte>(inputImg.Size);

            int height = resultImg.Height;
            int width  = resultImg.Width;

            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    Bgr bgrPix = inputImg[i, j];

                    //int freqSkin = skinTree.GetFreq(bgrPix);

                    //if (freqSkin > 0)
                    //{
                    //    int freqNSkin = nSkinTree.GetFreq(bgrPix);
                    //    if (freqSkin >= freqNSkin)
                    //        resultImg.Data[i, j, 0] = 255;
                    //}

                    double probSkin = skinTree.GetProb(bgrPix);

                    if (probSkin >= minThresh)
                    {
                        resultImg.Data[i, j, 0] = 255;
                    }
                }
            }

            return(resultImg);
        }