先贴代码 void cvSkinSegment(IplImage* img, IplImage* mask){ CvSize imageSize = cvSize(img->width, img->height); IplImage *imgY = cvCreateImage(imageSize, IPL_DEPTH_8U, 1); IplImage *imgCr = cvCreateImage(imageSize, IPL_DEPTH_8U, 1); IplImage *imgCb = cvCreateImage(imageSize, IPL_DEPTH_8U, 1); IplImage *imgYCrCb = cvCreateImage(imageSize, img->depth, img->nChannels); cvCvtColor(img,imgYCrCb,CV_BGR2YCrCb); cvSplit(imgYCrCb, imgY, imgCr, imgCb, 0); int y, cr, cb, l, x1, y1, value; unsigned char *pY, *pCr, *pCb, *pMask; pY = (unsigned char *)imgY->imageData; pCr = (unsigned char *)imgCr->imageData; pCb = (unsigned char *)imgCb->imageData; pMask = (unsigned char *)mask->imageData; cvSetZero(mask); l = img->height * img->width; for (int i &#