I was trying to figure out a way to mark the veins in an image using OpenCV in Python. Most of the similar articles i came across uses CLAHE to produce a result,I did CLAHE multiple times on grayscale image, and it did make the veins more viewable but i cant figure out a way to mark the vein in a different color. CLAHE also significantly reduces the overall image quality.
My input image:
After CLAHE 4 times:
Code:
import numpy as np
import cv2
def multi_clahe(img, num):
for i in xrange(num):
img = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(4+i*2,4+i*2)).apply(img)
return img
img = cv2.imread('img.png')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
final = multi_clahe(gray, 4)
cv2.imwrite('image.png',final)
cv2.imshow('image',final)
cv2.waitKey(0)
cv2.destroyAllWindows()
Here's the method to follow-
Suggestion to improve the output: