Lecture 3: Computer Vision & Image Processing - Basics & Distances, Study notes of Electrical and Electronics Engineering

Lecture 3 of dr. D. J. Jackson's electrical & computer engineering course on computer vision and digital image processing. Topics include basic image processing operations such as addition, subtraction, multiplication, and division of pixels, as well as distance measures like euclidean, d4, and d8 distances. The lectures explain the concepts and provide examples.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-id9-2
koofers-user-id9-2 🇺🇸

4.7

(3)

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Dr. D. J. Jackson Lecture 3-1Electrical & Computer Engineering
Computer Vision &
Digital Image Processing
Basic Image Processing Operations
Dr. D. J. Jackson Lecture 3-2Electrical & Computer Engineering
Distance measures
Given pixels p, q, and zat (x,y), (s,t) and (u,v) respectively,
Dis a distance function (or metric) if:
D(p,q) ≥0 (D(p,q)=0 iff p=q),
D(p,q) = D(q,p), and
D(p,z) D(p,q) + D(q,z).
The Euclidean distance between pand qis given by:
The pixels having distance less than or equal to some value
rfrom (x,y) are the points contained in a disk of radius r
centered at (x,y)
22 )()(),( tysxqpDe+=
Dr. D. J. Jackson Lecture 3-3Electrical & Computer Engineering
Distance measures (continued)
The D4distance (also called the city block distance)
between pand qis given by:
The pixels having a D4distance less than some rfrom (x,y)
form a diamond centered at (x,y)
Example: pixels where D4≤2
tysxqpD +=),(
4
2
2 1 2
2 1 0 1 2
2 1 2
2
Note: Pixels with D4=1
are the 4-neighbors
of (x,y)
Dr. D. J. Jackson Lecture 3-4Electrical & Computer Engineering
Distance measures (continued)
The D8distance (also called the chessboard distance)
between pand qis given by:
The pixels having a D8distance less than some rfrom (x,y)
form a square centered at (x,y)
Example: pixels where D8≤2
),max(),(
8tysxqpD =
2 2 2 2 2
2 1 1 1 2
2 1 0 1 2
2 1 1 1 2
2 2 2 2 2
Note: Pixels with D8=1
are the 8-neighbors
of (x,y)
Dr. D. J. Jackson Lecture 3-5Electrical & Computer Engineering
Distance measures and connectivity
The D4distance between two points pand qis the shortest
4-path between the two points
The D8distance between two points pand qis the shortest
8-path between the two points
D4and D8may be considered, regardless of whether a
connected path exists between them , because the definition
of these distances involves only the pixel coordinates
For m-connectivity, the value of the distance (the length of
the path) between two points depends on the values of the
pixels along the path
Dr. D. J. Jackson Lecture 3-6Electrical & Computer Engineering
Distance measures and m-connectivity
Consider the given arrangement of pixels and assume
p, p2and p4=1
p1and p3can be 0 or 1
If V={1} and p1and p3are 0, the m-distance (p, p4) is 2
If either p1or p3are 1, the m-distance (p, p4) is 3
If p1and p3are 1, the m-distance (p, p4) is 4
p3p4
p1p2
p
pf3
pf4

Partial preview of the text

Download Lecture 3: Computer Vision & Image Processing - Basics & Distances and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Computer Vision &

Digital Image Processing

Basic Image Processing Operations

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Distance measures

  • Given pixels p , q , and z at ( x,y ), ( s,t ) and ( u,v ) respectively,
  • D is a distance function (or metric ) if:
    • D(p,q) ≥ 0 (D(p,q)=0 iff p=q),
    • D(p,q) = D(q,p), and
    • D(p,z) ≤ D(p,q) + D(q,z).
  • The Euclidean distance between p and q is given by:
  • The pixels having distance less than or equal to some value r from (x,y) are the points contained in a disk of radius r centered at (x,y)

D ( p , q ) ( x s )^2 ( y t )^2

e = − + −

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Distance measures (continued)

  • The D 4 distance (also called the city block distance ) between p and q is given by:
  • The pixels having a D 4 distance less than some r from (x,y) form a diamond centered at (x,y)
  • Example: pixels where D 4 ≤ 2

D 4 ( p , q )= x − s + y − t

Note: Pixels with D 4 = are the 4-neighbors of (x,y)

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Distance measures (continued)

  • The D 8 distance (also called the chessboard distance ) between p and q is given by:
  • The pixels having a D 8 distance less than some r from (x,y) form a square centered at (x,y)
  • Example: pixels where D 8 ≤ 2

D 8 ( p , q )=max( x − s , y − t )

Note: Pixels with D 8 = are the 8-neighbors of (x,y)

Distance measures and connectivity

  • The D 4 distance between two points p and q is the shortest 4-path between the two points
  • The D 8 distance between two points p and q is the shortest 8-path between the two points
  • D 4 and D 8 may be considered, regardless of whether a connected path exists between them, because the definition of these distances involves only the pixel coordinates
  • For m-connectivity , the value of the distance (the length of the path) between two points depends on the values of the pixels along the path

Distance measures and m-connectivity

  • Consider the given arrangement of pixels and assume
    • p, p 2 and p 4 =
    • p 1 and p 3 can be 0 or 1
  • If V ={1} and p 1 and p 3 are 0, the m-distance (p, p 4 ) is 2
  • If either p 1 or p 3 are 1, the m-distance (p, p 4 ) is 3
  • If p 1 and p 3 are 1, the m-distance (p, p 4 ) is 4

p 3 p (^4) p 1 p (^2) p

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

M-connectivity example

m-distance (p,p 4 )=2 m-distance (p,p 4 )=3 m-distance (p,p 4 )=

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Arithmetic & logic operations

  • Arithmetic & logic operations on images used extensively in most image processing applications - May cover the entire image or a subset
  • Arithmetic operation between pixels p and q are defined as:
    • Addition: ( p+q )
      • Used often for image averaging to reduce noise
    • Subtraction: ( p-q )
      • Used often for static background removal
    • Multiplication: ( p*q ) (or pq , p × q )
      • Used to correct gray-level shading
    • Division: ( p ÷ q ) (or p/q )
      • As in multiplication

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Logic operations

  • Arithmetic operation between pixels p and q are defined as:
    • AND: p AND q (also p⋅q)
    • OR: p OR q (also p+q)
    • COMPLEMENT: NOT q (also q’ )
  • Form a functionally complete set
  • Applicable to binary images
  • Basic tools in binary image processing, used for:
    • Masking
    • Feature detection
    • Shape analysis

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Examples of logic operations

A NOT(A)

A B (A) AND (B)

A B (A) OR (B)

Examples of logic operations (continued)

A B (A) XOR (B)

A B [NOT (A)] AND (B)

Neighborhood-oriented operations

• Arithmetic and logical operations may take place on

a subset of the image

  • Typically neighborhood oriented

• Formulated in the context of mask operations (also

called template , window or filter operations)

• Basic concept: let the value of a pixel be a function

of its (current) gray level and the gray level of its

neighbors (in some sense)

Electrical & Computer Engineering Dr. D. J. Jackson Lecture 3-

Basic matlab instructions (continued)

• colormap(CMAP_NAME); Use a particular

colormap to display an image

• image(A_NAME); create and display an image

from a given array of data