Hello, I'm currently working in a project in that I have to do a vein detector using IR images and live capture. after apply CLAHE there are some "waves" on the images (inside the redbox), first I didn't know what could be, but after talking with my teachers probably the problem its the amount of black on the image. But we don't know how to remove those waves. I tried a bigger ROI wich helps, but just reduced the waves, and then I tried a smaller ROI just to capture an arm section to see the veins, but nothing works. I think that the webcam also could be a part of the problem, I'm using a Genius Facecam 1000HD but I don't know if it can really affect the waves.
I hope you can help me with this problem, I tried many things but nothing resolve completly the problem.
Greetings.
import matplotlib.pyplot as plt
import matplotlib.image as img
import numpy as np
import cv2
kernel = np.ones((3,3),np.uint8)
kernel[0,0]=0
kernel[0,2]=0
kernel[2,0]=0
kernel[2,2]=0
print(kernel)
#-----Reading the image-----------------------------------------------------
camera = cv2.VideoCapture(1)
while cv2.waitKey(1)==-1:
retval, img = camera.read()
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow('byn',gray)
retval,mask = cv2.threshold(final,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
gray = cv2.bitwise_and(final,final,mask = mask)
##-----PROCESAMIENTO-----------------------------------
#Def. ROI
nf,nc=gray.shape
CAP1 = gray.copy() #con ROI
#Ecualización
clahe = cv2.createCLAHE(clipLimit=20.0, tileGridSize=(8,8))
gray= clahe.apply(gray)
CAP2 = gray.copy()
gray = cv2.medianBlur(gray,3) #Filtro Mediana
CAP3 = gray.copy()
cv2.imshow('BLUR',CAP3)
retval,CAP4 = cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
mask1=(CAP4>0)*gray #pixeles grises
mask2=(CAP4==0)*int(CAP3.mean()+40) #Fondo Promedio
gray=np.uint8(mask1+mask2) #conviente a formato int
CAP5 = gray.copy()
retval,gray = cv2.threshold(gray,120,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
gray = (CAP1>0)*gray
CAP6 = gray.copy()
gray = cv2.erode(gray,kernel,iterations = 2)
gray = cv2.morphologyEx(gray, cv2.MORPH_OPEN, kernel)
CAP7 = gray.copy()
cv2.imshow('PROMEDIO',CAP5)
cv2.imshow('CLAHE',CAP7)
cv2.destroyAllWindows()
camera.release()