πŸ–ΌοΈ

Blur Detector

Automatically detect and filter out blurry images from a photo collection.

Image ⭐⭐ Intermediate ⏱️ 3 minutes

😫 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_photos with mixed quality images. Write a Python script using OpenCV to:

  1. Blur Detection: Calculate Laplacian variance for each image.
  2. Threshold: Images with variance < 100 are considered blurry (adjustable).
  3. Sort: Move blurry images to blurry/ folder, keep sharp in sharp/.
  4. 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

  1. Install: pip install opencv-python
  2. Copy Prompt β†’ Run.
  3. Adjust threshold based on your quality standards.

Related Workflows

Explore other categories

πŸ“¬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

πŸ“– Free eBook Guide πŸ“¦ 7 Ready-to-use Scripts πŸ”” Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.