Skip to content

geezacoleman/GilgaiDetection

Repository files navigation

The Coverage Calculator

Now available as a web-app on StreamLit!

Streamlit App

The CoverageCalculator allows you to upload images and perform two-class, colour-based segmentation. Using this thread on Twitter for inspiration, the app was made to allow a user to threshold images and determine the area of an image that comes from each of the two classes. It was built in a few hours with a lot of help from ChatGPT.

image

A Tkinter-based user interface

To use the tkinter GUI, clone this repository, install the requirements (numpy and OpenCV) and then run python gui.py on your command line. It should bring up a window like the one below. There are default colour settings included in the parameters.json file, but if you want to change those, you'll need to run gilgai_detection.py separately.

gui

Once it is open, select the directory of images you would like to process, click process. It will save the percent cover of each to a csv file and display a segmented image. You can toggle between the images using the Back/Forward buttons.

Non-GUI based

This example of Gilgai 'detection' uses simple HSV thresholding for wheat and Gilgai/non-wheat areas with OpenCV and numpy. The percentage cover of each class in the image is calculated using total pixels in the image and displayed on the image.

image

When the windows are closed with 'Q' the slider values are saved and will be loaded on reopening. Use the gilgai_detection.py file to set and store the values first and then the process_directory.py file to use the stored values to process and save the results from an entire directory to CSV.

About

Simple colour thresholdhing for Gilgai detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages