**4.2 Hair detection**

To detect hair pixels, a morphological "bottom-hat" operation is implemented on Y-channel image, returning the image minus the morphological closing of the image (dilation followed by erosion) to highlight dark hair on a light background as shown in **Figure 5**. Because the image closing expands the white areas in an

**Figure 2.** *A digital dermoscopic image presented in RGB (a-d) and YIQ (e-h) color spaces.*

*An Efficient Block-Based Algorithm for Hair Removal in Dermoscopic Images DOI: http://dx.doi.org/10.5772/intechopen.80024*

image but does not significantly alter those areas which are already white, the only areas left after subtracting the original are those that were originally black but surrounded by white. In general, bottom-hat filtering produces highlighted areas, which more truly follow the shape of the hair. However, the main motivation behind utilizing a bottom-hat filter is still the ability to better preserve the true shape of the hair.

**Figure 3.** *Flowchart of the proposed method.*

**Figure 4.** *RGB (a) and YIQ (b) color spaces.*

**Figure 5.** *Hair detection. (a) Y-channel image. (b) Result of bottom-hat operation.*
