Skip to content

borealBytes/PlotStandCount

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Plot Stand Counter πŸŒ±πŸ“Š

A Desktop GUI for Early-Season Stand Counts from RGB Orthomosaics

A lightweight PySide6 desktop application for counting early-season crop stands (sunflower, corn, and other row crops) from large RGB GeoTIFF orthomosaics.

Designed for:

  • Research plot trials
  • Emergence assessment (e.g., ~7 DAE sunflower)
  • Early corn stand counts
  • High-throughput field phenotyping workflows

Optimized for large TIFFs (hundreds of MB to multi-GB) with built-in pyramid support.


Features

Plot-Based Stand Counting

  • Define plots by clicking start/end points for each row
  • Configurable number of rows per plot
  • Configurable row spacing
  • Optional fixed row length mode (e.g., standardized 20 ft strips)
  • Adjustable row AOI width (ft)

Detection & Adjustment

  • Excess Green (ExG) vegetation segmentation
  • Otsu thresholding inside row AOI
  • Morphological cleanup
  • Connected components plant detection
  • Cluster/double detection heuristic
  • Raw and adjusted counts

Metrics Computed

Per Row:

  • Row length (ft)
  • Adjusted plant count
  • Raw plant count
  • Plants per foot

Per Plot:

  • Total adjusted plants
  • Total raw plants
  • Plants per acre (adjusted + raw)
  • Plot area (ftΒ²)

Large GeoTIFF Support

  • Built-in pyramid (overview) creation
  • Option to build overviews in-place or on a copy (copy recommended)
  • Smooth zoom and pan for large mosaics

Output Files

  • rows.csv β€” row-level data
  • plots.csv β€” plot-level summaries
  • annotated_overview.png
  • Individual plot images: plot_####_raw.png and plot_####_annot.png

⚠️ The original TIFF is never modified by annotations.


Installation

Requirements

  • Python 3.11 or 3.12+

Setup

Create and activate a virtual environment (recommended):

python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # macOS/Linux

Install dependencies:

pip install pyside6 rasterio opencv-python numpy scikit-image

Or using requirements.txt:

pyside6
rasterio
opencv-python
numpy
scikit-image
pip install -r requirements.txt

Running the Application

python Sunf_count_GUI.py

Workflow

1. Open GeoTIFF

  • Go to File β†’ Open GeoTIFF
  • Set your Output Folder

2. Enable Pyramids (Recommended)

  • Check Ensure overviews (pyramids) on open
  • Select Build overviews on a COPY (recommended)

This ensures smooth navigation on large images.

3. Configure Plot Parameters

  • Rows per plot
  • Row spacing (inches)
  • Row AOI width (ft)
  • Fixed row length (optional)
  • Detection parameters (area, circularity, cluster factor)

4. Digitize a Plot

Click to define row endpoints:

  • Row 1 β†’ start, end
  • Row 2 β†’ start, end
  • … After the final required click β†’ preview computes automatically

5. Review & Accept

Shortcut Action
a Accept & Save
d Discard
ESC Discard preview

Additional controls:

  • Show Preview (Left) β€” visually inspect detection
  • Mouse wheel β€” zoom
  • Right-click drag β€” pan
  • Reset View β€” return to full overview

Detection Method

Vegetation Extraction

  1. Compute Excess Green index:
    ExG = 2G - R - B
    
  2. Otsu thresholding within the row AOI
  3. Morphological closing
  4. Remove small objects
  5. Connected components labeling

Cluster Adjustment

For each row:

  • Compute median blob area
  • If blob_area > cluster_factor Γ— median:
    • Flag as cluster
    • Assign a size multiplier (capped)
  • Adjusted counts sum multipliers per row

Example Applications

  • Sunflower emergence (~7 days after planting)
  • Corn early stand counts
  • Multi-row research plots
  • Fixed-length sampling strips (e.g., 15 ft, 20 ft, 30 ft)

Screenshots

Place images in docs/images/ and reference them below.

Overview Plot Preview


Output Structure

output_folder/
β”‚
β”œβ”€β”€ rows.csv
β”œβ”€β”€ plots.csv
β”œβ”€β”€ annotated_overview.png
└── plots/
    β”œβ”€β”€ plot_0001_raw.png
    β”œβ”€β”€ plot_0001_annot.png
    β”œβ”€β”€ plot_0002_raw.png
    └── ...

Repository Structure

.
β”œβ”€β”€ Sunf_count_GUI.py
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ LICENSE
└── docs/
    └── images/

License

Specify your license here (e.g., MIT, Apache 2.0).


Citation / Acknowledgements

If you use this tool in your research, please consider citing or acknowledging the source. Contributions and issues are welcome via GitHub.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%