I'm trying to take real time input for hand gestures with web cam, then processing the images to feed them to a neural network. I wrote this processing function to make the hand features look prominent:
def image_processing(image, count):
roi = image[42:338, 2:298]
cv2.imwrite('a/'+str(count)+'.png', roi)
img = cv2.imread('a/'+str(count)+'.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray,(5,5),2)
th3 = cv2.adaptiveThreshold(blur,10,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_INV,11,2)
ret, res = cv2.threshold(th3, 225, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
res = cv2.Canny(res,100,200)
cv2.imshow("Canny", res)
cv2.imwrite('a/'+str(count)+'.png', res)
--Edit--
The input and the output images are as follows :
It's obvious that double lines, instead of one, are detected along the edges. I want to make them single. If I apply just Canny edge detection algo, then the edges are not very prominent.