Understanding Image Sampling and Processing
Understanding Image Sampling and Processing
What is Digital Image Processing? An image may be defined Introduction to Color Spaces Singular Value Decomposition Discrete Cosine Transform
Sampling is the process of converting an analog signal into as a two dimensional function, f(x,y), where x & y are spatial Color spaces are the mathematical representation of a set of colors. There The process of Singular Value Decomposition DCT Definition
are many color models. Some of them are RGB, CMYK, YIQ, HSV, and HLS,
discrete values. In layman's terms, we can say that sampling is (plane) Coordinates and the amplitude of f at any pair of etc. These color spaces are directly related to saturation and brightness. (SVD) involves breaking down a matrix A into the form The discrete cosine transform (DCT) represents an image as a
the process of recording an Coordinates (x, y) is called the intensity gray level of the image All of these color spaces can be derived using RGB information using . This computation allows us to retain sum of sinusoids of varying magnitudes and frequencies.
analog signal at regular intervals of time. A sampling function at that point. devices such as cameras and scanners. the important singular values that the image requires while The dct2 function computes the two-dimensional discrete
is applied to the analog signal that results in the sampled when x,y and the intensity valves of f are all finite, discrete RGB Color Space also releasing the values that are not as necessary in retaining cosine transform (DCT) of an image. The DCT has the property
signal. quantities we call the image digital image. The field of digital RGB stands for Red, Green, and Blue. This color space is widely used in the quality of the image. The singular values of an m × n that, for a typical image, most of the visually significant
computer graphics. RGB are the main colors from which many colors can
We get a finite number of samples of an analog signal. The image processing refers to Processing digital Images by means be made. matrix A are the square information about the image is concentrated in just a few
number of samples gives us the number of pixels. More of Digital Computer > Digital image is composed of a finite RGB can be represented in the 3-dimensional form: roots of the eigenvalues of the n × n matrix AT A, which are coefficients of the DCT. For this reason, the DCT is often used
samples will result in higher number of elements, each of which has a particular location typically organized by magnitude in decreasing order [4]. The in image compression applications. For example, the DCT is at
image quality of the digital image because of more pixels. and value. => These elements are called picture elements"/ Singular Value Decomposition is so named due to the singular the heart of the international standard lossy image
"image elements" and "pixels"! values that are identified and isolated from matrix A. compression algorithm known as JPEG. (The name comes
#pirel is the team used most widely to denote the elements How to Compute the SVD of a Matrix from the working group that developed the standard: the
of digital image. We will rewrite an m × n matrix A in the form Joint Photographic Experts Group.)
Image processing is a method of manipulating or altering an , where U is an m × m matrix The two-dimensional DCT of an M-by-N matrix A is defined as
image to achieve a desired result, typically for improving its orthonormal columns, Σ is an m × n matrix with singular follows.
visual quality or extracting useful information from it. It values on the main diagonal, and V is an n × n matrix with
involves a variety of techniques and algorithms to modify or orthonormal columns. V T is the transpose of matrix V, which The values Bpq are called the DCT coefficients of A. (Note that
analyze images, and it is a fundamental component of is found by exchanging the rows and the columns of the matrix indices in MATLAB® always start at 1 rather than 0;
computer vision, artificial intelligence, and many other fields. matrix. therefore, the MATLAB matrix
Applications of digital image processing: Note: If two column vectors form an orthonormal set, it elements A(1,1) and B(1,1) correspond to the mathematical
Automatic character recognition. means that the inner product of the columns with each other quantities A00 and B00, respectively.)
Below table is 100% RGB color bar contains values for 100% amplitude,
Military recognition. is 0, and the inner product of any column with itself is 1. The DCT is an invertible transform, and its inverse is given by
Automatic processing of fingerprints. Hence, any matrix B that has orthonormal columns has the
Screening of X-ray and blood samples. property BTB = I = BBT, where I is the identity matrix.
It is used in the study of pollution particles. Before we apply the SVD to image processing, we will first
It is used to restore blurred pictures of rare artifacts demonstrate the method using a small (2×3) matrix A:
(application in archaeology).
The sampled signal is then quantized to get the value of each Industrial machine vision for products assembly and
pixel. Let us look at how quantization is achieved. inspection.
What is Image Quantization? Machine processing of aerial and satellite imagery for weather 100% saturated, and for video test signal.
After sampling the analog signal, we will apply quantization. prediction. and then follow a step-by-step process to rewrite the matrix A
CMYK Color Model
Quantization digitizes the amplitude of the sampled signal. In astronomy, biology, nuclear medicine, law enforcement, CMYK stands for Cyan, Magenta, Yellow and Black. CMYK color model is in the separated form .
Quantization is done by rounding off the amplitude of each defence and industry, etc. used in electrostatic and ink-jet plotters which deposits the pigmentation Step 1: Form ATA
sample and then assigning a different value according to its Fundamental steps in Digital Image on paper. In these model, specified color is subtracted from the white light We begin by forming AT A for our given matrix A by
amplitude. Each value will represent a different color tone. Processing rather than adding blackness. It follows the Cartesian coordinate system performing basic matrix multiplication as follows:
These functions are called the basis functions of the DCT. The
DCT coefficients Bpq, then, can be regarded as
the weights applied to each basis function. For 8-by-8
matrices, the 64 basis functions are illustrated by this image.
The 64 Basis Functions of an 8-by-8 Matrix
•
f(x, y) is the input image, g(x, y) is the processed image, and T representation of the input. When the compressed based systems at high compression ratios) are not present in D(u,v)- the distance from the origin of the centered frequency
is an operator on f, defined over some neighborhood of (x, y). representation is presented to its complementary decoder, a wavelet reconstructions rectangle. With varying ISO Factor which varies with the capacity of
In addition, T can operate on a set of input images, such as reconstructed image is generated The choice of wavelet to use greatly affects the compression W- the width of the band camera to absorb light.
performing the pixel-by-pixel sum of K images for noise efficiency Do- the radial center of the frequency rectangle. Types of Image noise:
reduction. [Link] Band reject Filter: There are different types of image noise. They can typically be divided into
Spatial domain techniques can be subdivided into: 3 types.
• Point Operations (Intensity Transformations):
These operations involve applying the same
transformation to each pixel in a grayscale
image, based on its original pixel value and
independent of its location or neighboring
pixels. Learn more about Point Operation.
• Spatial Filters (or Mask, Kernel): The output Error-free compression Gaussian Band reject Filter:
value of these operations is dependent on the • Useful in application where no loss of information is
values of the function f(x,y) and its Mapper - transforms the image to a (non-visual) format tolerable. This maybe due to accuracy requirements, legal
neighborhood. Explore more on Spatial Filter. designed to reduce interpixel redundancies. The operation requirements, or less than perfect quality of original image.
Simple Intensity Transformations generally is reversible and may or may not reduce directly the • Compression can be achieved by removing coding and/or
1. Image Negatives: amount of data required to represent the image. In video interpixel redundancy. • Typical compression ratios
The negative of an image with gray levels in the range [0,L-1]is applications, the mapper uses previous video frames to achievable by lossless techniques is from 2 to 10.
Variable Length Coding 1. Gaussian Noise:
obtained by using the negative transformation shown in Fig. facilitate the removal of temporal redundancy. Gaussian Noise is a statistical noise having a probability density function
3.3, which is given by the expression • Quantizer - reduces psychovisual redundancies by -This is used to reduce coding redundancy. These filters are mostly used when the location of noise equal to normal distribution, also known as Gaussian Distribution. Random
s=L-1–r quantizing data deemed less important for visual -Coding redundancy is present in any image with a non- component in the frequency domain is known. Sinusoidal
uniform histogram (i.e. when all the graylevels are not equally Gaussian function is added to Image function to generate this noise. It is
interpretation (omitted for lossless compression) noise can be easily removed by using these kinds of filters also called as electronic noise because it arises in amplifiers or detectors.
• Symbol encoder - codes the data efficiently (typically using likely). because it shows two impulses that are mirror images of each
-Given an image with, say 256 graylevels, Source: thermal vibration of atoms and discrete nature of radiation of
some form of variablelength coding scheme) and aims to other about the origin. Of the frequency transform.
reduce coding redundancies. It generates a fixed or variable {a0,a1,,a255}={0,1,,255}. This is our set of source [Link] warm objects.
length code to represent the quantizer output and maps the each graylevel ak , we need its probability p(ak ) in the image.
output in accordance with the code. In many cases, a variable -This may be obtained from the image histogram: p(ak ) = nk
–length code is used. The shortest code words are assigned to /n, nk = # pixels with value ak , n = total # pixels.
the most frequently occurring quantizer output values- thus -To each graylevel ak , we need to assign a codeword (a binary
minimizing coding redundancy. • Future application string). Suppose lk is the length of codeword (= # bits
requirements may be unknown required to represent ak ) for symbol ak .
Thresholding. -Total number of bits required to represent the image is
In digital image processing, thresholding is the simplest
method of segmenting images. It plays a crucial role in image
processing as it allows for the segmentation and extraction of
important information from an image. By dividing an image Band pass Filter:
into distinct regions based on pixel intensity or pixel value, The function of a band pass filter is opposite to that of a band
thresholding helps distinguish objects or features of interest reject filter It allows a specific frequency band of the image to
from the background. This technique is widely used in various Naturally, we need an encoding scheme with Lavg as small as be passed and blocks the rest of frequencies. The transfer
Reversing the intensity levels of an image produces the applications such as object detection, image segmentation, possible. From Shannon’s theorem, we know that Lavg ≥ H(z). function of a band pass filter can be obtained from a
equivalent of a photographic negative. This type of processing and character recognition, enabling efficient analysis and As mentioned earlier, the Huffman procedure specifies a code corresponding band reject filter with transfer function
is particularly suited for enhancing white or gray detail interpretation of digital images. Additionally, image with H(z) ≤ Lavg < H(z) +1 Hbr(u,v) by using the equation
embedded in dark regions of an image, especially when the thresholding can enhance image quality by reducing noise and Bit-plane Coding Fig.4 Plot of Probability Distribution Function
black areas are dominant in size. improving overall visual clarity A grayscale image is decomposed into a series of binary The side image is a bell shaped probability distribution function which
2. Log Transformations: The general form of the log images and each binary image is compressed by some binary have mean 0 and standard deviation(sigma) 1.
transformation s = c log (1 + r) where c is a constant, and it is compression method. 2. Impulse Noise:
assumed that r ≥ 0. The shape of the log curve in Fig. 3 shows This removes coding and interpixel redundancy. These filters cannot be applied directly on an image because it Impulse Function: In the discrete world impulse function on a vale of 1 at a
that this transformation maps a narrow range of low gray- Bit-plane decomposition: may remove too much details of an image but these are single location and In continuous world impulse function is an idealised
level values in the input image into a wider range of output Given a grayscale image with 2m graylevels, each grayvalue effective in isolating the effect of an image of selected function having unit area.
levels. The opposite is true of higher values of input levels. We can be represented by m-bits, say (am−1,am−2, ,a1,a0). frequency bands.
would use a transformation of this type to expand the values The grayvalue r represented by (am−1,am−2, ,a1,a0) is given Notch Filters:
of dark pixels in an image while compressing the higher-level by the base 2 polynomial A notch filter rejects (or passes) frequencies in predefined
values. The opposite is true of the inverse log transformation. r = am−12m−1 + am−22m−2 + + a121 + a020 neighborhoods about a center frequency.
3. Power-Law Transformations Power-law transformations This bit representation can be used to decompose the Due to the symmetry of the Fourier transform notch filters
have the basic form s = c rγ grayscale image into m binary images (bit-planes). must appear in symmetric pairs about the origin. Fig.6 Impulse function in discrete world and continuous world
where c and γ are positive constants, Also can be represented Alternatively, one can use the m-bit Gray code (gm−1,gm−2, The transfer function of an ideal notch reject filter of radius 2.1 Types of Impulse Noise:
as ,g1,g0) to represent a given grayvalue. D0 with centers a (u0 ,v0) and by symmetry at (-u0 , v0) is There are three types of impulse noises. Salt Noise, Pepper Noise, Salt and
s = c (r+ε)γ Image Thresholding Techniques The Gray code (gm−1,gm−2, ,g1,g0) can be obtained from Pepper Noise.
An offset measurable when input is zero We see in Fig. 4 that These are widely used in various fields such as medical (am−1,am−2, ,a1,a0) by the following relationship: Salt Noise: Salt noise is added to an image by addition of random bright
curves generated with values of g>1 have exactly the opposite imaging, computer vision, and remote sensing. These gm−1 = am−1, and for 0 ≤ i ≤ m− 2, gi = ai ⊕ai+1 (with 255 pixel value) all over the image.
effect as those generated with values of g. techniques are essential for accurate image processing and where ⊕ denotes exclusive OR of bits. Pepper Noise: Salt noise is added to an image by addition of random dark
interpretation. They help to convert grayscale or color images The Gray code of successive graylevels differ at only one (with 0 pixel value) all over the image.
into binary images, separating the foreground from the position. Salt and Pepper Noise: Salt and Pepper noise is added to an image by
background, allowing for better segmentation and extraction → 01111111 (binary representation) 01000000 (Gray addition of both random bright (with 255 pixel value) and random dark
of features from an image, which is crucial for various code) (with 0 pixel value) all over the [Link] model is also known as data
applications in computer vision and pattern recognition. →10000000 (binary representation) 11000000 (Gray Ideal, butterworth, Gaussian notch filters drop noise because statistically it drop the original data values [5]. Source:
Global Thresholding code) Malfunctioning of camera’s sensor cell.
Global Thresholding is a widely used technique where a single 3. Poisson Noise:
threshold value is applied to an entire image. However, this The resulting binary images are then compressed (error-free). The appearance of this noise is seen due to the statistical nature of
technique may not be suitable for images with varying We will study a popular encoding scheme called run-length electromagnetic waves such as x-rays, visible lights and gamma rays. The x-
lighting conditions or complex backgrounds. To overcome this encoding (RLC). ray and gamma ray sources emitted number of photons per unit time.
limitation, adaptive thresholding techniques may be Transform Coding These rays are injected in patient’s body from its source, in medical x rays
employed, which adjust the threshold value locally based on In transform coding a linear transform is used to map the and gamma rays imaging systems. These sources are having random
the characteristics of each pixel's neighborhood. These image data into a set of transform coefficients (which are then fluctuation of photons. Result gathered image has spatial and temporal
techniques are particularly useful in scenarios where there is quantized and coded). For reasons of computational randomness. This noise is also called as quantum (photon) noise or shot
significant variation in illumination across different regions of complexity the image is subdivided into smaller subimages noise.
the image. before the transformation computation. The goal of the 4. Speckle Noise
-Simple thresholding is a basic technique that assigns a binary transformation process is to decorrelate (minimize the A fundamental problem in optical and digital holography is the presence of
value to each pixel based on a global threshold value. It is variance) the pixels of the subimages as much as possible. This speckle noise in the image reconstruction process. Speckle is a granular
effective when the image has consistent lighting conditions will result in a localization of the image information in a Inverse Filtering: noise that inherently exists in an image and degrades its quality. Speckle
Histogram Processing and a clear foreground-background separation. However, minimal number of transform coefficients - the The simplest approach to restoration is direct inverse filtering noise can be generated by multiplying random pixel values with different
when images contain varying lighting conditions or complex transformation coefficients with little data can then be more where we complete an estimate of the pixels of an image.
The histogram of a digital image with gray levels in the range backgrounds, adaptive thresholding techniques are more coarsely quantized or eliminated. The better information transform of the original image simply by dividing the Mean Filter in Image Processing
[0, L-1] is a discrete function h(rk)=nk, where rk is the k th gray suitable. These techniques dynamically adjust the threshold compaction, the better reconstruction approximations. transform of the degraded image G(u,v) by degradation Introduction
level and nk is the number of pixels in the image having gray value for each pixel based on its local neighborhood, allowing The following figure shows a typical block transform coding function H(u,v) Therefore, mean filter is one of the techniques which is used to reduce
level rk. Histograms are the basis for numerous spatial domain for better segmentation and accurate object detection. . system. The decoder noise of the images.
processing techniques. Histogram manipulation can be used Pros and Cons of Global Thresholding implements the inverse sequence of steps of the encoder, This is a local averaging operation and it is a one of the simplest linear
effectively for image enhancement. Histograms are simple to Gobal thresholding offers several advantages, including its which performs four relatively straightforward operations: filter. The value of each pixel is replaced by the average of all the values in
calculate in software and also lend themselves to economic simplicity and efficiency in determining a single threshold subimage decomposition, transformation, quantization, and the local neighborhood.
hardware implementations, thus making them a popular tool value for the entire image. It is particularly effective in coding. M x N input image is subdivided first into subimages of (a)Arithmetic Mean filter: It is the simplest mean filter. Let Sxy represents
for real-time image processing. The horizontal axis of each scenarios where the foreground and background regions have size n X n, which are then transformed to the set of coordinates in the sub image of size m*n centered at point (x,y).
histogram plot corresponds to gray level values, rk. The distinct intensity distributions. However, global thresholding We know that The arithmetic mean filter computes the average value of the corrupted
vertical axis corresponds to values of H(rk)=nk or p(rk)=nk/n if may not be suitable for images with complex intensity image g(x,y) in the area defined by Sxy. The value of the restored image f
the values are normalized. Thus, as indicated previously, these distributions or when there is significant variation in lighting at any point (x,y) is the arithmetic mean computed using the pixels in the
histogram plots are simply plots of h(rk)=nk versus rk or conditions across the image. Additionally, it may not region defined by Sxy.
p(rk)=nk/n versus rk. accurately segment objects or regions that have overlapping
Applications of Image Enhancement intensity values. Therefore
Deblurring Images: Helps to improve image clarity. Local (Adaptive) Thresholding
Contrast Adjustment: Enhances image detail visibility. Local thresholding addresses the limitations of global
Image Brightening: Increases the lightness of an image. thresholding by considering smaller regions within the image. Lossless predictive coding
Image Smoothing and Sharpening: It calculates a threshold value for each region based on its The following figure shows the basic components of lossless This operation can be using a convolution mask in which all coefficients
Smoothing filters help reduce and suppress image noise, with local characteristics, such as mean or median intensity. This predictive coding system. The system consist of an encoder have value 1/mn A mean filter smoothes local variations in image Noise is
common types including average smoothing, Gaussian approach allows for better adaptability to varying lighting and decoder, each containing an identical predictor. As reduced as a result of blurring. For every pixel in the image, the pixel value
smoothing, and adaptive smoothing. Discover more conditions and complex intensity distributions, resulting in successive samples of discrete time input signal, f(n), are From the above equation we observe that we cannot recover is replaced by the mean value of its neighboring pixels with a weight .This
about smoothing filters. more accurate segmentation of objects or regions with introduced to the encoder, the predictor generates the the undegraded image exactly because N(u,v) is a random will resulted in a smoothing effect in the image.
Sharpening filters enhance edges by eliminating blur. Find overlapping intensity values. However, local thresholding may anticipated value of each sample based on a specified number function whose Fourier transform is not known. One approach (b)Geometric Mean filter: An image restored using a geometric mean filter
more about sharpening filters. require more computational resources and can be sensitive to of past samples. The output of the predictor is then rounded to get around the zero or small-value problem is to limit the is given by the expression
Noise Removal: noise or uneven illumination within the image, which can to the nearest integer, The prediction error filter frequencies to values near the origin.
Noise can be introduced to images during capture, printing, or affect the overall performance of the segmentation algorithm. We know that H(0,0) is equal to the average values of h(x,y).
transmission. It can be identified in image processing by Mean and Gaussian Adaptive Thresholding By Limiting the analysis to frequencies near the origin we
intensity variance between neighboring pixels. Noise removal Two commonly used methods in image processing are Mean reduce the probability of encountering zero values.
techniques help decrease noise visibility by smoothing the and Gaussian Adaptive Thresholding. Mean adaptive Wiener filtering
image using linear or non-linear filters. 1 thresholding calculates the threshold value for each sub- The inverse filtering approach has poor performance. The
Grayscale Image Histogram Equalization: region by taking the average intensity of all pixels within that wiener filtering approach uses the degradation function and Here, each restored pixel is given by the product of the pixel in the sub
Histogram equalization refers to a transformation where an region. On the other hand, Gaussian adaptive statistical characteristics of noise into the restoration process. image window, raised to the power 1/mn. A geometric mean filters but it
output image has an approximately uniform distribution of thresholding uses a weighted average of pixel intensities, The objective is to find an estimate of the uncorrupted to loose image details in the process.
pixels at each gray level. Dive into the details about grayscale giving more importance to pixels closer to the center of the image f such that the mean square error between them is (c)Harmonic Mean filter: The harmonic mean filtering operation is given
image histogram equalization. sub-region. These methods are effective in enhancing image minimized. by the expression
quality and improving accuracy in tasks such as object The error measure is given by
detection or segmentation.
Need of Image Thresholding
Image thresholding is necessary to separate the object or the The decoder shown in second part of the figure reconstruct
area of interest from the background of an image. This e(n) from the received variable-length code words and The harmonic mean filter works well for salt noise but fails for pepper
technique helps in enhancing the features of a thresholding performs the inverse operation to decompress or recreate the Where E{.} is the expected value of the argument. noise. It does well with Gaussian noise also.
image and makes it easier to detect or recognize objects in an original input sequence. We assume that the noise and the image are uncorrelated (d)Order statistics filter: Order statistics filters are spatial filters whose
image. one or the other has zero mean. response is based on ordering the pixel contained in the image area
The gray levels in the estimate are a linear function of the encompassed by the filter. The response of the filter at any point is
It is also useful in thresholding image segmentation, which is levels in the degraded image. determined by the ranking result.
the process of dividing an image into multiple segments or (e)Median filter: It is the best order statistic filter; it replaces the value of a
regions with similar properties. Lossy predictive coding pixel by the median of gray levels in the Neighborhood of the pixel.
For example, in medical imaging, thresholding is used to In this lossy predictive coding, we add quantizer to the lossless
identify tumours or abnormal tissues in a scan. In industrial predictive coding model introduced earlier and examine the
inspection, it is used to detect defects in products or to check trade –off between reconstruction accuracy and compression
the quality of goods. performance within the context of spatial predictors.
In machine vision, thresholding is used to identify objects or As it shown in following figure the quantizer, which replaces The original of the pixel is included in the computation of the median of
obstacles in an image and to guide the movement of robots or the nearest integer function of the error-free encoder, is the filter are quite possible because for certain types of random noise, the
autonomous vehicles. inserted between the symbol encoder and the point at which provide excellent noise reduction capabilities with considerably less
Overall, thresholding in image processing is a crucial the prediction error is formed. It maps the prediction error blurring then smoothing filters of similar size. These are effective for
technique in image processing that has a wide range of into a limited range of outputs, denoted e(n) , which establish bipolar and unipolar impulse noise.
applications in various fields. the amount of compression and distortion that occurs. For a Max and Min filter:
Real-world applications lossy encoder’s predictor within the feedback loop, Using the l00th percentile of ranked set of numbers is called
Object Detection: By setting a threshold value, objects can be the max filter and is given by the equation
separated from the background, allowing for more accurate Where H(u,v)= degradation function
and efficient object detection. The second part of the figure shows the lossy decoder. H*(u,v)=complex conjugate of H(u,v)
Medical Images: Image thresholding can be used to segment | H(u,v)|2=H* (u,v) H(u,v)
different structures or abnormalities for diagnosis and analysis Sn(u,v)=|N(u,v)|2= power spectrum of the noise
in medical imaging. Sf(u,v)=|F(u,v)|2= power spectrum of the underrated image
Quality Control: Image thresholding plays a crucial role in The power spectrum of the under graded image is rarely It is used for finding the brightest point in an image. Pepper
quality control processes, such as inspecting manufactured known. An approach used frequently when these quantities noise in the image has very low values; it is reduced by max
products for defects or ensuring consistency in color and are not known or cannot be estimated then the expression filter using the max selection process in the sublimated area
texture of a color image. used is sky.
Object Segmentation: Image thresholding is also commonly The 0th percentile filter is min filter.
used in computer vision tasks such as object segmentation,
where it helps to separate foreground objects from the
background. This enables more accurate and efficient
detection of objects within an image.
Noise Reduction: Thresholding can be utilized for noise This filter is useful for flinging the darkest point in image. Also,
reduction, as it can help to eliminate unwanted artifacts or it reduces salt noise of the min operation.
disturbances in an image. Where K is a specified constant. Midpoint filter:
Edge Detection: Image thresholding aids in identifying and The midpoint filter simply computes the midpoint between
highlighting the boundaries between different objects or the maximum and minimum values in the area encompassed
regions within an image with edge detection algorithms. by