A Python project implementing quadtree-based image compression and edge detection, designed for efficient image representation while preserving key visual details. This tool leverages recursive quadtree decomposition to compress images based on color similarity and variance, and performs edge detection with adjustable sensitivity.
- Quadtree-based image compression: Groups image regions with similar colors for reduced detail while maintaining structure.
- Edge detection: Highlights prominent edges based on color differences and pixel variance.
- Adjustable tolerances: Fine-tune compression and edge detection sensitivity with user-defined parameters.
- Visualization: Displays original, compressed, and edge-detected images.
- Python
- OpenCV
- NumPy
Make sure you have the following installed:
pip install opencv-python numpy- Provide the path to your image file.
- Set the following tolerances when prompted:
- Compression tolerance: Controls how aggressively regions are merged (recommended range: 5–30).
- Edge color tolerance: Controls sensitivity to color changes (recommended range: 5–20).
- Edge variance tolerance: Controls detection of subtle textures (recommended range: 3–12).
enter image path: /content/sample.png
| Tolerances (compress / edge / variance) | Original Image | Compressed Image | Edge Detected Image |
|---|---|---|---|
| 5 / 5 / 3 (lower values) | ![]() |
![]() |
![]() |
| 30 / 20 / 12 (higher values) | ![]() |
![]() |
![]() |
Quadtree algorithms allow hierarchical decomposition of images, enabling efficient compression and adaptive edge detection. This approach is particularly useful for simplifying images while maintaining structural fidelity.




