Published in


Cannabis Bud Area

Baby Steps to Tokenized Cannabis

Cannabis Computer Vision


HSV Range Detector

You can checkout this gif to get an idea of how I go about defining the HSV boundary values.

Creating the initial HSV Mask

Simple range mask like we did with the leaf detector

Preview the mask

Cannabis Computer Vision

Refining the Mask

Before and After Cleaning Up the Contours

You can still see a few smaller contours that escape this sweep, but they’re technically smaller bud sites below the top layer of canopy. Either way we’ll filter them in the next pass below.

Enhance Mask with Labeled Components

Label the Buds

You can see the smaller spots, which actually appear to be smaller bud sites below the canopy are not labeled. We can remove or lower the threshold of 100px to further refine the camera’s calibration, but this is a great result for this stage.

A Full Copy of the Notebook Below

top: HSV Original, bottom: Final Mask Before Contour Filtering



GreenThumb IO is a company focused on automating conventional agriculture cultivating technology with smart cameras and machine learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store