Unit_3 Computer vision artificial intelligence.pdf

23pds020 2 views 41 slides Aug 31, 2025
Slide 1
Slide 1 of 41
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41

About This Presentation

Unit of AI


Slide Content

UNIT-3

Edge detection
▶The process which involves detecting sharp edges in the image
and producing a binary image as the output.
▶Rapid change in image intensity

Sobel Edge filter
▶Computes approxmiation of the gradient of an image intensity
function.
▶Depends on first order derviatives.
Demerits:Not accurate results and discontinuity

Laplacian Filter
▶The 2D images, the derivative is taken in both dimensions.
▶Second derivative operator.
▶Detects regions of rapid intensity change.

2
f(x,y) =

2
f
∂x
2
+

2
f
∂y
2
Note
Very sensitive to noise

Gaussian Blur
▶Definition:Gaussian Blur is a low-pass filter that reduces
noise and detail using a Gaussian (bell curve) function.
▶Steps:
1.
2.
3.
4.
▶Effect:Center pixels get higher weight, surrounding pixels
contribute less⇒smooth and blurred image.
Example Flow:
Image Patch
Kernel
−−−−→Multiply + Sum−→Blurred Pixel

Canny edge detection
Definition
A multi-stage process designed to find a wide range of edges while
being robust to noise. The algorithm produces thin, continuous
edges by following a series of steps.

Algorithm Overview
1.Step 1:Noise Reduction (Gaussian Blur)
2.Step 2:Gradient Calculation (via Sobel filters)
3.Step 3:Non-Maximum Suppression (edge thinning)
4.Step 4:Double Thresholding (classifying strong vs weak
edges)
5.Step 5:Edge Tracking by Hysteresis (connecting edges)

Canny Step 1: Noise Reduction
▶Smooth the image to avoid false edges from noise.
▶Use a Gaussian blur (low-pass filter) on the input image.
▶Heavier blur (largerσ) removes more noise but risks losing
fine edges.
▶Output: a denoised image suitable for gradient calculation.

Canny Step 2: Finding Intensity Gradients
▶Compute horizontal and vertical derivatives on the smoothed
image (e.g., Sobel filters) to getGx,Gy.
▶Gradient magnitude:
G=
q
G
2
x+G
2
y
▶Gradient direction (angle):
θ= atan2(Gy,Gx)
▶(Often) Quantizeθto 0

,45

,90

,135

for the next step.

Canny Step 3: Non-Maximum Suppression
▶Goal: thin thick/blurred edges to single-pixel width.
▶For each pixel, look along the gradient directionθ.
▶Keep the pixel only if its magnitudeGis a local maximum vs.
the two neighbors alongθ.
▶Otherwise suppress (set to zero)⇒thin, well-localized edges.

Canny Step 4: Double Thresholding
▶Choose two thresholds:Thigh>Tlow.
▶IfG≥Thigh⇒strong edge.
▶IfG<Tlow⇒non-edge(suppress).
▶IfTlow≤G<Thigh⇒weak edge(candidate; decided next).
▶Common practice:Thigh:Tlowratio around 2:1 or 3:1 (tune
per image).

Canny Step 5: Edge Tracking by Hysteresis
▶Traverse weak edges and keep only those connected
(8-connectivity) to any strong edge.
▶Discard isolated weak edges (likely noise).
▶Result: clean, continuous edge map with gaps filled and false
edges removed.

Laplacian of Gaussian (LoG) Edge Detection
▶Idea:Combine Gaussian smoothing (noise reduction) with
Laplacian (second derivative) for robust edge detection.
▶Steps:
1.
2.
3. zero-crossingsof the LoG output.
▶LoG Kernel:A single “Mexican Hat” shaped filter that
merges both steps.
▶Key Concept:
▶Zero Crossings⇒Edge locations.
▶Scale (σ):Smallσfinds fine edges; largeσfinds coarse edges.
Result:More reliable edges, less sensitive to noise compared to
plain Laplacian.

Difference of Gaussians (DoG)
▶Idea:Efficient approximation of the Laplacian of Gaussian
(LoG).
▶Steps:
1. σ:
▶Smallσ1: retains details (light blur).
▶Largeσ2: smooths details (heavy blur).
2.
▶Mathematical Formulation:
D(x,y) =
Γ
Gσ1
(x,y)∗I(x,y)


Γ
Gσ2
(x,y)∗I(x,y)

▶Effect:Acts as aband-pass filter— enhances edges and
fine details while suppressing noise and background.
Result:Fast, simple edge detector widely used in feature
extraction (e.g., SIFT).

Hough Transform: Definition & Motivation
▶Definition:A feature extraction technique to detect shapes
(e.g., lines) by mapping points from image space (x,y) into
parameter space (ρ, θ).
▶Why not Cartesian form?
▶Line in Cartesian:y=mx+b→fails for vertical lines
(m→ ∞).
▶Solution: Use polar representation:
ρ=xcosθ+ysinθ
▶Every line is uniquely represented by (ρ, θ).
xy(x,y)θρCurve in (ρ, θ)Transform

Hough Transform: Steps
1.Pre-processing with Edge Detection:
▶Input: Binary edge map (e.g., from Canny detector).
▶Reduces data to only potential edge pixels.
2.Creating the Accumulator Array:
▶Define 2D array indexed by quantizedρ(rows) andθ
(columns).
▶Initialize all cells to zero.
▶Array resolution controls precision of detected lines.

Hough Transform: Steps
3.Voting on Parameters:
▶For each edge pixel (x,y), loop overθ.
▶Computeρ=xcosθ+ysinθ.
▶Increment accumulator at (ρ, θ).
4.Finding Peaks:
▶Identify accumulator cells with highest votes.
▶Peaks correspond to strongest candidate lines.
5.Extracting Lines:
▶Apply threshold to keep significant peaks.
▶Map (ρ, θ) back to original image to draw lines.

Algorithm 1Hough Voting
1:procedureHough Voting(X,Θ)
2:X: data Θ: Quantized parameterθmin, . . . , θmax
3:A: accumulator array, initially zero
4:for(x,y)∈Xdo
5: forθ∈Θdo
6: ρ=xcosθ+ysinθ
7: ▷for each set of model parameters consistent with
a sample, incrementA
8: A[θ, ρ] =A[θ, ρ] + 1
9: end for
10:end for
11:Non-maximum Suppression: detect local maxima inA
12:end procedure

Harris Corner Detector
The Harris corner detector identifies corners by examining a small
patch around each pixel and checking if intensity changes in all
directions.
Harris Corner Detector Steps
1.Calculate Gradients:ComputeIx,Iy(e.g., Sobel operator).
These measure rate of intensity change.
2.Form Harris Matrix (Structure Tensor):
M=
X
x,y
w(x,y)
ˇ
I
2
xIxIy
IxIyI
2
y
˘
wherew(x,y) is a weighting function (often Gaussian).

Harris Corner Detector Steps
3.Compute Corner Response:
R= det(M)−k·(trace(M))
2
=λ1λ2−k·(λ1+λ2)
2
Ris large and positive at corners.k∈[0.04,0.06].
4.Thresholding & Non-Maximum Suppression:Apply
threshold toRto select strong responses, then use
non-maximum suppression to keep only local maxima as
corners.

Hessian-Affine Detector
▶Definition:Local invariant feature detector based on the
Hessian matrix of second-order image derivatives.
H(x,y) =
ˇ
IxxIxy
IxyIyy
˘
,det(H) =IxxIyy−I
2
xy
▶The basic ideas of detecting corners remain the same as the
Harris detector, the Hessian detector makes use of the Hessian
matrix and determinant, instead of second-moment matrix M
and corner response function R

Hessian-Affine Detector (Process Flow)
Input ImageCompute Gaussian DerivativesForm Hessian MatrixCompute Determinant of HessianFind Local Maxima across ScalesAffine Normalization (Elliptical→Circular)Detected Keypoints

Gabor Filter
▶Definition:Linear filter combining a Gaussian envelope with
a sinusoidal wave.
g(x,y) = exp
`

x
′2

2
y
′2

2
´
cos
`

x

λ

´
▶Parameters:Wavelength (λ), Orientation (θ), Phase (ψ),
Spread (σ), Aspect ratio (γ).
▶Idea:Acts as a band-pass filter sensitive to edges and
textures at specific orientations and frequencies.

Gabor Filter (Process Flow)
Input ImageDefine Gabor Kernel (λ, θ, σ, γ)Convolve Image with KernelRepeat for Multi-Scale and Multi-OrientationFiltered Feature Maps

Discrete Wavelet Transform
▶Definition:Multi-resolution image analysis using low-pass
(approximation) and high-pass (detail) filters.
▶2D Decomposition:
▶LL = Approximation (low frequency both directions)
▶LH = Horizontal details
▶HL = Vertical details
▶HH = Diagonal details
▶Applications:Image compression (JPEG2000), denoising,
texture classification.

DWT (Process Flow)
Input ImageApply 1D DWT on RowsApply 1D DWT on ColumnsObtain Sub-bands (LL, LH, HL, HH)Recursive Decomposition on LL (Multi-level)

Contour-based Segmentation: Definition
Definition:Contour-based segmentation separates an image into
regions by identifying and representing theirboundaries or
contours.
▶Finds closed curves separating foreground and background.
▶Effective when objects have sharp boundaries.
▶Used in shape recognition and measurement.

Contour-based Segmentation: Process (Flowchart)
Input ImagePreprocessing (Noise reduction, Grayscale)Edge Detection (Canny, Sobel)Contour Tracing (Connected Curves)Contour Representation (Chain code, Polygon, Snakes)Segmented Regions

Contour-based Segmentation: Applications
Applications:
▶Medical Imaging:Organ and tumor detection.
▶Object Tracking:Detecting moving objects in video.
▶Robotics:Object recognition and manipulation.
▶Quality Control:Shape-based product inspection.

Region-based Segmentation: Definition
Definition:Partitions an image intohomogeneous connected
regionsby grouping adjacent pixels with similar properties.
▶Directly identifies regions instead of boundaries.
▶Suitable when objects have uniform intensity or color.

Region-Based Segmentation Techniques
Region Growing (Bottom-Up)
▶Seed Selection:Start with one or more seed pixels inside
object of interest.
▶Growing:Iteratively add neighbors satisfying similarity
criterion (e.g., intensity range).
▶Stopping Condition:Stop when no more pixels can be
added.
Region Splitting (Top-Down)
▶Initialization:Treat entire image as one large region.
▶Splitting:Non-homogeneous regions are split into smaller
sub-regions.
▶Recursive Splitting:Continue until all regions are
homogeneous.

Region-Based Segmentation Techniques
Region Splitting & Merging (Hybrid)
▶Image is first split into regions (e.g., using quadtree).
▶Adjacent similar regions are merged.
▶Reduces over-segmentation compared to pure splitting.

Region-based Segmentation: Applications
Applications:
▶Medical Imaging:Tumor or organ segmentation.
▶Satellite Imagery:Land classification (water, forest, etc.).
▶Object Recognition:Isolating colored/textured objects.

Level Set Representation: Definition
Definition:Represents object boundaries implicitly as the
zero-level setof a functionϕ(x,y).
▶ϕ(x,y) = 0→Boundary.
▶ϕ(x,y)<0→Inside object.
▶ϕ(x,y)>0→Outside object.

Level Set Representation: Process (Flowchart)
Initializeϕ(x,y) (Signed Distance)Evolution using PDEsInternal Force(Smoothness, Curvature)External Force(Edges, Intensity)Update Level SetFinal Segmentation

Level Set Method: Steps
Process 1: Initialize Level Set Function
▶Give an Image data
▶Convert image domain into aSigned Distance Function
(SDF).
▶Definesϕ(x,y) with:
▶ϕ <0: inside the contour
▶ϕ >0: outside the contour
▶ϕ= 0: at the contour
Process 2: Evolution by PDE
▶Updateϕ(x,y) iteratively using PDE.
▶Forces:
▶Internal Force:smoothens contour (curvature).
▶External Force:attracts contour to object edges
(gradients/statistics).

Level Set Representation: Applications
Process 3: Segmentation Result
▶Iteration continues until contour stabilizes.
▶Output→Object boundary (segmented image).
Applications:
▶Medical Imaging:Heart ventricles, blood vessels.
▶Fluid Dynamics:Tracking fluid boundaries.
▶Object Tracking:Deforming or splitting objects.

Fourier Descriptors
Concept:Represent a shape’s boundary using the Discrete Fourier
Transform (DFT).
▶Shape boundary→1D signal of complex numbers:
▶Real part: x-coordinate
▶Imaginary part: y-coordinate
▶Apply DFT⇒transform from spatial domain to frequency
domain.
▶Fourier Descriptors:The complex coefficients obtained from
DFT.
Properties:
▶Low frequencies⇒Coarse/global shape.
▶High frequencies⇒Fine details/sharp corners.
▶Invariant to translation, scaling, and rotation.
▶Useful for shape recognition and matching.

Wavelet Descriptors
Concept:Represent a shape’s contour using Wavelet Transform.
▶Shape boundary→1D signal.
▶Apply Wavelet Transform⇒decomposes into scales and
positions.
▶Wavelet coefficients = Wavelet Descriptors.
Advantages:
▶Localized in both space and frequency.
▶Captures sharp corners/abrupt changes without altering entire
descriptor.
▶Providesmulti-resolutionrepresentation of shape.
▶More robust to local irregularities compared to Fourier
descriptors.

Multi-resolution Analysis (MRA)
Foundation of Wavelet Transform:Analyze signals at multiple
levels of detail.
▶Uses two functions:
▶Scaling Function:Low-pass filter, captures coarse
(low-frequency) info.
▶Wavelet Function:Band-pass filter, captures fine
(high-frequency) details.
▶Process:
▶Signal→Approximation + Detail.
▶Approximation is further decomposed recursively.
▶Forms a hierarchy of resolutions.
▶Enables perfect reconstruction from multi-resolution
components.
Connection:Wavelet descriptors are coefficients obtained via
MRA.

Comparison and Wrap-up
Fourier Descriptors:
▶Compact global representation of shape.
▶Excellent invariance (translation, scaling, rotation).
▶Sensitive to local boundary variations.
Wavelet Descriptors:
▶Multi-resolution, localized representation.
▶Captures both global shape and fine local irregularities.
▶More robust to local noise/abrupt changes.
Conclusion:Fourier→Best for global shape recognition.
Wavelets→Best for detailed/local analysis with multi-resolution.
Tags