Professional Documents
Culture Documents
Numerical Analysis: Module Code: 502041 Anh H. Vo
Numerical Analysis: Module Code: 502041 Anh H. Vo
Numerical Analysis
Module code: 502041
Anh H. Vo
1 Introduction
This assignment will apply the basic concepts of Numerical Analysis to build a
real application for the image segmentation problem.
The figure in the left hand side with the blue curve shows the polynomial func-
tion f (x) of the input image, which it is computed by the frequency of each
unique intensity, and the the red curve describes the approximation of the poly-
nomial function g(x), which it interpolate by the intensity x and the frequency of
x denoted as y. Based on g(x), we are able to find the appropriate thresholding
value θ to get the image result in the right hand side.
2 Instruction
Suppose that given arbitrary image I as a matrix which represents the intensity
at each pixel. As in Table 1. To illustrate matrix I as the polynomial function
f (x). We must compute the frequency of each unique intensity in matrix I.
In Table 2, y = n(x) which means the number of observation of x intensity in
matrix I In the next step, the values of x and y will be utilized to find the
approximation of polynomial function g(x) = a0 + a1 x + ... + an xn by using
1
Ton Duc Thang University
Faculty of Information Technology
0 1 5 3 1 10 10 7 5 7
0 1 8 3 1 2 10 7 5 10
1 1 8 3 9 2 9 7 8 6
x 0 1 2 3 4 5 6 7 8 9 10
y 2 6 2 3 0 3 1 4 3 2 4
Table 2: The values of x and y which present the intensity value and the fre-
quency of each intensity in matrix I
the interpolation methods. Besides, we also need the thresholding value θ for
segmenting regions of the input image. To do this, we must find the indexing j
that at this point the value of the second derivative of the interpolation ŷ vector
is minimized. ŷ vector is computed from g(x) based on the following equation:
Remarks
0
0 2 4 6 8 10
Figure 2: The illustrate of the polynomial function f (x) of the input image
2
Ton Duc Thang University
Faculty of Information Technology
Recall that the input image must be the grayscale image, if the input
image is the RGB image, you need to convert to the grayscale image.
>> I = r g b 2 g r a y ( I ) ;
• The built-in functions as polyfit and polyval are possibly applied to ap-
proximate the polynomial function g(x).
• In equation (2), the abs and sort functions could use to compute the
absolute value and sort of the values.
3 Requirements
Requirement 1: Write a simple program to find the approximation of the
polynomial function of the input image and then segment the image re-
gions based on the interpolation methods.
1. Find x and y variables from the input image (1 point)
2. Find g(x) function which approximates the polynomial function f (x)
in the case of using the built-in function of MATLAB programming
language (1 point)
3. Find g(x) function which approximates the polynomial function f (x)
in the case of using your functions instead of the built-in functions.
(2 point)
4. Comparison of the relative errors when the approximation of the
polynomial function g(x) with n degree is 3, 4, 5, 6, respectively. (2
point).
5. Find the index which shows the minimum value of the second deriva-
tive of ŷ. (1 point)
6. Select g(x) toward the best relative error from the previous require-
ment to show the segmentation of input image. (1 point)
Requirement 2: Write a brief report to illustrate the process following the
above requirements (2 point)