[go: up one dir, main page]

0% found this document useful (0 votes)
17 views20 pages

DIP Ass Piyush

The document outlines assignments related to digital image processing, including interpolation techniques, pixel relationships, histogram equalization, and evaluation of image enhancement using PSNR and SSIM. It provides detailed explanations of various interpolation methods, pixel operations, and filtering techniques, along with their applications and limitations. Additionally, it discusses the effectiveness of different histogram equalization methods and the comparative analysis of low-pass and high-pass filters in both spatial and frequency domains.

Uploaded by

mudassir16alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views20 pages

DIP Ass Piyush

The document outlines assignments related to digital image processing, including interpolation techniques, pixel relationships, histogram equalization, and evaluation of image enhancement using PSNR and SSIM. It provides detailed explanations of various interpolation methods, pixel operations, and filtering techniques, along with their applications and limitations. Additionally, it discusses the effectiveness of different histogram equalization methods and the comparative analysis of low-pass and high-pass filters in both spatial and frequency domains.

Uploaded by

mudassir16alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

NAME-PIYUSH AGRAWAL

REG_NO-20224107

DIGITAL IMAGE PROCESSING ASSIGNMENTS

LIST OF ASSIGNMENTS

• Prepare a list of various interpolation techniques

• Relationship between pixels

• Histogram equalization techniques

• Enhanced image using PSNR SSIM

• In spatial and frequency domain apply low pass and


high pass filter check using PSNR and SSIM
List of Various Interpolation Techniques
Interpolation is a mathematical technique used to estimate unknown
values that fall between known data points. It is widely used in fields
such as engineering, computer graphics, geosciences, and data
analysis. Below is a comprehensive list of various interpolation
techniques categorized based on their application and methodology.

1. Polynomial Interpolation
Polynomial interpolation fits a polynomial function that passes
through all given data points.
1.1. Linear Interpolation
• The simplest form of interpolation.
• Connects two adjacent points with a straight line.
• Formula:

1.2. Quadratic Interpolation


• Uses a second-degree polynomial to fit three data points.
• Provides a smoother curve than linear interpolation.
1.3. Lagrange Interpolation

• Finds a polynomial that passes through all given points.

• Formula:

where Li(x) are Lagrange basis polynomials.

1.4. Newton’s Divided Difference Interpolation

• Uses divided differences to construct an interpolating polynomial.

• Efficient for adding new data points without recalculating the entire polynomial.

1.5. Hermite Interpolation

• Fits a polynomial that matches both the function values and their derivatives at given
points.

• Useful where smoothness is important.

2. Piecewise Interpolation
Instead of using a single polynomial for the entire dataset, piecewise interpolation divides
the data into segments and applies different interpolation methods to each.

2.1. Piecewise Linear Interpolation

• Connects each pair of adjacent points with a straight line.

• Simple but can be jagged.

2.2. Cubic Spline Interpolation

• Uses cubic polynomials between each pair of points.

• Ensures smoothness (continuous first and second derivatives).


• Types:

o Natural Cubic Spline (second derivatives at endpoints are zero).

o Clamped Cubic Spline (specifies first derivatives at endpoints).

2.3. B-spline Interpolation

• Uses basis splines (B-splines) for flexible curve fitting.

• More stable than polynomial interpolation for large datasets.

3. Multivariate Interpolation
Used when interpolating functions of multiple variables (e.g., 2D or 3D data).

3.1. Bilinear Interpolation

• Extends linear interpolation to two dimensions.

• Commonly used in image processing.

3.2. Bicubic Interpolation

• Uses cubic polynomials for smoother 2D interpolation.

• Better quality than bilinear for image resizing.

3.3. Nearest-Neighbor Interpolation

• Assigns the value of the nearest data point.

• Fast but produces blocky results.

3.4. Radial Basis Function (RBF) Interpolation

• Uses radial functions (e.g., Gaussian, multiquadric) to interpolate scattered data.

• Useful in machine learning and geostatistics.

3.5. Kriging (Gaussian Process Interpolation)

• A geostatistical method that considers spatial correlation.

• Used in weather modeling and mining

4. Other Specialized Interpolation Methods


4.1. Trigonometric Interpolation

• Uses trigonometric functions (Fourier series) for periodic data.


4.2. Rational Function Interpolation

• Uses ratios of polynomials for better approximation of complex functions.

4.3. Inverse Distance Weighting (IDW)

• Weights nearby points more heavily than distant ones.

• Used in geographic information systems (GIS).

4.4. Moving Least Squares (MLS)

• Locally fits polynomials to data points with weights.

• Used in computer graphics and mesh deformation.

4.5. Shape-Preserving Interpolation

• Ensures that the interpolated curve does not introduce unrealistic oscillations.

• Examples: Monotonic cubic interpolation.


Relationship Between Pixels
In digital image processing, understanding the relationship between pixels is crucial for tasks
like image enhancement, segmentation, compression, and object recognition. This
document explains various pixel relationships, including:

1. Neighbourhood Relationships

2. Adjacency and Connectivity

3. Distance Measures

4. Pixel Operations and Arithmetic

1. Neighbourhood Relationships

A pixel’s neighbourhood consists of surrounding pixels that influence its properties. Common
neighbourhoods include:

1.1. 4-Neighbourhood (Von Neumann Neighbourhood)

• Consists of top, bottom, left, and right pixels.

• For a pixel at (x,y), its 4-neighbors are:

1.2. 8-Neighborhood (Moore Neighbourhood)

• Includes 4-neighbors + diagonal pixels.

• For a pixel at (x,y)(x,y), its 8-neighbors are:

1.3. m- Neighbourhood (Mixed Adjacency)

• Used to avoid ambiguity in connectivity.

• A pixel q is in the m- Neighbourhood of p if:

o
2. Adjacency and Connectivity

Adjacency defines how pixels are connected based on intensity and neighbourhood.

2.1. Types of Adjacency

• 4-Adjacency: Two pixels are adjacent if they are in each other’s 4-neighborhood and
have similar intensities.

• 8-Adjacency: Two pixels are adjacent if they are in each other’s 8-neighborhood and
have similar intensities.

• m-Adjacency: A modified version to resolve multiple path ambiguities.

2.2. Connected Components

• A set of pixels where each pair is connected via a path of adjacent pixels.

• 4-connected: Path uses only 4-neighbors.

• 8-connected: Path uses 8-neighbors.

2.3. Path and Connectivity

3. Distance Measures Between Pixels

Distance metrics quantify how far apart two pixels are.

3.1. Euclidean Distance

• Straight-line distance between two pixels (x1,y1)(x1,y1) and (x2,y2)(x2,y2).

• Formula:
3.2. Manhattan (City-Block) Distance

• Sum of absolute differences in coordinates.

• Formula:

3.3. Chessboard (Chebyshev) Distance

• Maximum of the absolute differences.

• Formula:

3.4. Generalized Distance (Minkowski Distance)

• A generalization of Euclidean, Manhattan, and Chessboard distances.

• Formula:

o p=1: Manhattan distance

o p=2: Euclidean distance

o p→∞: Chessboard distance

4. Pixel Operations and Arithmetic

Pixel relationships are used in various arithmetic and logical operations.

4.1. Pixel Addition

• Used for image blending and noise reduction.

• Formula:
4.2. Pixel Subtraction

• Used for motion detection and background subtraction.

• Formula:

4.3. Pixel Multiplication & Division

• Used for masking and contrast adjustment.

• Formulas:

4.4. Logical Operations (AND, OR, NOT, XOR)

• Used for binary image processing.

• Example (AND operation):


Histogram Equalization Techniques
Histogram equalization is a contrast enhancement technique used in digital image
processing to improve the visual quality of images by redistributing pixel intensities. This
document explains:

1. What is a Histogram?

2. Histogram Equalization: Concept & Formula

3. Adaptive Histogram Equalization (AHE)

4. Contrast Limited Adaptive Histogram Equalization (CLAHE)

5. Applications & Limitations

1. What is a Histogram?

A histogram represents the frequency distribution of pixel intensities in an image.

• For an 8-bit grayscale image, intensity values range from 0 (black) to 255 (white).

• The histogram h(k)h(k) gives the number of pixels with intensity kk.

• Normalized Histogram:

where M×N = image dimensions.

2. Histogram Equalization: Concept & Formula


Histogram equalization spreads out intensity values to cover the full dynamic range,
enhancing contrast.

2.1. Steps for Histogram Equalization

1. Compute the histogram h(k) of the input image.

2. Calculate the cumulative distribution function (CDF):


3.
4. Normalize the CDF to the maximum intensity value (e.g., 255 for 8-bit images):

where L=256 for 8-bit images).

5. Map original intensities to new values using sk.

2.2. Mathematical Formulation

The transformation function is:

where:

• r = original pixel intensity (input).

• s = transformed intensity (output).

• pr(w) = probability density function (PDF) of intensity r.


2.3. Example

ORIGINAL IMAGE

CALCULATIONS:

IMAGE AFTER EQUALIZATION

2.4. Result

The output image will have better contrast with intensities spread across the full range.

3. Adaptive Histogram Equalization (AHE)

• Standard histogram equalization works globally, which may over-enhance noise.

• AHE divides the image into small regions (tiles) and applies histogram equalization
locally.

• Advantages: Better local contrast enhancement.

• Disadvantages: Amplifies noise in homogeneous regions.


4. Contrast Limited Adaptive Histogram Equalization (CLAHE)

An improved version of AHE that limits contrast amplification.

4.1. Steps in CLAHE

1. Divide the image into small tiles (e.g., 8×8 or 16×16).

2. Compute histogram for each tile.

3. Clip the histogram to limit amplification (prevents noise enhancement).

4. Redistribute clipped pixels uniformly.

5. Apply bilinear interpolation to smooth block boundaries.

4.2. Key Parameters

• Clip Limit: Threshold to limit contrast (typical value: 0.01 to 0.03).

• Tile Size: Smaller tiles = more local enhancement (but may increase noise).

5. Applications & Limitations

5.1. Applications

✔ Medical Imaging (X-rays, MRI, CT scans).


✔ Satellite & Aerial Imaging (enhancing terrain features).
✔ Face Recognition (improving low-light images).
✔ Digital Photography (HDR imaging).

5.2. Limitations

✖ Noise Amplification (if not controlled, e.g., in CLAHE).


✖ Over-enhancement in already high-contrast regions.
✖ Not suitable for color images directly (requires HSV/YUV processing).

Conclusion

• Standard Histogram Equalization improves global contrast but may not work well for
local variations.

• AHE enhances local contrast but can amplify noise.

• CLAHE is the most effective, providing balanced contrast enhancement with noise
control.
Evaluating Enhanced Images Using PSNR and SSIM
1. Introduction to Image Quality Metrics

When applying enhancement techniques like histogram equalization, we need objective


ways to measure the improvement in image quality. Two widely used metrics are:

1. Peak Signal-to-Noise Ratio (PSNR)

2. Structural Similarity Index (SSIM)

These metrics help compare the enhanced image with a reference (ground truth) image.

2. Peak Signal-to-Noise Ratio (PSNR)

Definition

PSNR measures the ratio between the maximum possible power of a signal (image) and the
power of corrupting noise.

Formula

Interpretation

• Higher PSNR = Better quality (less distortion)

• Typical values:

o 30 dB: Good quality

o 20-30 dB: Acceptable


o <20 dB: Poor quality

Example Calculation

If MSE = 100 for an 8-bit image:

3. Structural Similarity Index (SSIM)

Definition

SSIM measures perceptual difference between two images by comparing:

• Luminance (brightness)

• Contrast

• Structure

Interpretation

• Range: [-1, 1]

• 1 = Perfect match to reference

• 0 = No similarity

• Negative values = Inverse correlation


Example Values

• SSIM > 0.9: Very similar

• SSIM 0.7-0.9: Structurally similar

• SSIM < 0.5: Significant differences

WHEN TO USE WHICH METRICS

Conclusion

• PSNR gives a mathematical measure of enhancement quality

• SSIM provides perceptual quality assessment

• For complete analysis, use both metrics together

• CLAHE typically scores better than standard histogram equalization.


Evaluation of Low-Pass and High-Pass Filters in Spatial and
Frequency Domains Using PSNR and SSIM
This document presents a comparative analysis of low-pass and high-pass filtering in both
spatial and frequency domains, with quantitative evaluation using Peak Signal-to-Noise
Ratio (PSNR) and Structural Similarity Index (SSIM).

1. Overview of Filtering Techniques

1.1 Spatial Domain Filtering

• Low-Pass Filter (LPF): Smooths/blurs images by attenuating high frequencies (noise


reduction).

• High-Pass Filter (HPF): Sharpens images by enhancing edges (detail extraction).

1.2 Frequency Domain Filtering (Fourier Transform)

• LPF: Blocks high-frequency components (ideal, Butterworth, Gaussian).

• HPF: Blocks low-frequency components (edge enhancement).

2. Methodology for Evaluation

2.1 Test Setup

1. Input Image: Standard test image (e.g., Lena, Cameraman).

2. Filters Applied:

o Spatial Domain:

▪ LPF: Gaussian blur (3×3, 5×5 kernels)

▪ HPF: Laplacian, Sobel, Prewitt operators

o Frequency Domain:

▪ LPF: Ideal/Gaussian low-pass filter (cutoff = 30/60)

▪ HPF: Ideal/Gaussian high-pass filter (cutoff = 30/60)

3. Metrics:

o PSNR: Measures noise suppression (higher = better).

o SSIM: Measures structural preservation (closer to 1 = better).


3. Quantitative Results (Example Table)

PSNR
Filter Type Domain Parameters SSIM Visual Effect
(dB)

No Filter - - ∞ 1.0 Original image

Kernel=3×3,
Gaussian Blur Spatial 28.4 0.92 Mild smoothing
σ=1

Kernel=5×5,
Gaussian Blur Spatial 25.1 0.85 Strong blurring
σ=2

Edge enhancement +
Laplacian HPF Spatial Kernel=3×3 19.8 0.75
noise

Ideal LPF Frequency Cutoff=30 24.7 0.88 Moderate blurring

Sharp edges +
Ideal HPF Frequency Cutoff=30 18.3 0.68
amplified noise

Butterworth Cutoff=60,
Frequency 27.5 0.94 Balanced smoothing
LPF n=2

Butterworth Cutoff=60,
Frequency 20.1 0.78 Enhanced details
HPF n=2

4. Key Observations

1. Low-Pass Filters (LPF):

o Spatial domain: Larger kernels increase blurring (↓ PSNR, ↓ SSIM).

o Frequency domain: Butterworth preserves edges better than ideal LPF


(higher SSIM).
2. High-Pass Filters (HPF):

o Spatial domain: Laplacian increases noise (low PSNR).

o Frequency domain: Butterworth HPF gives better detail enhancement than


ideal HPF.

3. Domain Comparison:

o Frequency-domain filters provide more control over cutoff frequencies.

o Spatial-domain filters are computationally faster but less precise.


THANK YOU

You might also like