0% found this document useful (0 votes)
48 views179 pages

Unit 1

The document provides an overview of image processing and computer vision, detailing key concepts, techniques, and applications. It covers steps in image processing such as acquisition, preprocessing, segmentation, and feature extraction, along with various types of noise and filtering techniques. Additionally, it highlights the differences between image processing and computer vision, emphasizing their roles in enhancing and interpreting images for various industries.

Uploaded by

lunnigel
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)
48 views179 pages

Unit 1

The document provides an overview of image processing and computer vision, detailing key concepts, techniques, and applications. It covers steps in image processing such as acquisition, preprocessing, segmentation, and feature extraction, along with various types of noise and filtering techniques. Additionally, it highlights the differences between image processing and computer vision, emphasizing their roles in enhancing and interpreting images for various industries.

Uploaded by

lunnigel
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/ 179

INT345: COMPUTER VISION

UNIT-1
Lecture-1
Image Processing
Fundamentals of Image Processing
• Definition:
• a field of computer science and engineering
• focused on analyzing, enhancing, compressing, and
transforming images.
• Techniques:
• utilizes computational methods to manipulate images
in digital or analog formats.
Fundamentals of Image Processing
• Key Objectives:
• Enhance image quality.
• Compress images to reduce file size.
• Analyze images for extracting meaningful
information.
• Transform images for specific purposes or
formats.
Fundamentals of Image Processing
Fundamentals of Image Processing
•Applications:
•Object detection.
•Medical diagnosis and imaging.
•Satellite imagery analysis.
•Entertainment and multimedia.
•Goal:
•Improve image quality.
•Prepare images for specific tasks or applications.
Introduction to Image Processing
• Image processing is the manipulation of images
• It helps to achieve desired results such as :
• Enhancement
• restoration,
• or feature extraction.
Introduction to Image Processing
Steps in Image Processing:
Steps in Image Processing:
• Image Acquisition: Capturing images through
devices like cameras.
• Preprocessing: Enhancing image quality by :
• noise removal,
• contrast adjustment,
• or resizing.
• Segmentation: Dividing the image into regions
or objects.
Steps in Image Processing:
• Feature Extraction: Identifying and extracting
meaningful features,
• such as edges
• or shapes.
• Image Analysis: Interpreting the processed
image for a specific task,
• like detecting patterns.
Lecture-2
Image Processing
Image Preprocessing
Image Segmentation
Feature Extraction
Applications of Image Processing
Applications of Image Processing
• Medical Imaging: MRI and X-Ray diagnostics.
• Entertainment: Film restoration and special effects.
• Surveillance: Real-time monitoring systems.
• Retail: barcode scanning
Lecture-3
Introduction to Computer
Vision
Understanding Computer Vision
- Extracting meaningful information from images and videos.
- Integrates with AI and Machine Learning.
- Steps:
- Preprocessing: Noise removal, filtering.
- Feature Extraction: Edges, shapes, patterns.
- Analysis: Object detection, recognition.
Computer Vision
Real-World Impact
Autonomous Vehicles: Lane detection, pedestrian recognition.
Healthcare: Tumor detection in radiology.
Augmented Reality: Real-time environment overlays.
Retail: Smart checkout systems.
*Endless possibilities in transforming industries.*
Optical character recognition (OCR)
Technology to convert scanned docs to text
• If you have a scanner, it probably came with OCR
software

Digit recognition, AT&T labs License plate readers


http://www.research.att.com/~yann/ http://en.wikipedia.org/wiki/Automatic_number_plate_recognition
Face detection

• Many new digital cameras now detect


faces
– Canon, Sony, Fuji, …
Smile detection

Sony Cyber-shot® T70 Digital Still Camera


Object recognition (in supermarkets)

LaneHawk by EvolutionRobotics
“A smart camera is flush-mounted in the checkout lane, continuously
watching for items. When an item is detected and recognized, the
cashier verifies the quantity of items that were found under the basket,
and continues to close the transaction. The item can remain under the
basket, and with LaneHawk,you are assured to get paid for it… “
Vision-based biometrics

“How the Afghan Girl was Identified by Her Iris Patterns” Read the story
wikipedia
Login without a password…

Face recognition systems now


Fingerprint scanners on
beginning to appear more widely
many new laptops, http://www.sensiblevision.com/
other devices
Object recognition (in mobile phones)

Point & Find, Nokia


Google Goggles
Special effects: shape capture

The Matrix movies, ESC Entertainment, XYZRGB, NRC


Special effects: motion capture

Pirates of the Carribean, Industrial Light and Magic


Sports

Sportvision first down line


Nice explanation on www.howstuffworks.com

http://www.sportvision.com/video.html
Smart cars Slide content courtesy of Amnon Shashua

• Mobileye
– Vision systems currently in high-end BMW, GM,
Volvo models
– By 2010: 70% of car manufacturers.
Google cars

http://www.nytimes.com/2010/10/10/science/10google.html?ref=artificialintelligence
Interactive Games: Kinect
• Object Recognition:
http://www.youtube.com/watch?feature=iv&v=fQ59dXOo63
o
• Mario: http://www.youtube.com/watch?v=8CTJL5lUjHg
• 3D: http://www.youtube.com/watch?v=7QrnwoO1-8A
• Robot: http://www.youtube.com/watch?v=w8BmgtMKFbY
Industrial robots

Vision-guided robots position nut runners on wheels


Medical imaging

Image guided surgery


3D imaging
Grimson et al., MIT
MRI, CT
Differences Between Image Processing and
Computer Vision
Aspect Image Processing Computer Vision
Enable machines to
Enhance or transform
Goal interpret and understand
images.
images.
Involves higher-level
Deals with pixel-level
Focus understanding of image
manipulations.
content.
Object detection, facial
Noise removal, image
Examples recognition, autonomous
sharpening, compression.
driving.

Modified or enhanced Information or decision


Output
image. based on image analysis.
Lecture-4
Image Format, Spatial
Domain and Frequency
Domain
IP vs CV vs CG vs AI
Common Image File Formats
• JPEG: Compressed, widely used, lossy format.
• PNG: Supports transparency, lossless compression.
• BMP: Uncompressed, high-quality images.
• GIF: Animation and limited colors.

*Choosing the right format impacts quality and storage.*


How Colors Are Represented Digitally
• RGB (Red, Green, Blue): Additive model for screens.
• CMYK (Cyan, Magenta, Yellow, Black): Subtractive model for
printing.
• HSV (Hue, Saturation, Value): Human-perceptive model.
• Grayscale: Single intensity value per pixel.
Image Representation
• We can capture a picture using the sensors :
• such as a camera.
• It produce an image in the form of an analog
signal,
• then digitized to produce a digital image.
Image Representation
• Image is a two-dimensional f(x,y) function
• where x and y indicate the position in an
image.
• Which is called pixel or picture element.
• It holds a discrete value
• Called intensity value or pixel value.
Sampling and Quantization
• A digital image consists of coordinates.
• Additionally, it contains the function’s
amplitude.
• Quantization refers to digitizing the
amplitudes
• sampling refers to digitizing the coordinate
values.
Sampling and Quantization
• The sensors placed in the image acquisition
device
• capture the projected continuous image.
• Later, this digitizes to form a digital image
• Which is suitable for real-time applications.
Sampling and Quantization
Three types of images
• binary images (0 or 1)
• grayscale images (0 to 255)
• and color images.(0 to 255)

• Color images contain three channels red, green,


and blue.
Three types of images
Spatial Domain
• It is a fundamental approach in image analysis.
• Used to enhance and modify visual information.
• Operations applied directly on pixels of an
image.
• Pixel's intensity (grayscale) or color value
(RGB)
• Corresponds to its spatial location in the 2D
image grid.
Spatial Domain
Spatial Domain for RGB Image
• It is represented as a 3D vector of 2D
matrices.
• Each 2D matrix contains the intensities for a
single color
Spatial Domain for RGB Image
Frequency Domain
• used to analyze the frequency of an image.
• frequency is the rate of change of pixel
values.
Frequency Domain
• Low frequencies correspond to:
• slow intensity variations,
• representing the smooth,
• large-scale features (e.g., background).
• High frequencies correspond to:
• rapid intensity changes,
• representing edges and fine details.
Frequency Domain
Convert color image to grayscale image
Lecture-5
Noise Removal and
Filtering in Image
Processing
Noise Removal and Filtering in Image
Processing
• What is Image Noise?
• Image noise is an -
• unwanted random variation in pixel values
• It is often degrading the quality of an image.
• It usually occur during-
• image acquisition,
• transmission,
• or storage.
Noise Removal and Filtering in Image
Processing
Types of Image Noise
• Salt and pepper noise
• Gaussian noise
• Speckle noise
Types of Image Noise
Salt and Pepper noise
• It is a type of image distortion
• Randomly, pixels are replaced with extreme
values.
• For example, in grayscale images:
• either black (0)
• or white (255)
• This noise appears as scattered black and
white dots.
Salt and Pepper noise
• Key Features:
• Cause: Typically results from-
• transmission errors,
• sensor faults,
• or bit errors during image acquisition.
• Appearance:
• "Salt" refers to white pixels.
• "Pepper" refers to black pixels.
• The noise is sparse and abrupt,
• affecting only a small portion of the pixels.
Salt and Pepper noise
Salt and Pepper noise
• Example:
• If a 5x5 region of an image looks like this:

• 255 value represents salt


• and 0 represents pepper noise.
salt-and-pepper noise
Link
• https://colab.research.google.com/drive/1HHhMf0
NeATJAf6KNmB1nAFyYMYRxxSps#scrollTo=3v5zyjXuXt6
V
Gaussian Noise
• It’s a random variation in pixel.
• Also known as normal distribution,
• Most noise values clustered around mean.
• Noise gives speckled appearance in image.
Gaussian Noise
• Example:
• In a grayscale image,
• if the true pixel value is 10,
• Gaussian noise might alter it to 102,98,101
etc.,
• depending on the distribution.
Gaussian Noise
• Key Features:
• Due to electronic fluctuations during image
capture
• evenly distributed which makes the image
grainy.
Gaussian noise
• Gaussian noise, also known as normal noise,
• It has two parameters:
• mean (μ) and standard deviation (σ).
• Both ensure noise properties and how it affects
the image.
Mean (μ)

• Represents the average value of noise added.


• A mean = 0 ensures noise is balanced.
• It does not systematically lighten or darken the image.

• Why It Matters:

• If μ>0, the noise will increase the overall brightness


• If μ<0, the noise will darken the image.
Standard Deviation (σ)
• Represents the spread or intensity of the
noise.
• Controls the pixel values deviate from their
original values.
• A larger σ results in stronger noise,
• while a smaller σ produces mild noise.
Gaussian Noise
Lecture-5

Speckle Noise
Speckle Noise
• Speckle noise appears as grainy dots,
• It reduce the image's overall clarity.
• It is multiplicative rather than additive,

• Effects:
• Reduces contrast affects the interpretability.
• Impacts medical imaging,
• remote sensing,
• and scientific measurements.
Examples:
• Ultrasound Imaging:
• Arises from the interference of reflected sound
waves,
• making it difficult to identify accurately.
• Radar Imaging:
• Appears as grainy textures,
• reducing the clarity of land or ocean surfaces.
• Astronomy:
• Interferes with detecting fine details in space
imaging.
Example
Ex-2
Lecture-6
Filtering Techniques
Filtering Techniques
• Filters are used to manipulate the image.
• It is a image processing technique such as:
• Linear Filtering
• Non-Linear Filtering
Linear Filtering
• Linear filtering computes the output pixel
value as a
• weighted sum of its neighbors using a kernel.
• Smoothing (Low-pass Filtering):
• Sharpening (High-pass Filtering):
Linear Filtering
• Smoothing (Low-pass Filtering):
• Reduces noise and blurs the image.
• Common filters:
• Mean filter: Averages the neighborhood pixel values.
• Gaussian filter: Uses a Gaussian kernel for smooth blurring.
Linear Filtering
• Sharpening (High-pass Filtering):
• Enhances edges and fine details in the image.
• Common Filters:
-Laplacian filter
-Sobel Filter
Mean Filter
• Smooths image by averaging pixel values.
• Reduces noise by blurring sharp edges.
• Uses a kernel to modify pixels.
• Neighborhood pixels are used for calculation.
• Commonly applied to remove random noise.
• Works best for Gaussian noise removal.
Mean Filter
Mean Filter
Mean Filter
Mean Filter
Mean Filter
output
Lecture-7
Gaussian Filter
Gaussian Filter
• Uses Gaussian distribution for pixel weighting.
• Applies a smoothing effect on images.
• Preserves edges while reducing high-frequency
noise.
• Kernel values are based on Gaussian function.
• Blurs images more as sigma increases.
• Frequently used for image noise reduction.
Gaussian Filter
Gaussian Filter

• Filtered Value=(0.0751×10)+(0.1238×100)+(0.0751
×10)+(0.1238×100)+(0.2042×150)+(0.1238×100)+(0.
0751×10)+(0.1238×100)+(0.0751×10)
• =(0.751)+(12.38)+(0.751)+(12.38)+(30.63)+(12.38
)+(0.751)+(12.38)+(0.751) =81.383
Gaussian Filter
• The filtered value at pixel (1,1) is
approximately 81.38,
• which is a significant reduction from 150.
Gaussian Filter
output
Laplacian Filtering
• Detects edges by measuring intensity
variations.
• Uses second derivative for image sharpening.
• Highlights regions with rapid intensity
changes.
• Kernel contains positive and negative
coefficients.
• Often applied with Gaussian smoothing
beforehand.
• requires pre-smoothing step.
Laplacian Filtering
Laplacian Filtering

•Filtered Value=(0×10)+(−1×20)+(0×30)+(−1×40)+(4×50)+
(−1×60)+(0×70)+(−1×80)+(0×90)
•Filtered Value=(0)+(−20)+(0)+(−40)+(200)+(−60)+(0)+(
−80)+(0)
•Filtered Value=0
Laplacian Filtering
Sobel Filter
• It emphasize high-frequency components,
-such as edges and fine details,
-while suppressing low-frequency components (like
smooth regions).
Sobel Filter
• Gradient: Measures intensity change at pixels.
• Edge-detection: Highlights image transitions
and boundaries.
• Directional: Detects edges in horizontal and
vertical directions.
• Kernel: Uses convolution with Sobel matrices.
• Magnitude: Combines gradients for overall edge
strength.
• Applications: Used in edge-based image
segmentation.
Code
Lecture-8
Non-Linear Filtering
Non-linear Filtering
• NLF modifies pixel values based on:
• ranks,
• medians,
• or non-linear computations within a
neighborhood.
Non-linear Filtering
• Median Filter
• Max filter
• Min filter
• Bilateral Filter
Median Filter
• Replaces pixel with neighborhood's median
value.
• Effective for removing (salt-and-pepper) noise.
• Preserves edges better than mean filter.
• Non-linear filter, uses sorting for
computation.
• Window size determines smoothing and details.
• Used widely in image noise reduction.
Median Filter
Median Filter
• Reduces impulse noise by replacing pixel value
(200)
• with the median of surrounding values.
• This approach preserves edges
• while removing noise like salt-and-pepper.
Median Filter
output
Max Filter
• Replaces the value of a pixel
• with the maximum value within its neighborhood.
• Goal:
• Removes dark noise
• or small dark artifacts (pepper noise).
• Smoothens dark regions.
Max Filter
• Effect:
• It brightens the image by enhancing bright
details
• while suppressing darker regions.
• Applications:
• Pepper noise removal.
• Highlighting bright features in images
Max Filter
Max Filter
Code
Min Filter
• Replaces the value of a pixel.
• with minimum value within its neighborhood.
• Goal:
• Removes bright noise
• or small bright artifacts (salt noise).
• Smoothens bright regions.
Min Filter
• Effect: It darkens the image
-by suppressing bright details
-while preserving the darker regions.
• Applications:
• Salt noise removal.
• Enhancing dark features in images.
Min Filter
Code
Bilateral Filter
• Smooths an image while preserving edges.
• Unlike linear filters blur both edges/uniform
regions,
• uses spatial distance and pixel intensity
-to smooth only regions
-that are spatially close and have similar intensity,
-making it ideal for edge-preserving smoothing.
Code
Lecture-9
Image Enhancement
Histogram Equalization

• Powerful method to enhance image contrast.


• While it significantly improve visibility in
some cases,
• it may also introduce artifacts/over-enhance.
• Therefore, it’s important to use it
appropriately
• depending on the characteristics of image
• and the desired enhancement.
Histogram Equalization

• Enhances contrast: Spreads intensity levels


evenly.
• Improves visibility: Reveals hidden image
details.
• Global enhancement: Applies to entire image.
• Histogram: Frequency distribution of pixel
intensities.
• Cumulative Distribution Function: Maps pixel
values to new intensities.
• Drawback: May cause unnatural artifacts in
regions.
Steps in Histogram Equalization:
• Compute the histogram of the image.
• Calculate the cumulative distribution function
(CDF).
• Normalize the CDF to map intensity values
-to full range (0 to 255 for 8-bit images).
• Map the original pixel values
-to new values(0 and 255) using the normalized CDF.
• Apply transformation to obtain equalized image.
How Histogram Equalization Works:
Histogram Calculation:
• first step is to calculate histogram of the image.
• The histogram represents
-the frequency of each intensity level in image.
How Histogram Equalization Works:
• Cumulative Distribution Function (CDF):
• The CDF is computed from the histogram.
• It gives cumulative sum of the histogram values.
• This step is essential because
-it will be used to map the original pixel intensities
-to the new enhanced values.
How Histogram Equalization Works:
• Transformation:
• The pixel values are then mapped
-to new values using the CDF.
• This results in a more even distribution
-of intensities across the image.
How Histogram Equalization Works:
• Result:
• After the transformation,
• the new image should have a
-broader range of intensity values,
• improving the contrast
• and making hidden details more visible.
Numerical Formula for Histogram:
• For a grayscale image,
• the histogram is essentially a function H(x)
• that represents the frequency of pixel intensity
values
H(x)=Number of pixels with intensity x
• Where x is the pixel intensity value
• and H(x) is the corresponding frequency.
Example
Step-by-Step Calculation of Histogram:
Example
Visual Representation
• To better understand the histogram, we can
visualize it.
• On x-axis: The intensity values (from 0 to
255).
• On y-axis: The frequency of each intensity
value.
• You'll see bars at intensity levels-
-0, 50, 100, 150, 200, and 255 with heights
-corresponding to the frequency counts.
Calculate Histrogram
Code
Contrast enhancement
• Process to improve visual quality of image
-by increasing difference between pixel intensity
values.
• useful when an image has low contrast,
• meaning that the pixel intensity values are
-closely packed together
and there isn’t much difference between dark and light
regions.
Why Contrast Enhancement is Important:

• Low-Contrast Images:
• images captured in low-light/poor dynamic range
-may not show important details.
• Improved Visibility:
• makes bright and dark regions more visible,
• leading to better interpretation and analysis.
• Application: medical imaging, satellite
imagery, security footage.
Methods of Contrast Enhancement:

• Histogram Equalization
• Contrast Stretching (Linear Contrast
Stretching):
• Gamma Correction
• Adaptive Histogram Equalization (AHE)
• Contrast Limited Adaptive Histogram
Equalization (CLAHE)
Contrast Stretching
• Contrast stretching (also called Min-Max
Normalization).
• Method to enhance image contrast
-by scaling pixel intensities to wider range (usually
0 to 255).
• It improves the visibility in images
-that appear too dark or too bright.
Contrast Stretching
Example
Gamma Correction
• Gamma Correction is a non-linear transformation
• It adjusts the brightness of an image.
• It is used to correct illumination variations
• Also, enhance details in images
• that appear too dark or too bright.
Gamma Correction
Adaptive Histogram Equalization (AHE)

• This technique used to enhance contrast in an


image.
• Unlike standard Histogram Equalization,
• which operates on the entire image,
• AHE enhances contrast locally
• by dividing the image into smaller regions (tiles)
• and applying histogram equalization to each region
separately.
How AHE Works:
• The image is divided into small tiles (e.g.,
8×8 or 16×16 regions).
• Histogram Equalization is applied individually
to each tile.
• Interpolation is used to reduce artificial
boundaries between tiles.
• Enhances local contrast, highlighting details
in dark/light areas.
Limitations of AHE
• Amplifies noise in uniform regions.
• Causes over-enhancement in some cases.
Solution: Contrast Limited AHE (CLAHE)
• CLAHE (Contrast Limited Adaptive Histogram
Equalization)
• It prevents over-amplification by setting a
clip limit.
Example
Conclusion
• Local Contrast is Enhanced
• Dark regions become brighter,
• and bright regions are preserved.
• Noise can Increase
• This is why CLAHE (Contrast Limited AHE) is often
used
• to prevent over-enhancement.
CLAHE (Contrast Limited Adaptive Histogram
Equalization)
• It prevents over-enhancement by
• limiting the Contrast Clip Limit
• in local histogram equalization.
• Enhances details in X-rays, MRI, CT scans.
• Improves visibility in dark images.
• Enhances contrast in satellite photos.
How CLAHE Works
• Divide the Image into Small Tiles –
• Typically, 8×8 or 16×16 regions.
• Compute Local Histogram for Each Tile.
• Apply Histogram Equalization with a Clip Limit:
• If a pixel intensity occurs too frequently
• (beyond the clip limit), the excess is
redistributed.
Example
Step 4: Apply Histogram Equalization with Clipping
• Standard AHE enhances contrast
• but may cause over-enhancement.
• CLAHE applies a Clip Limit (e.g., Clip Limit = 2)
• to limit the amplification of certain intensity levels.
• Clipping Process:
• Set a Clip Limit: Let’s set Clip Limit = 2,
• meaning no intensity can appear more than 2 times.
• Clip Excess Pixels:
• If an intensity appears more than Clip Limit,
• excess counts are redistributed across other
bins.
• Apply CDF-Based Transformation:
• Compute Cumulative Distribution Function (CDF).
• Map pixel values using:
Thank You
(Next Unit 2)

You might also like