This document provides an overview of various image processing techniques implemented in the Streamlit application. Each section describes the method, its purpose, and any relevant mathematical formulas.
This method reduces noise while preserving edges by averaging pixels with similar colors from different regions.
The denoising process can be described as follows:
where:
- (I(x)) is the intensity of the pixel at position (x),
- (N(x)) is a neighborhood around (x),
- (w(x, y)) is a weight that measures the similarity between pixels (x) and (y),
- (Z(x) = \sum_{y \in N(x)} w(x, y)) is a normalization factor.
Wavelet denoising involves transforming the image into the wavelet domain and thresholding the coefficients.
The process can be represented as:
where:
- (\hat{I}(x)) is the reconstructed image,
- (\hat{c}_j) are the thresholded wavelet coefficients,
- (\psi_j(x)) are the wavelet basis functions.
This technique enhances the contrast of an image by redistributing the intensity values. The transformation is given by:
where:
- (s) is the new intensity,
- (r) is the old intensity,
- (n_i) is the number of pixels with intensity (i),
- (N) is the total number of pixels,
- (L) is the maximum intensity level.
CLAHE divides the image into small regions and applies histogram equalization to each. The transformation can be represented as:
where:
- (H_{local}) is the histogram of the local region,
- (H_{global}) is the global histogram,
- (c) is the clipping limit.
SIFT detects features that are invariant to scale and rotation. Keypoint detection involves identifying local extrema in the difference of Gaussian (DoG):
where:
- (G) is the Gaussian function,
- (\sigma) is the scale.
SURF is similar to SIFT but uses an approximation of the determinant of the Hessian matrix for keypoint detection. The determinant of the Hessian is given by:
where (D_{xx}), (D_{xy}), and (D_{yy}) are the second-order derivatives of the Gaussian.
Canny edge detection involves several steps, including gradient calculation, non-maximum suppression, and edge tracing. The gradient magnitude is computed as:
where (G_x) and (G_y) are the gradients in the x and y directions.
Blob detection identifies regions in an image that differ in properties such as brightness. A common method is using the Laplacian of Gaussian (LoG):
where (\nabla^2) is the Laplacian operator, and (G) is the Gaussian function.
Otsu’s method automatically determines a threshold value to minimize intra-class variance:
The Sobel operator uses convolution with two kernels to compute gradients:
The gradient magnitude is calculated as:
The watershed algorithm treats the gradient magnitude as a topographic surface and finds the "watershed lines" that separate regions. The markers are obtained by finding local minima in the gradient.
K-means clustering segments the image by grouping pixels based on their color values. The update steps can be expressed as:
-
Assign each pixel to the nearest centroid: $$ c_i = \arg\min_j ||x_i - \mu_j||^2 $$
-
Update the centroids: $$ \mu_j = \frac{1}{N_j} \sum_{i=1}^{N_j} x_i $$
where (N_j) is the number of points assigned to centroid (j).
An affine transformation can be represented as:
where ((x', y')) are the transformed coordinates, (a, b, c, d) are the transformation parameters, and ((tx, ty)) are the translation components.
Perspective transformation can be expressed as:
The normalized coordinates are calculated as:
where $$ (h_{ij}) $$ are the elements of the transformation matrix.
The techniques presented in this document can be effectively used to process and analyze images. Each method has its unique strengths and is suitable for different tasks in image processing.