7
I’m working on hair removal on skin images. Researching the literature, the means to achieve my goal, applying some techniques of segmentation and removal of noise in images. Which I’m applying to. An example of what an image I work is this:
Applying the Diference of de Gaussian in the image I have the exit:
import cv2
import numpy as np
#read the input file
img = cv2.imread('014.bmp')
#run a 5x5 gaussian blur then a 3x3 gaussian blr
blur5 = cv2.GaussianBlur(img,(5,5),0)
blur3 = cv2.GaussianBlur(img,(3,3),0)
DoGim = blur5 - blur3
cv2.imwrite('014-DoG.jpg', DoGim)
Then I use the morphological operator: cv2.morphologyEx to remove the noise from the image, leaving only the hair, so that I can later apply a mask to remove the hair. However, the exit both to the cv2.morphologyEx(img2gray,cv2.MORPH_OPEN,kernel)
as cv2.morphologyEx(img2gray,cv2.MORPH_CLOSE,kernel)
do not meet the expectation.
import numpy as np
import matplotlib.pyplot as plt
import cv2
pic = cv2.imread('014DoG.jpg')
img2gray = cv2.cvtColor(pic, cv2.COLOR_RGB2GRAY)
# Remove hair with opening
kernel = np.ones((5,5),np.uint8)
opening = cv2.morphologyEx(img2gray,cv2.MORPH_OPEN,kernel)
plt.imshow(opening, cmap='gray')
plt.show()
Can someone help me remove these noises and remove the hairs?