Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. erosion=imerode(binary,strel('disk',integerValue));
  2. D = bwdist(erosion);
  3. D = -D;
  4. D(~erosion) = -Inf;
  5. L = watershed(D);
  6.  
  7. distanceD = -cv2.distanceTransform(1-not_im_eros, distanceType=cv2.DIST_L2, maskSize=0)
  8. distanceDD = np.zeros_like(distanceD)
  9. distanceDD[distanceD == 0] = 255
  10. distanceD_positive = -distanceD
  11. distanceD_uint8 = (distanceD_positive/(distanceD_positive.max()/255.0)).astype('uint8')
  12. cv2.imshow('distanceD', 255-distanceD_uint8)
  13. Ld = mp.watershed(distanceDD, mask = distanceD_positive)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement