0% found this document useful (0 votes)
37 views16 pages

Week 2

This document discusses key concepts in digital image processing. It defines a digital image as an image that has been digitized into a sequence of numbers. A digital image can be represented mathematically as a multidimensional function that maps spatial coordinates to pixel values. Different types of digital images are described based on their pixel value sets, including monochrome, RGB, binary, and index images. The document also discusses pixel neighborhood relationships and different distance metrics for digital images. It provides examples of Matlab code for generating simple digital images.
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)
37 views16 pages

Week 2

This document discusses key concepts in digital image processing. It defines a digital image as an image that has been digitized into a sequence of numbers. A digital image can be represented mathematically as a multidimensional function that maps spatial coordinates to pixel values. Different types of digital images are described based on their pixel value sets, including monochrome, RGB, binary, and index images. The document also discusses pixel neighborhood relationships and different distance metrics for digital images. It provides examples of Matlab code for generating simple digital images.
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/ 16

Digital Image Processing - 8th Semester - Week 2

Dr. Salman Ahmed

April 10, 2022


Digital Image

Digital Image: A digital image is an image that has been digitized, which
means it has been changed into a sequence of numbers that computers
can understand.
Digital Image Mathematics

Digital Image Mathematics: It is a multidimensional function f of spatial


coordinates. The function f maps spatial coordinates to numbers.

Spatial Coordinates:
▶ (x, y) for 2D images
▶ (x, y, z) for 3D images
▶ (x, y, t) for 2D videos
▶ (x, y, z, t) for 3D videos

The function f may represent intensity level for monochromatic images or


color for colored images.
Digital Image Representation

A digital image can be represented mathematically as


I = (p, f (p)) : p ∈ X, f (p) ∈ F
Where X and F are point set (or coordinate set) and value set respectively.

An element of an image (p, f (p)) is called pixel where


▶ p is the pixel location
▶ f (p) is the value of pixel at location p

Sometimes we abuse the notation pixel to refer the coordinates, and some-
times it refers to the value at the coordinates.

How do we define the coordinate set for a picture. Where to start and
where to end?
Digital Image Representation
Digital Image Representation
Digital Image Representation
Digital Image Representation
Digital Image Types (based on pixel value set)

Monochrome Image : Each pixel


represents light intensity expressed
in gray scale.

RGB Image : Each pixel represents a


vector containing values of its red,
green and blue components.
Digital Image Types (based on pixel value set)

Binary Image : Each pixel represents


one bit i.e. 1 for white and 0 for
black.

Index Image : Each pixel represents


an index number which points to a
color in a color table.
Neighbors of a pixel
Neighborhood relation conveys information about adjacent pixels.

4-Neighborhood relation considers 1-pixel vertical and horizontal neigh-


bors.    
n1 (x − 1, y)
 = (x, y − 1)
n2   
N4 (p) =  n3  (x, y + 1) (1)
n4 (x + 1, y)
Neighbors of a pixel
Diagonal neighborhood relation considers diagonal neighbors.
   
n1 (x − 1, y − 1)
n2  (x − 1, y + 1)
ND (p) =  n3  = (x + 1, y − 1)
   (2)
n4 (x + 1, y + 1)
Neighbors of a pixel
8-Neighborhood relation considers all neighbor pixels.
  
n1 (x − 1, y − 1)
n2   (x − 1, y) 
  
n3  (x − 1, y + 1)
  
n4   (x, y − 1) 
N8 (p) =  
n5   (x, y + 1) 
 (3)
  
n6  (x + 1, y − 1)
  
n7   (x + 1, y) 
n8 (x + 1, y + 1)
Distance

Euclidean distance is given by


p
De (p, q) = (x − s)2 + (y − t)2
where (x, y) and (s, t) are coordinates of p and q pixels.

Now lets practice some Matlab code


Example 1
clear;

clc

for i =1:256

for j=1:256

A(i,j)=j-1;

end

end

image(A);

colormap(gray(256))

axis(’image’)
Example 2

clear;

for i =1:256
for j=1:256
r = sqrt((i − 128)2 + (j − 128)2 );
if(r<80)
A(i,j)=255;
else
A(i,j)=0;
end
end
end
image(A);
colormap(gray(256))
axis(’image’)

You might also like