I have some skin images. Some image contains hair. I need to remove them. What algorithm will be suitable for removing hairs from skin. You can have a look to one image i have attached.
I prefer to use Matlab for implementation of the system.
You can binarize the image using otsu(blockwise or whole image) and then use the resulting image as a mask for median filtering.. This is the simplest method i can see at first glance
Thank you Joachim, Raj and Onuk for your quick reply.
I have tried Mr. Raj's mentioned approach. I have make the image binary then apply structuring element (line, different degree) with morphological opening. But the approach also blurr some detail from ROI portion of my image.
The problem is that I need the hair removed COLOR IMAGE for next processing. In next step, I will have to do color based segmentation/clustering to find ROI.
1. Find the hair region using adaptive local thresholding - Otsu's method or any other method. I think "local thresholding" or even "local histogram equalization and then global thresholding" will find the hair regions.
2. To fill the hair regions, use "texture synthesis" to synthesize skin like texture for the hair region.
One good and easy method for texture synthesis is described in "A.A. Efros and T.K. Leung, Texture synthesis by non-parametric sampling', In Proceedings of the International Conference on Computer Vision (ICCV), Kerkyra, Greece, 1999".
Texture synthesis will give a better result than averaging or median filtering to estimate the pixels in the hair region.
In your case the hair has a high contrast to the skin - given that that is the case in all your images I suggest the following approach:
Use a threshold and create a Black and White binary image. The hairs should be black in this image. Convert this image to the complement (i.e. the hairs are now white and the skin black. Dilate this image with a 1 pixel SE. Convert to the complement image again (hairs are now dark again - but a bit thicker because of the dilation. Multiply this image with the original image. Now all hairs are totally black. The next step is to use in painting, to fill the black hair space in the image.
In your case the hair has a high contrast to the skin - given that that is the case in all your images I suggest the following approach:
Use a threshold and create a Black and White binary image. The hairs should be black in this image. Convert this image to the complement (i.e. the hairs are now white and the skin black. Dilate this image with a 1 pixel SE. Convert to the complement image again (hairs are now dark again - but a bit thicker because of the dilation. Multiply this image with the original image. Now all hairs are totally black. The next step is to use in painting, to fill the black hair space in the image. In-painting assumes that it is proper to fill a void in your image with image information from neighboring pixels. I have done so for the image you posted, and the result is as you see in the attached image. Essentially you can now study the skin color and texture within being bothered by the hair structures. Playing around with the exact threshold for Black and White binary image formation can improve this result further.
I can suggest to use HSV color space convertion and make the necessary modifications (otsu or other methods that the friends mentioned above) on the H component (search for certain color radiant). Than restore RGB image. I thought that will clears your problem of bluring.
A very simple approach might try to exploit the processing in a single pass using median fiter on a circular domain around the generic pixel of the image.
Steps:
1 use graylevel image
2. for each pixel in the iomage select pixels in a circular domain or radius R
3. choose the median value (sorting the luminance value and selecting the level in the middle, tracking indexes on the image where such value is placed
4. substitute the central pixel in the circular domain with the color at the coordinates of the median extracted.
Using the Clone Stamp tool to remove these hair is a prime selection for Adobe Photoshop. Simply sample the area that is clean and drag on areas where extra hair is present and remove these hair. But if you've used this tool before, you know that it has some disadvantages.
The main strength of this tool, meanwhile, is its main weakness: the tool copies exactly what you sample to pixels in pixels. This can be a problem with texture or texture backgrounds, color differences or shine. However, using the Clone Stamp tool is a fantastic way if the background of your photo is completely one-color in terms of color and light.