Skip to content

Instantly share code, notes, and snippets.

@cydal
Created March 13, 2021 08:27
Show Gist options
  • Save cydal/a75dd17378c5801341b220fd1670696a to your computer and use it in GitHub Desktop.
Save cydal/a75dd17378c5801341b220fd1670696a to your computer and use it in GitHub Desktop.
from plantcv import plantcv as pcv
from PIL import Image
import numpy as np
import cv2
img = cv2.imread(img_path)
a = pcv.rgb2gray_lab(img, channel='a')
img_binary = pcv.threshold.binary(gray_img=a, threshold=120, max_value=255, object_type='dark')
greenPlants = pcv.fill(bin_img=img_binary, size=200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment