# Synthetic projected leaf-area proxy / 合成画像の投影面積

This is a deterministic geometric illustration, not measured plant data, a trained segmenter or a validated crop model. Three ellipses form a visible union. Color changes and a background tag demonstrate segmentation errors. The reference is the in-frame union defined by the generator; it excludes hidden surfaces and out-of-frame pixels.

## Run / 実行

Tested on Linux x86_64, Python 3.12.3, NumPy 1.26.4, OpenCV 4.6.0. Requirements pin the tested pip distributions. Other OS/Python combinations are not certified.

```
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
.venv/bin/python experiment.py --self-test
.venv/bin/python experiment.py --verify expected.json --out reproduced
```

On Windows, use `.venv\Scripts\python.exe`. Output directory must not exist. No camera, network or external images are accessed by experiment.py. The package does not implement a real-photo ingestion workflow.

Each case produces RGB input, reference mask, extracted mask and error overlay PNGs, plus results.json and runtime.json. Red marks false positives; blue marks false negatives. `samples/` contains baseline outputs. Numerical verification checks unrounded results with abs/rel tolerance 1e-10. Source PNG files are hash-listed; re-encoding on a different platform is not required to give byte-identical PNGs.

## Change / 変更

```
.venv/bin/python experiment.py --min-v 40 --out lower-v
```

The default minimum V is 100. OpenCV uint8 HSV thresholds are H 35–85, S 80–255, V min_v–255; no morphology is applied. The dim_lower_v case always uses V minimum 40, independently of the CLI setting. All other cases use the CLI value. Baseline verification intentionally fails for changed results; do not combine a changed threshold with `--verify expected.json` expecting success.

The green_tag_roi case uses (x,y,width,height)=(50,20,230,190), chosen to exclude the synthetic tag while retaining the visible union. It is not a crop-independent ROI. Shrinking it can remove genuine target pixels. The scale is a supplied assumption, not measured automatically.

## Metrics / 指標

- pixels: count of selected pixels, not contour area.
- projected_mm2: pixels * mm_per_pixel squared; a planar reference-plane equivalent.
- mask_area_error_percent: pixel-count error relative to the in-frame reference, NOT physical-area error from scale calibration.
- IoU, precision, recall: pixel classification against the generated reference. Undefined denominators yield JSON null.
- touches_frame: selected pixels touch the image edge; a useful flag but not a complete truncation detector. Clipped parts outside the image are absent from the reference too.

wrong_scale changes 0.5 to 0.6 mm/pixel. It has perfect pixel metrics but +44% physical-area conversion error relative to the baseline. clipped also has IoU 1, but is incomplete. Equal areas can coexist with incorrect locations; a separate test constructs that counterexample.

No real leaf-surface area, biomass, growth rate, yield, disease or stress labels are inferred. Follow the linked article's acquisition and independent-reference protocol before applying a method to measured plants.

License: unspecified; no new usage license is granted by this package.
