基本信息
源码名称:基于opencv的肤色检测
源码大小:4.08M
文件格式:.rar
开发语言:C/C++
更新时间:2016-03-27
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 3 元 
   源码介绍
基于opencv的肤色检测

void SkinRGB(IplImage* rgb,IplImage* _dst)
{
    assert(rgb->nChannels==3&& _dst->nChannels==3);

    static const int R=2;
    static const int G=1;
    static const int B=0;

    IplImage* dst=cvCreateImage(cvGetSize(_dst),8,3);
    cvZero(dst);

    for (int h=0; h<rgb->height; h )
    {
        unsigned char* prgb=(unsigned char*)rgb->imageData h*rgb->widthStep;
        unsigned char* pdst=(unsigned char*)dst->imageData h*dst->widthStep;
        for (int w=0; w<rgb->width; w )
        {
            if ((prgb[R]>95 && prgb[G]>40 && prgb[B]>20 &&
                    prgb[R]-prgb[B]>15 && prgb[R]-prgb[G]>15)||//uniform illumination
                    (prgb[R]>200 && prgb[G]>210 && prgb[B]>170 &&
                     abs(prgb[R]-prgb[B])<=15 && prgb[R]>prgb[B]&& prgb[G]>prgb[B])//lateral illumination
               )
            {
                memcpy(pdst,prgb,3);
            }
            prgb =3;
            pdst =3;
        }
    }
    cvCopyImage(dst,_dst);
    cvReleaseImage(&dst);
}