0

I need to paint over like this:
Original:
original

Segmentation:
segmentation

how can it be done better?

I tried to use chan_vese and canny, Also gaussianblur and canny. And find_contours in scikit. But this segmentation have problems. Still not everything is circled, there are cracks in the segmentation.

cv = chan_vese(image, mu=0.1, lambda1=1, lambda2=2, tol=1e-3,
               max_iter=200, dt=0.1, init_level_set="checkerboard",
               extended_output=True)
fig, ax = plt.subplots(1, 3, figsize=(32, 30))
contours = measure.find_contours(cv[1], 0.4) 
for contour in contours:
  if len(contour) > 50: 
    ax[0].plot(contour[:, 1], contour[:, 0], linewidth=1, color='#FF0056')
    rr, cc = polygon(contour[:, 0], contour[:, 1], img.shape)
    img_pol[rr, cc, 0] = 255
    img_pol[rr, cc, 1] = 0
    img_pol[rr, cc, 2] = 86
    img_pol_mask[rr, cc] = 1
ax[0].imshow(img, cmap='gray')
ax[1].imshow(img_pol)
ax[2].imshow(img_pol_mask, cmap = ListedColormap(['black', '#FF0056']))

ax[0].set_axis_off()
ax[1].set_axis_off()
ax[2].set_axis_off()

`

Shai
  • 111,146
  • 38
  • 238
  • 371
bobr
  • 1
  • 1

0 Answers0