title: How to use watershed segmentation in opencv python
body: <p>I have a problem of how to segment the particles individually in this image using watershed segmentation in python .. My main goal is to remove noise by applying filter medianBlur then applying Canny edge detection method . </p>
  
  <pre><code>[![img = cv2.imread('sands.jpg')
  img = cv2.medianBlur(img,7)
  img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
  imo = cv2.Canny(img,140,255)][1]][1]
  </code></pre>
  
  <p>I would like to enhance the contours resulted from the Canny edge detection function as I use this images in detecting the region properties of particles within the image to estimate area .</p>
  
  <p><a href="https://i.stack.imgur.com/42Xa7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/42Xa7.jpg" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/2rRp7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rRp7.jpg" alt="enter image description here"></a></p>