π« The Pain Point
After an event shoot, you have 500 photos but 100 are blurry. Reviewing each one to find the bad shots takes hours.
π Agentic Solution
An Automatic Blur Detector that scores each image and separates the sharp from the blurry.
Key Features:
- Laplacian Variance: Mathematical measurement of image sharpness.
- Adjustable Threshold: Customize what counts as βtoo blurryβ.
- Batch Sorting: Automatically move blurry images to a separate folder.
βοΈ Phase 1: Commander (Quick Fix)
For quick sorting.
Prompt:
βI have a folder
event_photoswith mixed quality images. Write a Python script using OpenCV to:
- Blur Detection: Calculate Laplacian variance for each image.
- Threshold: Images with variance < 100 are considered blurry (adjustable).
- Sort: Move blurry images to
blurry/folder, keep sharp insharp/.- Report: Print each image with its blur score.
Handle read errors gracefully. Print summary at end.β
Result: Only sharp photos remain for editing.
ποΈ Phase 2: Architect (Permanent Tool)
For Photographers.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Photo Quality Sorter" Desktop App
**Objective:** A desktop utility to sort thousands of photos by sharpness using blur detection algorithms.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Image Processing: OpenCV, Pillow
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Controls:** Folder Selection, Threshold Slider (Variance 0-500).
* **Analysis:** Chart (Matplotlib or QChart) showing blur distribution.
* **Gallery:** Preview detected "Blurry" vs "Sharp" images grid.
* **Actions:** "Move Blurry to Folder" button.
2. **Core Logic:**
* Calculate Laplacian Variance (OpenCV).
* Real-time re-sorting when slider moves (if cached).
* **Threading:** Heavy analysis runs in background thread (`QThread`).
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
π§ Prompt Decoding
- Laplacian Variance: A sharp image has high variation in the Laplacian (edges are clear). A blurry image has low variance (edges are mushy).
π οΈ Instructions
- Install:
pip install opencv-python - Copy Prompt β Run.
- Adjust threshold based on your quality standards.