title: MatLab - Segmentation to separate touching objects in an image
body: <p>I'm using the function regionprops to detect the number of trees on a image taked by drone.
  <a href="https://i.stack.imgur.com/aBHUL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aBHUL.jpg" alt="Original Image"></a></p>
  
  <p>First I removed the ground using Blue NDVI:
  <a href="https://i.stack.imgur.com/huVDj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/huVDj.jpg" alt="Image BNDVI"></a></p>
  
  <p>Image with threshold:
  <a href="https://i.stack.imgur.com/9WlzX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9WlzX.jpg" alt="Image with Threshold"></a></p>
  
  <p>Then I used the function regionprops to detect the number of trees on image:
  <a href="https://i.stack.imgur.com/nBVmp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nBVmp.jpg" alt="Regionprops"></a></p>
  
  <p>But there are a problem on region 15, because all trees on that region are connected and it detects as one tree. 
  I tried to separate the trees on that region using <a href="https://www.mathworks.com/help/images/examples/marker-controlled-watershed-segmentation.html" rel="nofollow noreferrer">Watershed Segmentation</a>, but its not working:</p>
  
  <p><a href="https://i.stack.imgur.com/9wyS6.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9wyS6.jpg" alt="Watershed segmentation"></a></p>
  
  <p>Am I doing this the wrong way? 
  Is there a better method to separate the trees?</p>
  
  <p>If anyone can help me with this problem I will appreciate. Here is the region 15 without the ground:
  <a href="https://i.stack.imgur.com/nHOet.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nHOet.jpg" alt="Region 15"></a></p>
  
  <p>If it helps, here is the Gradient Magnitude image:
  <a href="https://i.stack.imgur.com/ijRhk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ijRhk.jpg" alt="enter image description here"></a></p>