The objective of this assignment was, using good object-oriented principles and practice, to design and implement a “Nearest-Neighbour Search”. I was awarded a 2:1 for this project.

Task Brief

I had to use NN-S to find which part of an image matched another given reference image.

Demonstrating object-oriented principles in the program, I had to:

Write a C++ program to search for the location of a reference image in a larger image

The images provided were in .txt format. That is, each pixel was represented by a value from 0 – 255 representing a greyscale colour.


  • .txt format large “Where’s Wally” image (Type: Large_Image)
  • .txt format reference image (Type: Ref_Image)
  • C++ code to read in the .txt format images
  • C++ code to write your output into a .pgm format image

The solution needed to contain at least three classes arranged in a hierarchy as shown here:

  • Base_Image class
    • Large_Image class
    • Ref_Image class

To Complete:
1) A C++ solution which matches a reference image to a location in a larger image
(as well as you can)
This solution should be the complete VS project, allowing it to be opened
and run in VS.
2) Your C++ solution should contain:
A Matrix class (containing: constructors, a destructor, operator overloads,
Inheritance hierarchy as shown above
3) The “Where’s Wally” large image showing his location as an outlined or
shaded area from the algorithm running in your code.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s