Skip to content

About

Image sharpness mapping in Python using Laplacian variance and blockwise analysis for depth of field estimation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Sharpness Mapping (Python, Laplacian variance)

Description

This repository implements a blockwise sharpness mapping algorithm in Python using Laplacian variance. It is particularly useful for assessing the depth of field of optical systems with limited depth of field. By translating the camera to capture successive planes (first focus plane, best focus plane, last focus plane), the algorithm can be applied to verify whether the sharpness maps of the first and last planes are similar.


Visualization of focal planes within the depth of field

Quick Start

Clone the repository:

git clone https://github.com/nellbru/image-sharpness-mapping.git
cd image-sharpness-mapping

Run the script:

python sharpness.py

This script calculates the blockwise Laplacian variance, applies a threshold to classify sharp regions, overlays the result for visualization, and saves the output image.

Results

All generated figures are saved to Results/. The result shows the original image with a transparent overlay marking blocks classified as sharp (based on variance threshold).


Source image and result

Project Structure

image-sharpness-mapping/
├─ Images/          # Sample inputs (add your own images)
├─ Results/         # Results
├─ docs/            # Documentation assets
├─ sharpness.py     # Sharpness mapping script
├─ .gitignore       # Git ignore rules
├─ LICENSE          # Project license
└─ README.md        # Project documentation

Requirements

  • Python 3.12+
  • opencv-python
  • numpy

License

This project is licensed under the terms of the LICENSE file.

About

Image sharpness mapping in Python using Laplacian variance and blockwise analysis for depth of field estimation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages