For an image analysis problem, I want to output a binary image where the background is dark and the coins are white. I'm supposed to use skimage and not CV2.
I've already done some coding to come up with the following image:
The code that runs this image is:
im_coin = io.imread("coins.jpg")
imgGaussF = scipy.ndimage.gaussian_filter(im_coin, sigma=2.5)
im = img_as_ubyte(imgGaussF)
edge_canny = feature.canny(im, sigma=1,low_threshold=10, high_threshold=50)
plt.figure(figsize=(15,8))
plt.subplot(131), plt.imshow(edge_canny, cmap='gray'), plt.axis('off'), plt.title('Canny Edge Dectector \n (sigma = 1, T1=10, T2 = 50)')
Now I'm supposed to fill the holes of the image presented above.
I tried:
edge_canny = edge_canny > 0.5
im_fill1 = binary_fill_holes(edge_canny, structure=np.ones((3,3)))
plt.gray()
plt.figure(figsize = (15,12))
plt.subplot(132), plt.imshow(im_fill1), plt.axis('off'), plt.title('Binary holes filling square size = 3 ')
But this doesn't do the trick. It returns the same image with no holes filled. Can anyone help me?
Note: I'm supposed to use skimage instead of cv2