Sie sind auf Seite 1von 7

ECE1016 Computer and Program Design

Take Home Assignment


Trimester 1, 2017/18

Group Members:

Majoring
Lecture
No. Name Student ID (CE/EE/LE/MCE/
Section
ME/NE/OPE/TE)

1.

2.
Interpreting the visual world is one of those things thats so easy for humans were hardly even
conscious were doing it. When we see something, whether its car, or a tree, or our grandma, we
dont (usually) have to consciously study it before we can tell what it is. For a computer, however,
identifying a human being at all (as opposed to a dog or a chair or a clock, let alone your
grandmother) represents an amazingly difficult problem. From https://www.upwork.com/

In view of this, one of the requirement in image recognition is to identify boundaries of object in
an image before the object can be recognized. In this assignment, you are required to write a C
program to create a simple black and white text image as shown in Figure 1(b). The program will
then read the text image into an array and perform edge detection on the text image. The output
will be the text image with the edge of the inner square detected as shown in Figure 2(b).

60 pixels

In text file

40 pixels

(b) Black and white text image (0


(a) Black and white image
represent black and 255 represent
white)
Figure 1 Black and white image

In text file

(b) Black and white image with edge (b) Output - Black and white text image. The
edge is represented by white line (255)

Figure 2 Output of edge detection


Complete the tasks below for your assignment:

i) Write a C program to:


a. Write black and white text image of size 60-by-40 (0 represent black and 255 represent
white) as shown in Figure 1(b) into a text file, for example input_image.txt.
b. Read the text file into image array of 60-by-40.
c. Perform edge detection on the image array by convolving the image array and a mask
defined in the C program as below. Please see Appendix 2 for more details on
convolution.
short quick_mask[3][3] = {{-1, 0, -1},
{ 0, 4, 0},
{-1, 0, -1} };
d. Write the convolved image array into a text file, for example output_image.txt. (e.g.
see Figure 2(b)).
ii) Comment of the result for both input image and output image.
iii) Write a report comply to the general instruction given in Appexdix 1 and submit by 15-
Sept-2017.
Appendix 1A

ECE1016 Computer and Program Design


Take Home Assignment
Trimester 1, 2017/18

Group Members:
Task assigned
Majoring
No. Name Student ID (CE/EE/LE/MCE/
ME/NE/OPE/TE)

1.

2.
Appendix 1

A. General instructions

1. You must work in a group of 2 people.


2. You are required to prepare a report (Maximum 10 pages excluding coding) for the assessment.
3. Report specifications: Font size: 12, Font type: Times New Roman, Line spacing: 1.5. Top, Bottom,
Left, Right margins should be 1. Kindly include page numbers.
4. Please make sure that you use the sample cover page as provided in Appendix 1A.
5. Your report should contain the following sections in the order given below:

Section 1: Introduction (general specification of the program)


Section 2: Program coding
Section 3: Result and discussion

6. For Section 3, you can use screen capture to copy the program output and paste it in your report.
Explain and discuss the output in your report.

B. Submission
1. Each group should have the cover page provided in Appendix 1A.
2. You must submit the hardcopy of the report. (Each student submit a report)
3. Submission deadline: 15-Sept-2017, before 4.30pm.
4. No late submissions. Any late submission will automatically receive 0 marks for all group
members.
5. Submit the HARDCOPY report to Dr. Hezerul Abdul Karim (BR2032) or my pegion
hole.

C. Assessment

1. Grading of the report will be based on the following:


a. Substantive content (how informative it is)
b. Appropriate organization (overall report)
c. Use of allotted report size (within the page limit)
d. Clarity of the report
e. Proper discussion on programs output.
2. The breakdown of assessment scheme

Assignment Max. Marks Comments


Section 1 (15%)

Introduction (general specification of the 15


program)

Section 2: (60%)

Program coding and discussion


1. Correctness 20
2. Structure
Proper declaration of variables 20
Proper use of program structure
(sequential/selective/repetitive)
Efficient (proper use of general
procedures/methods)
3. Program comments 10
4. Discussion 10

Section 3: (15%)

Result and discussion 15

Participate in Blended Learning activities 10


in class (10%)
Total 100

WARNING!!!

Plagiarism/Copying of assignment is considered a serious offense!

Do not copy from others, and do not allow to be copied either. ZERO mark will be given to
all involved wherever plagiarism is detected!
Appendix 2 - Convolution
Convolution is a simple mathematical operation which is fundamental to many common image processing
operators. Convolution provides a way of `multiplying together' two arrays of numbers, generally of
different sizes, but of the same dimensionality, to produce a third array of numbers of the same
dimensionality. This can be used in image processing to implement operators whose output pixel values are
simple linear combinations of certain input pixel values.

In an image processing context, one of the input arrays is normally just a graylevel image. The second array
is usually much smaller, and is also two-dimensional (although it may be just a single pixel thick), and is
known as the kernel or mask. Figure A1 shows an example image and mask that we will use to illustrate
convolution.

I10 I11 I12 I13 I14 O10 O11 O12 O13 O14
I15 I16 I17 I18 I19 M1 M2 M3 O15 O16 O17 O18 O19
I20 I21 I22 I23 I24 Convolve M4 M5 M6 O20 O21 O22 O23 O24
I25 I26 I27 I28 I29 M7 M8 M9 O25 O26 O27 O28 O29
I30 I31 I32 I33 I34 O30 O31 O32 O33 O34
Mask Output image
Input image
Figure A1 - Process of convolution image

The convolution is performed by sliding the mask over the image, generally starting at the top left corner,
so as to move the mask through all the positions where the mask fits entirely within the boundaries of the
image. (Note that implementations differ in what they do at the edges of images.) Each mask position
corresponds to a single output pixel, the value of which is calculated by multiplying together the mask value
and the underlying image pixel value for each of the cell in the mask, and then adding all these numbers
together.

For simplicity, the border of image is ignored in the convolution. So, in the example, the value of output
pixel, for example O16 and O17 will be given by:
O16 = I10M1 + I11M2 + I12M3 + I15M4 + I16M5 + I17M6 + I20M7 + I21M8 + I22M9
O17 = I11M1 + I12M2 + I13M3 + I16M4 + I17M5 + I18M6 + I21M7 + I22M8 + I23M9

For more information, please refer to Chapter 5 (Basic Edge Detection) of the Image Processing book that
can be downloaded from MMLS. Specifically, refer to page 436 for the source code on convolution.

Das könnte Ihnen auch gefallen