Вы находитесь на странице: 1из 12

Assignment Cover Page

Programme Course Code and Title


Bachelor of Computer Science (Hons) CAI3044 Image Processing

Student’s name / student’s id Lecturer’s name

Muhammad Bin Lokman/ 0188353 Dr. Khoo Hee Kooi

Date issued Submission Deadline Indicative Weighting


Part A - 14 October 2019
3 September 2019 60%
Part B - 25 November 2019

Part A - Image analysis (1,200 words)


Assignment title Part B - Image classification (400 words)

This assessment assesses the following course learning outcomes


# as in KDU PG UC Learning Outcome
Course
)
Guide
1 Demonstrate theoretical and practical knowledge for acquiring, processing, and storing of
digital image data.
3 Model a solution by selecting the appropriate techniques to solve problems in image
processing.

# as in UL Learning Outcome
Course
Guide
1 critique the theoretical knowledge of image processing, including how to process and
extract quantifiable information from images
2 apply a range of imaging techniques to solve practical problems

Student’s declaration

I certify that the work submitted for this assignment is my own and research sources are fully
acknowledged.

Student’s signature: Lokman Date: 25/10/19


Question 1: Frequency domain
DFT transformation function and domain content

DFT uses both cosine and sine. In DFT, images are converted from spatial domain to frequency
domain using Fourier matrix (Ahmed, Natarajan, & Rao, 1974). Fourier Matrix can be represented as
W which known as twiddle factor.
Equation 1: TransformationeMatrix

N in equation above denotes N-point, where it could be 2,4or8 point DFT. diagram below shows
matrix multiplication of DFT where component is example of exponential input.

Figure 1: DFTeMatrixeMultiplication

DFT is taken from Fourier Transform which only as big as enough to describe spatial image. Amount
of frequencies translate to amount of pixel in spatial image. For 2D image of NxN, equation of DFT
is:
Equation 2: DiscreteeFouriereTransform

f(a,b) -represents the image-in spatial domain where term is the elemental-function correlating to
each point F(k,l) in Fourier space. Fourier transform-can-extract-geometric characteristics-of an-
image (Ahmed et al., 1974). When implemented, image-will be-decomposed and after applying log
transform we can get-images as-following-diagram.
Figure 2: originalevsetransformed

Left is original, right is output. Magnitude of frequency decrease as the frequency increase. -
Therefore, more image information-contained in low frequency (Rao & Yip, 2014). -Regular pattern
from background-of original image results-in two distinct straight-patterns-on the Fourier-transform-
picture, horizontally-and-vertically.

Applications of DFT

Several applications of DFT-includes spectral analysis of signal, Frequency-response of systems,


convolution-via the frequency domain. Frequency response system is when input signal becomes
group-of-cosine-waves, varied in-amplitude and phase shift (Rao & Yip, 2014). DFT-I used to produce
similar output signal which-is-called systems frequency response.

DCT Transformation function and domain content

DCT-only utilize cosine, by applying DCT function we-can transform and image within a-spatial
domain into a frequency domain. DFT has complex terms while DCT has only the real-terms which is
also orthogonal (Strang, 1999). The formula for DCT of a-data sequence n x m-matrices which
creates an 8 x 8 array:
Equation 3: Transform-of s-2D DCT
Figure 3: 8 by 8 basis for 2D DCT

Every square-is-horizontal or vertical spatial frequency. Increased frequency arranged bottom up


and left to right.

Figure 4: before and after DCT

The resulting image on right is blurred image of letter A. frequency of highest on horizontal and
vertical is removed.

Applications of DCT

Several applicationseincludes visual media standards such as visual media standards like image
formats, video formats and audio standards as well as digital signal processing. In digital signal
processing, by using the DCT, the signals can be compressed. Also used ECG signals compression
in electrocardiography. DCT2 provides the better compression ratio than DCT (Watson, n.d.).

The DCT is widely implemented in digital signal processor (DSP) chips, as well as digital signal
processing software. Many companiesehave developed DSP chips based on DCT technology. DCTs
are widely used for encoding, decoding, video, audio, multiplexing, control
signals, signaling, analog-to-digital conversion, formatting luminance and color differences. DCTs
are also used for encoding operations such as motion estimation, motion compensation, inter-
frame prediction, quantization, perceptual weighting, entropy encoding, variable encoding,
and motion vectors, and decoding operations such as the inverse operation between different
color formats (YIQ, YUV and RGB) for display purposes (“Frequency Response of Systems,” n.d.).
DCTs are alsoecommonly used for high-definitionetelevision (HDTV) encoder/decoderechips. (400
words)
Question 2: Image compression
(b) Validation of experiments and interpretation of results

The 3 level of decomposition of DWT is done using wavedec2, a function for 2D forward DWT from
pywavelet library. This function is used because it could calculate all 3 level decomposition in one
function which is perfect for our use case. multilevel DWT works by further decomposition of only
the approximation subband at each succeding level this technique known as Mallat decomposition
(Mallat, 1989). DWT generate 4 possible combination of coefficient correlating the wavelet
decomposition filter. For the following levels of decomposition, only the approximation coefficients
(the lowpass subband) are further decomposed.

Code 1: Compute 2D DWT

The code above shows the wavedec2 function which takes in several parameters which is 2D array
input data (image), wavelet (biorthogonal), signal extension mode (constant) and decomposition
level which is run through a loop in range of 1 to 3.

Code 2: Display each decomposition

The wavedec2 function outputs list of coefficients which will then copied on line 53 so that the next
step will no affect the original list. On line 55 to 57, the value of coefficient is normalized to range of
0 to 1 being 0 darkest and 1 brightest, this step is optional to make the subband image more visible.
Line 59 through 62 is to display the result image of decomposition for each level.

Code 3: Up-sampling
Coeffs3 is taken from the final coeffs1 value. In line 65, it is broken down into tuple component. Line
66 to 68, all the HH subband turn to zero. Line 69 the component is reconstructed to a tuple format
compatible for waverec2 consumption. Line 70 is how the image is reconstructed back to image.

Figure 5: Three level decomposition

Diagram above shows the results of three level decomposition when the python program is run.
Figure 6: Inverse image of DWT

The diagram above shows the output after 3 level of up-sampling with the diagonal region set to
zero resulting in the black and white pixel artefacts indicating loss of image information along some
of the diagonal edge of the picture.

Figure 7: Results of experiment

The image used is taken from USC-SIPI image database for image processing. It is a 512 by 512
coloured tiff image with the size of 768KB. The diagram above shows the result of the compression
rate as well as the calculated Mean square error and peak signal to noise ratio from the output
console of the program. (400 words)

(c) Performance evaluation

By decomposition and up-sampling the image, the final output greyscale image size is 194.55KB. by
considering the original file size of 512 by 512 we can validate the result of original size to be 256KB
which gives the compression rate of 76%. is the cumulative squared error between the compressed
and the original image, whereas PSNR is a measure of the peak error. The mathematical formulae
for the two are:
Equation 4: MSE and PSNR formulae

where I(x,y) is the original image, I'(x,y) is the approximated version (which is actually the
decompressed image) and M,N are the dimensions of the images. A lower value for MSE means
lesser error. Therefore, from our computed MSE, with value of 175.24 indicates a lot of error. PSNR
have an inverse relation towards MSE. Logically, a higher value of PSNR is good because it means
that the ratio of Signal to Noise is higher (Saffor, Ramli, & Ng, n.d.). Here, the 'signal' is the original
image, and the 'noise' is the error in reconstruction. The result of the PSNR is quite low, which is
25.69 indicates higher noise.

Figure 8: Results for default coefficient

Diagram above shows the result when the coefficient of diagonal subband or HH region is
unchanged. This proves that changing the coefficient will corrupt the image. The MSE value is
tremendously lower indicating lesser error. And PSNR value is higher than previous result indicating
lesser noise. In terms of compression rate, both are almost the same with the compressed image
being 80% the size of the original uncompressed size.

Based on figure 6, we can see some aretefact on the image because of nulling the HH region when
doing the up-sampling, this loses the image data on the diagonal subband. Other parts of the image
seems similar to the original from the naked eye. (299 words)
References

Ahmed, N., Natarajan, T., & Rao, K. R. (1974). Discrete Cosine Transform. IEEE Transactions on

Computers, C–23(1), 90–93. https://doi.org/10.1109/T-C.1974.223784

Mallat, S. G. (1989). A theory for multiresolution signal decomposition: The wavelet representation.

IEEE Transactions on Pattern Analysis and Machine Intelligence, 11(7), 674–693.

https://doi.org/10.1109/34.192463

Rao, K. R., & Yip, P. (2014). Discrete Cosine Transform: Algorithms, Advantages, Applications.

Academic Press.

Saffor, A., Ramli, A. R., & Ng, K.-H. (n.d.). A COMPARATIVE STUDY OF IMAGE COMPRESSION

BETWEEN JPEG AND WAVELET. 8.

Strang, G. (1999). The Discrete Cosine Transform. SIAM Review, 41(1), 135–147.

https://doi.org/10.1137/S0036144598336745

Watson, A. B. (n.d.). Image Compression Using the Discrete Cosine Transform. 8.


CAI3044 Image Processing

MARKING RUBRIC

Assignment

Part A: Image analysis (Weighted marks: 30%)

Question 1: Visual data compression (Score: 30%)

SCALE
LEARNING OUTCOME MARKING CRITERIA Failed 3rd class 2nd lower 2nd upper 1st class YOUR MARKS/COMMENTS
(0% to 49%) (50% to 59%) (60% to 69%) (70% to 79%) (80% to 100%)
1(a). Frequency domains No discussion on frequency Brief discussion on Good discussion on the Good discussion on Excellent discussion on
in terms of domains in terms of frequency domains in frequency domains in frequency domains in terms frequency domains in terms of
transformation functions
(10%)
transformation functions. terms of transformation terms of transformations of transformation functions, transformation functions, with
functions. functions, however there with proper concepts are proper concepts and in-depth
CLO 1 : Demonstrate theoretical and practical knowledge for acquiring,

are misconceptions for stated. technical details are stated.


certain terms.

1(b). Frequency domains No discussion on frequency Brief discussion on Good discussion on the Good discussion on Excellent discussion on
in terms of domain domains in terms of domain frequency domains in frequency domains in frequency domains in terms frequency domains in terms of
content
(10%) content. terms of domain content. terms of domain content, of domain content, with domain content, with proper
however there are proper concepts are stated. concepts and in-depth
processing, and storing of digital image data.

misconceptions for certain technical details are stated.


terms.

1(c). Frequency domains No discussion on frequency Brief discussion on Good discussion on the Good discussion on Excellent discussion on
in terms of applications domains in terms of frequency domains in frequency domains in frequency domains in terms frequency domains in terms of
(10%)
applications. terms of applications. terms of applications, of applications, with proper applications, with proper
however there are concepts are stated. concepts and in-depth
misconceptions for certain technical details are stated.
terms.

Total (30%)
Question 2: Image compression (Score: 70%)

SCALE
LEARNING OUTCOME MARKING CRITERIA Failed 3rd class 2nd lower 2nd upper 1st class YOUR MARKS/COMMENTS
(0% to 49%) (50% to 59%) (60% to 69%) (70% to 79%) (80% to 100%)
2(a) Developments of No development on image Erroneous in the program Good developments of Good developments of image Good development of image
image transformation transformation. code, however there are image transformation with transformation with error transformation with error free.
(20%)
some relevant codes are error free. However, there free. There are shortcomings Also, good process flow during
CLO 1 : Demonstrate theoretical and practical knowledge for

implemented. are some bugs occurred for the flow during runtime. runtime.
acquiring, processing, and storing of digital image data.

during runtime.
2(b) Validation of No justification on the Brief justifications on the Good justifications on the Good justifications on the Excellent justifications on the
experiments and experiments and results. experiments and results. experiments and results, experiments and results, experiments and results, which
interpretation of results however lack of technical which included some included in-depth discussions
(20%)
details. discussions on the technical on the technical aspects.
aspects.
2(c) Performance No performance evaluation Insufficient performance Good performance Good performance Excellent performance
evaluation on the developed evaluation on the evaluations on the evaluations on the developed evaluations on the developed
algorithms. developed algorithms. developed algorithms, in algorithms, in terms of algorithms, in terms of
(30%)
terms of either compression rate and image compression rate and image
compression rate or image quality. Some improvements quality. Good improvements
quality. are suggested. are suggested.

Total (70%)

Overall score (100%)

Вам также может понравиться