Image Analyzer
Provides utility methods to analyze image quality and pixel data.
This class extracts physical metrics from images, such as brightness, contrast, and sharpness (blur score), which are essential for understanding the quality of a computer vision dataset.
Source code in tools/stats/image_analyzer.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
analyze_metrics(img_path)
staticmethod
Calculates brightness, contrast, and blur score for an image file.
The method performs the following steps: 1. Reads the image from the disk in BGR format. 2. Converts the image to grayscale. 3. Computes the mean (brightness), standard deviation (contrast), and Laplacian variance (blur score).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img_path
|
Path
|
The file system path to the image. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, float]
|
Dict[str, float]: A dictionary containing calculated metrics. Returns an empty dictionary if the image cannot be read. |
Source code in tools/stats/image_analyzer.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |