title: How can I count number of stomata in the microscopic image of leaf using Python and Opencv?
body: <p>I want to count the number of stomata in the microscopic images of leaves. One of the samples is attached below. The stomata is characterized by oval shape in general with thick black lining in between. Since I have many images, I want to automate the process. I am familiar with Python but quite novice to computer vision.</p>
  <p><a href="https://i.stack.imgur.com/eBRpn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eBRpn.jpg" alt="enter image description here" /></a></p>
  <p>With some code, I was able to count the number of cars in an image. However, it did not work with the image of the leaf for me. The sample code is given below:</p>
  <pre><code>import cv2
  import numpy as np
  import matplotlib.pyplot as plt
  import cvlib as cv
  from cvlib.object_detection import draw_bbox
  from numpy.lib.polynomial import poly
  
  image = cv2.imread(&quot;leaf1.jpg&quot;)
  box, label, count = cv.detect_common_objects(image)
  output = draw_bbox(image, box, label, count)
  plt.imshow(output)
  plt.show()
  </code></pre>
  <p>I got the results as follows with no detection of any object in the image. Is it possible to count the number of stomata in the leaf images as these?
  <a href="https://i.stack.imgur.com/ZNwMO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZNwMO.png" alt="enter image description here" /></a></p>