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
The quick answer is to change your ORs:
if( ( (R>0)&&(R<260) ) || ((G>0)&&(G<210)) || ((B>0) && (B<170)))
to ANDs:
if( ( (R>0)&&(R<260) ) && ((G>0)&&(G<210)) && ((B>0) && (B<170)))
Then adjust your RGB ranges to approximate the range of skin tones in the image (try with some sliders in your UI).
By the way, I presume you know that this:
rawData[ii+1]=R;//13;
rawData[ii+2]=G;//43;
rawData[ii+3]=value;//63
is assigning the red channel to the green channel, the green channel to the blue channel, and value to the ALPHA channel. I don't expect that is what you want.
Also your needToModified image is probably intended to be the same image as firstImageV.image, which is not reflected in your code as it is now.
This approach will only work if your identified colour ranges are wholly and only present in flesh regions of the image.
A long answer could look at more sophisticated selection of colour ranges, alternative ways of selecting image regions, the use of CIFilter or the openCV framework...