0

enter image description here I am performing outer edge detection for droplets of this image.The problem is that the image is having uneven illumination.Hence background substraction is not working properly.please help.Thanks

Frame= cv2.rotate(Frame, cv2.ROTATE_90_CLOCKWISE)
#gray-scale convertion and Gaussian blur filter applying
GrayFrame = cv2.cvtColor(Frame, cv2.COLOR_BGR2GRAY)
GrayFrame = cv2.GaussianBlur(GrayFrame, (5, 5), 0)
fgmask=backsub.apply(GrayFrame)
cv2.imshow('fg',fgmask)
dilate = cv2.dilate(fgmask, None, iterations=1)
erode  = cv2.erode(dilate, None, iterations=1)
cv2.imshow('erode',erode)
FrameThresh = cv2.threshold(erode, 1,100, cv2.THRESH_BINARY)[1]
cv2.imshow('Thresh',FrameThresh)
#Dilate image and find all the contours
cnts,heir = cv2.findContours(FrameThresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
skilfuel
  • 21
  • 3

1 Answers1

0

Sufficiently large morphological closing should do the trick. (With subtraction, this implements a top-hat filter.)

enter image description here