MY code: How to manage RGB value for differet shades of face,and how to apply? this code will change the color of face along with hair,but i want 1.only face to be colored excl
1) Get a CGPath of face where you want to apply your algorithm. 2) Get width of CGimage.
int width = CGImageGetWidth(image);
3) Get pixel CGPoint of currently processing pixel. Check for the condition before applying your algorithm. And then apply your condition. That's it. Here is the sample portion of code.
CGFloat pointY = (int)(i/4)/(int)width;
CGFloat pointX = (int)(i/4)%(int)width;
CGPoint point = CGPointMake(pointX, pointY);
if (CGPathContainsPoint(yourFacePath, NULL, point, NO))
{
if( ( (R>0)&&(R<260) ) || ((G>0)&&(G<210))||((B>0) && (B<170)))
{
rawData[ii+1]=R;//13;
rawData[ii+2]=G;//43;
rawData[ii+3]=value;//63
}
}