This exam is completely open book. Any material you have at home or on your
computer hard drive is allowed as a reference. However, collaboration with
anyone or accessing the internet is not allowed. Cutting and pasting (other than
your own previous work or lecture material) is not allowed.
Programs should be implemented in an efficient and practical manner. When in
doubt, state your assumptions and use common sense.
When you have completed the exam please submit your files as an assignment
on Moodle. Programs should be in *.cpp format. Other documents should be in
word or pdf format. Clearly label your answers for each question (Q1.cpp,
Q2.pdf, etc.).
Email a copy of your solution to yourself (not me though) as a backup so you
have proof if something goes wrong with your submission.
Please check your files before submitting them to make sure they can be opened
and read on a computer.
Question #1
a) Write a C++ computer vision function with the prototype:
int green_centroid(image &b, double &ic, double &jc, int imin, int imax, int jmin,
int jmax);
The function calculates the centroid (ic,jc) of all green pixels of a RGB image
structure b inside a rectangular window in the image indicated by
(imin,imax,jmin,jmax). See the figure below for an illustration. The function will
return 0 if green pixels are inside the window and 1 if no such pixels are found.