Extract cell outline

50 views
Skip to first unread message

ely...@mail.com

unread,
Jan 27, 2017, 4:52:10 PM1/27/17
to scikit-image

Hi,

 

For few days, I am trying to convert this OpenCV script to scikit-image without successes. The aim is to get the outline of the cells and fill it so I can measure region properties.

 

import cv2

import numpy as np

 

#image can be found in https://i.stack.imgur.com/afCDL.jpg

filename = 'E:/afCDL.jpg'

 

img = cv2.imread(filename)

cv2.imwrite('E:/img.jpg',img)

cv2.imshow("Original Image", img)

gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

cv2.imwrite('E:/gray.jpg',gray)

 

bi = cv2.bilateralFilter(gray,5,25,25)

 

cv2.imwrite('E:/bi.jpg',bi)

blur = cv2.GaussianBlur(bi,(25,25),0)

cv2.imwrite('E:/blur.jpg',blur)

dog = blur - bi

cv2.imwrite('E:/DoG.jpg',dog)

cv2.imshow("DOG Image", dog)

 

kernel = np.ones((3,3),np.uint8)

fill = cv2.morphologyEx(dog, cv2.MORPH_CLOSE, kernel) #Fill holes- DOES NOT WORK

cv2.imshow("Fill", fill)

removeNoise = cv2.morphologyEx(fill, cv2.MORPH_OPEN, kernel) #Remove noise

cv2.imshow("remove Noise ", removeNoise)

 

cv2.waitKey(0)

cv2.destroyAllWindows()

 

I will appreciate any help and if you someone have a better idea how to extract the cell outline it will be great.

 

Thanks.

Reply all
Reply to author
Forward
0 new messages