0% found this document useful (0 votes)
33 views3 pages

Tayyeba Rafaqat (Ms-15799) : Assignment 02

The document summarizes an image segmentation assignment. It selects three classes - sand, sky, and trees - from an input image based on RGB pixel value ranges. It then calculates the mean and covariance for each class's joint Gaussian density. Finally, it uses minimum risk Bayes classification on each pixel to generate a new segmented image assigning colors to each class. The segmentation achieves significant accuracy with minimal inaccuracies.

Uploaded by

Azka Nawaz
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)
33 views3 pages

Tayyeba Rafaqat (Ms-15799) : Assignment 02

The document summarizes an image segmentation assignment. It selects three classes - sand, sky, and trees - from an input image based on RGB pixel value ranges. It then calculates the mean and covariance for each class's joint Gaussian density. Finally, it uses minimum risk Bayes classification on each pixel to generate a new segmented image assigning colors to each class. The segmentation achieves significant accuracy with minimal inaccuracies.

Uploaded by

Azka Nawaz
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/ 3

ASSIGNMENT 02

TAYYEBA RAFAQAT (MS-15799)


04-AUG-2020
1) Three classes have been selected in the provided image. Sand (pink), sky(blue) and
trees(green).

Input image (image.jpg)

2) Minimum and maximum ranges of RGB pixel values have been selected manually for
each class using impixelinfo() in MATLAB. For training, parameters of class conditional
densities have been found using following pixel value ranges.

• Class 1 (Sand), Red: 220-242, Green = 190-207, Blue = 164-179


• Class 2(Sky), Red = 175-220, Green = 208-227, Blue = 200-222
• Class 3(Trees), Red = 40-185, Green = 80-190, Blue = 35-180

3) Assuming joint Gaussian density for each class, mean vector and co-variance matrix
for each class have been calculated using above data ranges. Mean and standard
deviation of each RGB feature have been calculated separately for each class. The
resulting joint gaussian class conditional density parameters are

• Class 1: µ1= [229;204;174] and Σ1= [7.17,0,0; 0,8.35,0; 0,0,7.18]


• Class 2: µ2= [196;211;210] and Σ2= [94.97,0,0; 0,10.20,0; 0,0,13.65]
• Class 3: µ3= [176;154;172] and Σ3= [20.05,0,0; 0,28.24,0; 0,0,12.70]
Class conditional probability for each class has been calculated using multivariant
normal density formula for 3D.

p(x∣μ,Σ)=1/√ (2π)d|Σ| exp(−1/2(x−μ)TΣ−1(x−μ))

where d=3, x=selected pixel to be classified, μ=mean vector of given class and

Σ=covariance matrix of given class. RGB features are statistically independent.

4) Using minimum risk Bayes classifier for classification of each pixel.

Prior probability P(wi) = Number of pixels in wi


Total number of pixels

Zero-one loss matrix has been selected since all class errors are equally likely.

Loss matrix λ = [0, 1, 1; 1, 0, 1; 1, 1, 0]

Prior probability P(wj|X) = P(X|wj) * P(wj) / P(X)

Conditional risk R(αi|X) = λii* P(wi|X) + λij * P(wj|X) + λik * P(wk|X)

Pixel has been classified in class i such that the conditional risk for that class is
minimum.

A new image has been generated of dimensions as input image. Each input image pixel
is classified in one of the three classes. For class1, RGB value is [255,0,0]. Similarly, for
class 2 and 3, [0, 255, 0] and [0, 0, 255] respectively.

Segmented image.
5) Classification using minimum risk Bayes classifier is significantly accurate. The
inaccuracies are minimal and can be ignored. Major part of the image is classified
accurately. For further improvement, other classification techniques can be applied.

You might also like