0% found this document useful (0 votes)
29 views

Lec 02 (BIP) Image Enhancement - Spatial Domain

Uploaded by

mna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Lec 02 (BIP) Image Enhancement - Spatial Domain

Uploaded by

mna
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

Department of Biomedical

Engineering
UET Lahore, New Campus

Medical Image Processing (BME-420):


Image Enhancement in Spatial Domain

Engr.Mohd Abdullah
Brightness and Contrast
Brightness

Brightness is a relative term. Brightness refers to the


overall lightness or darkness of the image.
Just have a look at both of these images, and compare
which one is brighter.
How to make an image brighter?

Brightness can be simply increased or decreased by simple


addition or subtraction, to the image matrix.

0 0 0 0 0 100 100 100 100 100


0 0 0 0 0
+100 100 100 100 100 100
0 0 0 0 0 100 100 100 100 100
0 0 0 0 0 100 100 100 100 100
0 0 0 0 0 100 100 100 100 100

+50 +50

50 50 50 50 50 150 150 150 150 150


+100
50 50 50 50 50 150 150 150 150 150

50 50 50 50 50 150 150 150 150 150

50 50 50 50 50 150 150 150 150 150

50 50 50 50 50 150 150 150 150 150


Contrast

• Contrast can be simply explained as the difference between


maximum and minimum pixel intensity in an image.
𝑐𝑜𝑛𝑡𝑟𝑎𝑠𝑡 = 𝑀𝑎𝑥 𝑝𝑖𝑥𝑒𝑙 𝐼𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 − 𝑀𝑖𝑛 𝑃𝑖𝑥𝑒𝑙 𝐼𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦

100 100 100 100 100


100 100 100 100 100
100 100 100 100 100
100 100 100 100 100
100 100 100 100 100

The maximum value in this matrix is 100.


The minimum value in this matrix is 100.

𝐶𝑜𝑛𝑡𝑟𝑎𝑠𝑡 = 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑝𝑖𝑥𝑒𝑙 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 − 𝑚𝑖𝑛𝑖𝑚𝑢𝑚 𝑝𝑖𝑥𝑒𝑙 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦


= 100 − 100
= 0

0 means that this image has 0 contrast.


Which one is brighter?

Brightness too high Brightness too low


Which one has low contrast?

Contrast too high Contrast too low


Image Enhancement
Image Enhancement

Images are NOT Perfect Sometimes

So we need enhancement
Image Enhancement

Image Enhancement is the process that improves the quality of


the image for a specific application.

e.g.) A method that is quite useful for enhancing x-ray images may
not necessarily be the best approach for enhancing pictures of
Mars transmitted by a space probe.

• There is no general theory of image enhancement.


– When an image is processed for visual interpretation, the viewer is
the ultimate judge of how well a particular method works.
– Subjective
Image Enhancement Methods

Image Enhancement Methods

1 Spatial Domain Methods (Image Plane)

2 Frequency Domain Methods

3 Combination Methods
Spatial Domain Methods

Spatial domain methods are procedures that operate


directly on these pixels. Spatial domain processes will be
denoted by the expression:

𝑔 𝑥, 𝑦 = 𝑻 𝑓(𝑥, 𝑦)

Processed (Output) Image Input Image

Operator/Transformation

In addition, T can operate on a set of input images.


Overview of Spatial Enhancement Methods

Spatial Enhancement

1 2 3 4

Basic Gray Piecewise Histogram Arithmetic/


level Linear Processing Logic
Transforms Transforms Operations

• Image Negative • Contrast Stretching • Hist. Sliding • Image Subtraction


• Log Transform • Thresholding • Hist. Stretching • Image Averaging
• Gamma Transform • Window Slicing • Hist. Equalization • Boolean
• Bit-plane Slicing Operations
Image Negative
Basic Gray Level Transformations

❖ Images taken from Gonzalez & Woods, Digital Image Processing


a) Image Negatives:
𝑠 = 𝐿−1 −𝑟
Pixels of the
output Image
Pixels of the Input Image
(0,1,2,…,254,255)→(255,254,…,1,0)

Advantages of negative:
✓ Produces an equivalent of a photographic negative.
✓ Enhances white or gray detail embedded in dark regions.
Basic Gray Level Transformations

Examples: Image Negatives


Basic Gray Level Transformations

Examples: Image Negatives


Basic Gray Level Transformations

Example: Image Negatives:


𝑠 = 𝐿−1 −𝑟

Image (r)
Example
100 110 90 95
the following matrix represents the pixels values of
an 8-bit image (r) , apply negative transform and 98 140 145 135

find the resulting image pixel values. 89 90 88 85

102 105 99 115


Solution:
𝐿 = 28 = 256
Image (s)
𝑠 = (𝐿 − 1) − 𝑟 155 145 165 160
𝑠 = 255 − 𝑟
157 115 110 120

Apply this transform to 166 165 167 170


each pixel to find the negative 153 150 156 140
Basic Grayscale Transformations

b) Log Transformations:
𝑠 = 𝑐 log(1 + 𝑟)

• Compress the dynamic range of the image.


• e.g. to Visualize Fourier spectra

Properties of log transformations


• For lower amplitudes of input image the range of gray levels is
expanded
• For higher amplitudes of input image the range of gray levels is
compressed
Application:
• This transformation is suitable for the case when the dynamic range
of a processed image far exceeds the capability of the display device
• (e.g. display of the Fourier spectrum of an image)
• Also called “dynamic-range compression/expansion”
Basic Grayscale Transformations

Example: Log Transformations:

Fourier spectrum with values of The result of applying log transform


range 0 𝑡𝑜 1.5 × 106 range= 0 𝑡𝑜 6.2

❖ Images taken from Gonzalez & Woods


Basic Grayscale Transformations

c) Power-Law (gamma) Transformation:

𝑠 = 𝑐𝑟 𝛾

• The exponent is called gamma (γ)


• Gamma correction
Basic Gray Level Transformations

𝛾=0.6

𝛾=0.4 𝛾=0.3

❖ Images taken from Gonzalez & Woods


Basic Gray Level Transformations

❖ Images taken from Gonzalez & Woods


𝛾=3

𝛾=4
𝛾=5
Piecewise Linear Transformations
Piecewise Linear Transformation

a) Contrast stretching and thresholding:

(r2, s2) (r2, s2)


(r2, s2)

(r1, s1)
(r1, s1)
(r1, s1)

Contrast stretching Thresholding:


Piecewise Linear Transformation
Example: Contrast stretching Pixels above 180 become 255

Example: in the graph, suppose we have the


following intensities : a=90, b=180, m=100
✓ if r is above 180 , it becomes 255 in s.
✓ If r is below 90 , it becomes 0,
✓ If r is between 90, 180 , T applies as follows:
when r < 100 , s closes to zero (darker)
when r > 100 , s closes to 255 (brighter)

If r >180; s =255 Pixels less than 90 become 0


T= If r <180 and r<90; s=T(r)
If r <90; s =0

This is called contrast stretching, which means that the bright pixels in the
image will become brighter and the dark pixels will become darker, this
means : higher contrast image.
Piecewise Linear Transformation
Example: Contrast stretching
Image (r) Image (s) after applying T (contrast
stretching)

Notice that the intensity transformation function T, made the pixels


with dark intensities darker and the bright ones even more brighter,
this is called contrast stretching
Example: Contrast Stretching

▪ Low contrast chest x-ray


image

▪ Contrast-stretched chest x-ray


image
Piecewise Linear Transformation
Example: Thresholding
Pixels above 150 become 1

Example: Suppose m = 150 (called threshold),


if r (or pixel intensity in image f) is above this
threshold it becomes 1 in s (or pixel intensity in
image g), otherwise it becomes zero.

T= If r >150; s =1
If r <150; s =0

This is called thresholding


Pixels less than 150 become 0

Can you guess the output of thresholding? →Binary Image


Example: Thresholding
Example: Thresholding
Example: Thresholding
Example: Contrast Stretching & Thresholding
Piecewise Linear Transformation

b) Intensity-Level Slicing (gray level slicing/window slicing)

• To highlight a specific range of intensities in an image (e.g. to


enhance certain feature).

Approach 1 Approach 2

Display in one value (e.g. white) all the Brightens or darkens the desired range
values in the range of interest , and in of intensities but leaves all other
another (e.g. black) all other intensities intensity levels in the image unchanged
Piecewise Linear Transformation

b) Intensity-Level Slicing (gray level slicing/window slicing)


Highlighting a specific range of intensities in an image.

Approach 1 Approach 2

𝑳−𝟏 𝒇𝒐𝒓 𝑨 ≤ 𝒙 ≤ 𝑩
𝑳−𝟏 𝒇𝒐𝒓 𝑨 ≤ 𝒙 ≤ 𝑩 𝒈 𝒙 =ቊ
𝒈 𝒙 =ቊ 𝒙 𝑬𝒍𝒔𝒆𝒘𝒉𝒆𝒓𝒆
𝟎 𝑬𝒍𝒔𝒆𝒘𝒉𝒆𝒓𝒆
Preserves background
Example: Intensity level slicing
If the pixel intensity is between (100 → 150)
Approach-1 convert it in the new image into 255 (white).
Otherwise convert it to 0 (black).
Example: Intensity level slicing
If the pixel intensity is between (100 → 150)
convert it in the new image into 255 (white).
Otherwise leave it the same
Example: Intensity level slicing

Example of window slicing.


The original image (left) has grey values in the range {0, . . . , 255}.
The right image shows the result after slicing the window {64, . . . , 123},
i.e., a = 63 and b = 123.
Example: Intensity level slicing
Bit-Plane Slicing

Remember that pixels are digital


numbers composed of bits.

8-bit Image composed of 8 1-bit planes


Example: Bit-Plane Slicing
100

01100100
MSB LSB
Image of bit1: Image of bit2: Image of bit3:
00000000 00000000 00000100 Image of bit4:
00000000
0 0 1 0

Image of bit5: Image of bit6: Image of bit7: Image of bit8:


00000000 00100000 01000000 00000000
0 1 1 0
Example: Bit-Plane Slicing
Example: Bit-Plane Slicing

Advantage/ Disadvantage?
Histogram Introduction
Histogram

A histogram is a graph that shows frequency of anything. Usually


histogram have bars that represent frequency of occurring of data in
the whole data set.

Popularity of Programming languages

8
7
6
5
4
3
2
1
0
Java C++ Python C#
Example

Result
CMS # Grade Result
001 A
002 D 4
003 B 3
004 A
2
005 C
006 B 1
007 B
0
008 C A B C D
009 B
Histogram of an image
• Histogram of an image, like other histograms also shows frequency.
But an image histogram, shows frequency of pixels intensity values.

• In an image histogram, the x axis shows the gray level intensities


and the y axis shows the frequency of these intensities.

MATLAB function >> imhist(x)


Histogram of an image
• Histogram of a digital image:
• ℎ 𝑟𝑘 = 𝑛𝑘
• where 𝑟𝑘 : 𝑘𝑡ℎ 𝑔𝑟𝑎𝑦 𝑙𝑒𝑣𝑒𝑙
𝑛𝑘 : # 𝑜𝑓 𝑝𝑖𝑥𝑒𝑙𝑠 ℎ𝑎𝑣𝑖𝑛𝑔 𝑔𝑟𝑎𝑦 𝑙𝑒𝑣𝑒𝑙 𝑟𝑘

[hist1, bins1] = hist(double(r(:)),256);


bar(bins1,hist1);
title('Histogram');
Examples: Histogram
Examples: Histogram

Given an image 0 0 0 0
0 1 2 3
0 2 4 6
Draw Histogram
Why Histogram?

Provides information about the


contrast and overall intensity
distribution of an image.
4
x 10

3.5

2.5

1.5

0.5

0 50 100 150 200 250

Histogram information reveals that image is under-exposed


Examples: Histogram

Compare four images and


their histograms
Histogram Processing
Histogram Processing

a) Histogram Sliding:
In histogram sliding , we just simply shift a complete histogram
rightwards or leftwards. Due to shifting or sliding of histogram towards
right or left, a clear change can be seen in the brightness.

In order to bright it, we will slide its histogram towards right, or


towards whiter portion. In order to do we need to add a value (e.g.
50) to this image.
Histogram Processing

• Increasing brightness using histogram sliding


Histogram Processing

• Decreasing brightness using histogram sliding


Histogram Processing

b) Histogram Stretching (Normalization):


An image with a dynamic range lower than the full dynamic range
available (2𝑛 ) can be displayed with the full dynamic range if its
histogram is stretched.
(𝐿 − 1)
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 − 𝑓𝑚𝑖𝑛 ×
𝑓𝑚𝑎𝑥 − 𝑓𝑚𝑖𝑛

𝑓𝑚𝑖𝑛 𝑓𝑚𝑎𝑥
Example: Histogram Stretching

4 0 1 2 6
𝑓𝑚𝑎𝑥 = 4
0 3 2 1 4
𝑓𝑚𝑖𝑛 = 0
2 0 1 2 2
Contrast = 4
3 4 0 2 0
0 1 2 3 4 5 6 7
3-bit image

• Applying Histogram stretching 7 0 2 3


on this image 0 5 3 2
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 − 𝑓𝑚𝑖𝑛 ×
(𝐿 − 1) 3 0 2 3
𝑓𝑚𝑎𝑥 − 𝑓𝑚𝑖𝑛
5 7 0 3
8−1
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 − 0 × 6
4−0
4
7
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 ×
4 2

0
0 1 2 3 4 5 6 7
Example: Histogram Stretching
5
x 10 Histogram of original image
4
histogram stretched image
3
𝑓𝑚𝑎𝑥 = 143
𝑓𝑚𝑖𝑛 = 84
Contrast = 59
2

0
0 50 100 150 200 250

5
x 10 Histogram of output
4

0
0 50 100 150 200 250
Example: Histogram Stretching
image
Histogram
10000

𝑓𝑚𝑎𝑥 = 178
𝑓𝑚𝑖𝑛 = 112 5000

Contrast = 66
0
0 50 100 150 200 250

Histogram
10000

• Applied Histogram
stretching
5000

0 Histogram
0 50 100 150 10000 200 250

Histogram
𝑓𝑚𝑎𝑥 = 255 10000
5000
𝑓𝑚𝑖𝑛 = 0
Contrast = 255
5000 0
0 50 100 150 200 250
Example: Histogram Stretching
image
4
x 10 Histogram
3

0
0 50 100 150 200 250

4
x 10 Histogram
Histogram 3

0
0 50 100 150 200 250
Failing of Histogram Stretching

This technique fails in some cases

• When pixel intensity 0 and 255 are present in the image


• In that case they become the minimum and maximum pixel intensity
which ruins the formula like this

(𝐿 − 1)
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 − 𝑓𝑚𝑖𝑛 ×
𝑓𝑚𝑎𝑥 − 𝑓𝑚𝑖𝑛

(𝐿 − 1)
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 − 0 ×
255 − 0

255
𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦 ×
255

𝑔 𝑥, 𝑦 = 𝑓 𝑥, 𝑦
Failing of Histogram Stretching
original image
4
x 10 Histogram of original image
6

histogram stretched image


4

0
0 50 100 150 200 250

histogram stretched image


4
x 10 Histogram of output
6
Histogram of original image
4

0
0 50 100 150 200 250
Histogram Equalization

c) Histogram Equalization

• A gray-level transformation method that forces the


transformed gray level to spread over the entire
intensity range.

• The idea is to spread out the histogram more evenly


(uniformly) so that it makes full use of the dynamic
range of the image.

• Histogram equalization automatically determines a


transformation function that seeks to produce an output
image that has a uniform histogram.
Histogram Equalization
• 𝑠 = 𝑇(𝑟)
• PDF: 𝑝𝑟 (𝑟), 𝑝𝑠 (𝑠)

We want 𝑝𝑠 (𝑠) to be uniformly distributed

1
𝑝𝑠 𝑠 =
𝐿−1

𝑝𝑠 𝑠 ds = 𝑝𝑟 𝑟 𝑑𝑟 : 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑡ℎ𝑒𝑜𝑟𝑦

𝑑𝑠
= 𝐿 − 1 𝑝𝑟 (𝑟)
𝑑𝑟
𝑟
𝑠 = 𝑇 𝑟 = 𝐿 − 1 න 𝑝𝑟 𝑤 𝑑𝑤 → Cumulative distribution
0 function(CDF)
For discrete values
𝑟

𝑠 = 𝑇 𝑟 = 𝐿 − 1 ෍ 𝑝𝑟 𝑗 →Histogram Equalization
𝑗=0
Histogram Equalization
Probability density function (pdf) of the image

𝑡𝑜𝑡𝑎𝑙 𝑝𝑖𝑥𝑒𝑙 𝑤𝑖𝑡ℎ 𝑖𝑛𝑡𝑒𝑛𝑠𝑖𝑡𝑦 𝑛


𝑝𝑑𝑓 𝑛 = 𝑝𝑛 = n = 0,1, … , L − 1
𝑇𝑜𝑡𝑎𝑙 𝑝𝑖𝑥𝑒𝑙𝑠 𝑖𝑛 𝑖𝑚𝑎𝑔𝑒

From this pdf, we can obtain cumulative density function (CDF) as


𝐿−1

𝑐𝑑𝑓 𝑛 = ෍ 𝑝𝑛
𝑛=0

Histogram equalized image 𝑔 is defined as


𝐿−1

𝑔𝑖,𝑗 = 𝑟𝑜𝑢𝑛𝑑 𝐿 − 1 ෍ 𝑝𝑛
𝑛=0
Histogram Equalization

• Assume that we have (3bits per pixels) or 8 levels of grayscale, and


we want to equalize the following image example (total pixels 32).

Histogram Equalization
L X pdf(X) CDF CDF×(L-1) g(x)
0 1 0.031 0.031 0.219 0
1 3 0.094 0.125 0.875 1
2 5 0.156 0.281 1.969 2
3 6 0.188 0.469 3.281 3
4 6 0.188 0.656 4.594 5
5 6 0.188 0.844 5.906 6
6 2 0.063 0.906 6.344 6
7 3 0.094 1 7 7
Histogram Equalization

• Apply HE on the following image

0 0 0 4
Histogram Equalization
1 1 1 5
L X pdf(X) CDF CDF×(L-1) g(x)
1 2 2 7 0 3 0.1875 0.1875 1.3125 1
2 2 2 7 1 4 0.25 0.4375 3.0625 3
2 5 0.3125 0.75 5.25 5
3 0 0 0.75 5.25 5
1 1 1 6 4 1 0.0625 0.8125 5.6875 6

3 3 3 6 5 1 0.0625 0.875 6.125 6


6 0 0 0.875 6.125 6
3 5 5 7
7 2 0.125 1 7 7
5 5 5 7
5
0 0 0 4 4

1 1 1 5 3

1 2 2 7 2

1
2 2 2 7
0
0 1 2 3 4 5 6 7

5
1 1 1 6
4
3 3 3 6 3

3 5 5 7 2

5 5 5 7 1

0
0 1 2 3 4 5 6 7
Example: Histogram Equalization

4
x 10 Histogram
3

2
Histogram equalized
1

0
0 50 100 150 200 250

Histogram equalized

4
x 10 Histogram
Histogram 3

0
0 50 100 150 200 250
Example: Histogram Equalization

4
x 10 Histogram
2

1.5
Histogram equalized
1

0.5

0
0 50 100 150 200 250

4
x 10 Histogram
2

1.5

0.5

0
0 50 100 150 200 250
Example: Histogram Equalization
4
x 10 Histogram
5

4 Histogram equalized
3

0
0 50 100 150 200 250

Histogram equalized
Histogram x 10
4
Histogram
6

0
0 50 100 150 200 250
Question

What will happen if we perform


Histogram equalization of an
image which is already HE?
Adaptive/local Histogram Equalization

• In more complicated cases, the global histogram may not be a


good representation for local statistics in two parts of the image.

• In such cases it is best to use an adaptive histogram equalization


where you can divide the image into several rectangular domains,
compute an equalizing histogram and modify levels so that they
match across boundaries.
Adaptive Histogram Equalization
4
x 10 Histogram
15
Histogram equalized • The standard MRI image
10
• The histogram has a peak at
minimum intensity consistent
5 with the relatively dark nature of
the image.
0
0 50 100 150 200 250

Histogram equalized
4
Histogram x 10 Histogram
15
Adoptive HE • Global histogram equalization
10
• Comparing the results with the
figure above we can see that
5 the distribution was shifted
towards higher values
0
0 50 100 150 200 250
Adoptive HE
100 150 200
4 250 Histogram
Histogram x 10
10

• Adaptive histogram
equalization shows better
5
contrast over different parts of
the image.
0
0 50 100 150 200 250
Adaptive Histogram Equalization
4
x 10 Histogram
5 Histogram equalized

3 • X-ray Image
2

0
0 50 100 150 200 250
Histogram equalized
4
x 10 Histogram
Histogram 6 Adoptive HE

4
• Histogram
2
equalization
0
0 50 100 150 200 250

Histogram
100 Histogram 150 15000 200 250

10000
• Adaptive
5000
histogram
equalization
0
0 50 100 150 200 250
Adaptive Histogram Equalization
4
x 10 Histogram
Histogram equalized
3

2
• Image
1

0
0 50 100 150 200 250
Histogram equalized
4 Adoptive HE
Histogram
x 10
Histogram 3

2
• HE
1

0
0 50 100 150 200 250

Histogram
50 100 Histogram150 15000
200 250

10000 • AHE
5000

0
0 50 100 150 200 250
Enhancement Using Arithmetic/Logic Op.
Enhancement Using Arithmetic/Logic Op.
Arithmetic/logic operations involving images are performed on a pixel-
by-pixel basis between two or more images.

Arithmetic Operations
Addition, Subtraction, Averaging

Logic Operations
AND, OR, NOT
Addition

Used to create double-exposures or composites


𝑔(𝑥, 𝑦) = 𝑓1(𝑥, 𝑦) + 𝑓2(𝑥, 𝑦)

+ =
Addition

Can also do a weighted blend:


𝑔(𝑥, 𝑦) = 𝛼1 𝑓1(𝑥, 𝑦) + 𝛼2 𝑓2(𝑥, 𝑦)

+ =

𝑔 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 + 0.2 × 𝑓2(𝑥, 𝑦)
Image Averaging
Idea: Average multiple pictures of the same scene to reduce noise
If 𝑀 images are averaged
• Image averaging works on the assumption that the noise in your
image is truly random. This way, random fluctuations above and
below actual image data will gradually even out as one averages
more and more images.

g ( x, y ) = f ( x, y ) +  ( x, y )
Averaging M different noisy images
M
1
g ( x, y ) =
M
 g ( x, y )
i =1
i

Stationary component remains constant


Noise is reduced by 𝑀 to give increased 𝑆𝑁𝑅
Image Averaging

This technique was used to take the photo of Mount Kenya shown below from a
distance of 20 kilometers on a hazy day using a low-cost mega-zoom camera:
❖ Images taken from Geoff Dougherty, DIP for medical applications
Example: Image Averaging
Subtraction

Image Subtraction (motion detection/ background


elimination):
Useful for finding changes between two images
𝑔(𝑥, 𝑦) = 𝑓1(𝑥, 𝑦) − 𝑓2(𝑥, 𝑦)
Sometimes more useful to use absolute difference
𝑔(𝑥, 𝑦) = |𝑓1(𝑥, 𝑦) − 𝑓2(𝑥, 𝑦)|

What’s changed?
Example: Subtraction

Digital Subtraction Angiography:


1. Take an x-ray
2. Inject patient with a radio-opaque dye (and tell them not to
move!)
3. Take another x-ray
4. Subtract the two
❖ Images taken from Geoff Dougherty, DIP for medical applications
Example: Background Subtraction
- =
Example: Background Subtraction

Image from a whiteboard Background

Absolute Difference Complement of difference


Boolean Operations
AND, OR, XOR Operators

Image A Image B

A and B A or B A xor B
OR

OR =

You might also like