Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add aeren23/image-processing-skills --skill 03-thresholding-strategygit clone --depth 1 https://github.com/aeren23/image-processing-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/aeren23/image-processing-skills/03-thresholding-strategy)<a href="https://agentmods.dev/skills/aeren23/image-processing-skills/03-thresholding-strategy"><img src="https://agentmods.dev/badge/skills/aeren23/image-processing-skills/03-thresholding-strategy.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00027 | $0.01497 |
| Opus 5 | $0.00014 | $0.00749 |
| Sonnet 5 | $0.00005 | $0.00299 |
| Haiku 4.5 | $0.00003 | $0.00150 |
Grade A, and why
thresholding-strategy scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Thresholding Strategy
When to Use This Skill
- Converting an image to binary (black/white) for segmentation
- Separating foreground objects from background
- Preprocessing before contour detection or morphological operations
- Improving contrast on low-contrast images
- Working with images that have uneven lighting or shadows
Decision Framework
Which Thresholding Method?
Image lighting conditions?
├── Uniform lighting, good contrast
│ ├── You know the ideal threshold value
│ │ └── ✅ Global Threshold (cv2.threshold)
│ └── You don't know the ideal value
│ └── ✅ Otsu's Method (automatic optimal threshold)
│
├── Uneven lighting / shadows present
│ └── ✅ Adaptive Threshold (cv2.adaptiveThreshold)
│ ├── General use → ADAPTIVE_THRESH_MEAN_C
│ └── Text/document → ADAPTIVE_THRESH_GAUSSIAN_C (better)
│
└── Very low contrast (details invisible)
└── First enhance contrast, THEN threshold:
├── Moderate enhancement → Histogram Stretching
├── Strong enhancement → Histogram Equalization
└── Local enhancement → CLAHE (best for most cases)
Contrast Enhancement Comparison
| Method | Function | Effect | Best For |
|---|---|---|---|
| Histogram Stretching | cv2.normalize(NORM_MINMAX) |
Linear rescale min→0, max→255 | Natural-looking enhancement |
| Histogram Equalization | cv2.equalizeHist() |
Aggressive CDF-based redistribution | Maximum contrast, looks artificial |
| CLAHE | cv2.createCLAHE() |
Local adaptive equalization | Medical images, preserves local detail |
Default choice: CLAHE. It provides strong enhancement without the over-amplification artifacts of global equalization.
Global Threshold Types
| Type | Above Threshold | Below Threshold | Use Case |
|---|---|---|---|
THRESH_BINARY |
White (255) | Black (0) | Standard foreground extraction |
THRESH_BINARY_INV |
Black (0) | White (255) | Dark objects on light background |
THRESH_TRUNC |
Clamped to threshold | Unchanged | Brightness capping |
THRESH_TOZERO |
Unchanged | Set to 0 | Keep only bright regions |
THRESH_TOZERO_INV |
Set to 0 | Unchanged | Keep only dark regions |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 162 lines · 27 tokens per session scan A aef87d291f95
thresholding-strategy is a skill published in the GitHub repository aeren23/image-processing-skills (5 stars, last pushed 3mo ago), licensed MIT. It adds 27 tokens to every session and 1,497 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
Cell Segmentation Skills Index
Cell and nucleus segmentation tools for microscopy images. Covers Cellpose, SAM-based methods, StarDist, InstanSeg, and Mesmer.
Bio Image Processing Skills Index
Skills for biological image analysis: cell/nucleus segmentation, image restoration, and spatial data processing.
tao-train-mask2former
Mask2Former for universal image segmentation (panoptic, instance, and semantic). Transformer-based with masked attention for high-quality segmentation results. Use when training, evaluating, exporting, quantizing, or running inference for a TAO Mask2Former model. Trigger phrases include "train Mask2Former", "universal…
tao-train-mask-grounding-dino
Mask Grounding DINO for grounded instance segmentation. Extends Grounding DINO with a mask-prediction head for open-set segmentation guided by text prompts. Use when training, evaluating, exporting, quantizing, or running inference for a TAO Mask-Grounding-DINO model. Trigger phrases include "train Mask Grounding…
tao-train-mask-auto-label
MAL (Mask Auto-Label) for weakly-supervised segmentation. Produces segmentation masks from minimal annotations (point or box annotations) using a ViT-MAE backbone. Use when training, evaluating, or running inference for a TAO MAL model. Trigger phrases include "train MAL", "Mask Auto-Label", "weakly-supervised…
genomics-cnv-calling
Load when calling CNV segments via CBS-style segmentation on a bin-level log2-ratio CSV from exome / WGS coverage — emits per-segment 5-class CN state (amplification / gain / neutral / loss / deepdeletion), per-chromosome summary, genome-fraction-altered. Skip when working with single-cell / spatial CNV (use…