有任何易于使用的服务器端肉搜索算法/工具吗?

发布于 2024-11-03 14:48:52 字数 107 浏览 0 评论 0原文

我们需要接受图片作为输入,然后在原始图像中的“肉体”部分上方操作/覆盖图像数据。

有没有人处理过简单的技术来促进这种过程?已阅读有关 OpenCV 的内容,但我希望有一条更简单的路径。

We have a need to accept pictures as input, and then manipulate/overlay image data above sections of "flesh" in the original image.

Has anyone dealt with easy technologies to facilitate this kind of process? Have read about OpenCV, but am hopeful that there's an easier path.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怕倦 2024-11-10 14:48:52

我认为最简单的路径是 opencv 来实现你想做的事情。

有一个关于“更简单”的东西的链接:
http://media.packetlife.net/media/blog/attachments/ 413/nbar_flesh_tone.html
(如果您有一台思科服务器,您希望优先考虑非肤色图像。)

此线程
裸体图像检测 - OPENCV
链接到:https://csel.cs.colorado.edu/~兴x /project/privacy.html
(无代码,研究视频‘裸体’检测。)

可以看看O'reilly Opencv的书。那里解释了肤色的 HSV 颜色空间示例。这本书解释得很好。 (如果您搜索的话,可以找到一些谷歌图书页面。)

您还可以查看 camshift opencv 示例。

这是 opencv 中问题空间的链接。 (如果您需要一些代码,或者阅读一些有关使用颜色空间 HSV 或 CIE Lab* 颜色空间的信息)
http://tech.groups.yahoo.com/group/OpenCV/message/ 45158

从 opencv 组复制的一些代码为“肤色”提供了掩码:

src_RGB = RGB-Image (IPL_DEPTH_8U , 3); // Source
mask_BW = GRAY-Image (IPL_DEPTH_8U , 3);// Resulting Mask same size as source !!
//after GetSkinMask you can use cvAnd between src_RGB and mask_BW.


void GetSkinMask(IplImage * src_RGB, IplImage * mask_BW, int
erosions=1, int dilations=7)
{   

CvSize size;

CvSize sz = cvSize( src_RGB->width & -2, src_RGB->height & -2);
//get the size of input_image (src_RGB)

IplImage* pyr = cvCreateImage( cvSize(sz.width/2, sz.height/2), 8,   3 ); //create 2 temp-images

IplImage* src = cvCreateImage(cvGetSize(src_RGB), IPL_DEPTH_8U ,3);
cvCopyImage(src_RGB, src);

IplImage* tmpYCR = cvCreateImage(cvGetSize(src), IPL_DEPTH_8U , 3);
cvPyrDown( src, pyr, 7 );
//remove noise from input
cvPyrUp( pyr, src, 7 );

cvCvtColor(src ,tmpYCR , CV_RGB2YCrCb);

uchar Y;
uchar Cr;
uchar Cb;

CvPixelPosition8u pos_src;
CvPixelPosition8u pos_dst;

int x =0;
int y =0;

CV_INIT_PIXEL_POS(pos_src,(unsigned char *) tmpYCR->imageData,
tmpYCR->widthStep,    cvGetSize(tmpYCR), x,y, tmpYCR->origin);

CV_INIT_PIXEL_POS(pos_dst,    (unsigned char *) mask_BW->imageData,
mask_BW->widthStep,    cvGetSize(mask_BW),   x,y, mask_BW->origin);

uchar * ptr_src;
uchar * ptr_dst;


for( y=0;y<src-> height; y++)
{

    for ( x=0; x<src->width; x++)
    {

        ptr_src = CV_MOVE_TO(pos_src,x,y,3);
        ptr_dst = CV_MOVE_TO(pos_dst,x,y,3);

        Y = ptr_src[0];
        Cb= ptr_src[1];
        Cr= ptr_src[2];

        if( Cr > 138 && Cr < 178 &&
        Cb + 0.6 * Cr >200 && Cb + 0.6 * Cr <215)
        {
            ptr_dst[0] = 255;
            ptr_dst[1] = 255;
            ptr_dst[2] = 255;
        }
        else
        {
            ptr_dst[0] = 0;
            ptr_dst[1] = 0;
            ptr_dst[2] = 0;
        }


    }
}

if(erosions>0) cvErode(mask_BW,mask_BW,0,erosions);
if (dilations>0) cvDilate(mask_BW,mask_BW,0,dilations);

cvReleaseImage(&pyr);
cvReleaseImage(&tmpYCR);
cvReleaseImage(&src);
}

I think the easiest path IS opencv for what you want to do.

There's a link about 'simpler' stuff:
http://media.packetlife.net/media/blog/attachments/413/nbar_flesh_tone.html
(If you got a Cisco server where you want to prioritize non-flesh colored images.)

This thread
Nude image detection - OPENCV
Links to : https://csel.cs.colorado.edu/~xingx/project/privacy.html
(No code, research on video 'nude' detection.)

You can look at O'reilly Opencv book. There's a hsv color space example for flesh color explained there. This book explains it well. (There are some google book pages available if you search.)

You can also look at the camshift opencv example.

This is a link to the problem space in opencv. (If you want some code, or read a bit about using the color space HSV or CIE Lab* color space)
http://tech.groups.yahoo.com/group/OpenCV/message/45158

Some code copied from that opencv group that gives a mask for the 'flesh color':

src_RGB = RGB-Image (IPL_DEPTH_8U , 3); // Source
mask_BW = GRAY-Image (IPL_DEPTH_8U , 3);// Resulting Mask same size as source !!
//after GetSkinMask you can use cvAnd between src_RGB and mask_BW.


void GetSkinMask(IplImage * src_RGB, IplImage * mask_BW, int
erosions=1, int dilations=7)
{   

CvSize size;

CvSize sz = cvSize( src_RGB->width & -2, src_RGB->height & -2);
//get the size of input_image (src_RGB)

IplImage* pyr = cvCreateImage( cvSize(sz.width/2, sz.height/2), 8,   3 ); //create 2 temp-images

IplImage* src = cvCreateImage(cvGetSize(src_RGB), IPL_DEPTH_8U ,3);
cvCopyImage(src_RGB, src);

IplImage* tmpYCR = cvCreateImage(cvGetSize(src), IPL_DEPTH_8U , 3);
cvPyrDown( src, pyr, 7 );
//remove noise from input
cvPyrUp( pyr, src, 7 );

cvCvtColor(src ,tmpYCR , CV_RGB2YCrCb);

uchar Y;
uchar Cr;
uchar Cb;

CvPixelPosition8u pos_src;
CvPixelPosition8u pos_dst;

int x =0;
int y =0;

CV_INIT_PIXEL_POS(pos_src,(unsigned char *) tmpYCR->imageData,
tmpYCR->widthStep,    cvGetSize(tmpYCR), x,y, tmpYCR->origin);

CV_INIT_PIXEL_POS(pos_dst,    (unsigned char *) mask_BW->imageData,
mask_BW->widthStep,    cvGetSize(mask_BW),   x,y, mask_BW->origin);

uchar * ptr_src;
uchar * ptr_dst;


for( y=0;y<src-> height; y++)
{

    for ( x=0; x<src->width; x++)
    {

        ptr_src = CV_MOVE_TO(pos_src,x,y,3);
        ptr_dst = CV_MOVE_TO(pos_dst,x,y,3);

        Y = ptr_src[0];
        Cb= ptr_src[1];
        Cr= ptr_src[2];

        if( Cr > 138 && Cr < 178 &&
        Cb + 0.6 * Cr >200 && Cb + 0.6 * Cr <215)
        {
            ptr_dst[0] = 255;
            ptr_dst[1] = 255;
            ptr_dst[2] = 255;
        }
        else
        {
            ptr_dst[0] = 0;
            ptr_dst[1] = 0;
            ptr_dst[2] = 0;
        }


    }
}

if(erosions>0) cvErode(mask_BW,mask_BW,0,erosions);
if (dilations>0) cvDilate(mask_BW,mask_BW,0,dilations);

cvReleaseImage(&pyr);
cvReleaseImage(&tmpYCR);
cvReleaseImage(&src);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文