Scenario LSA: Software development for identity recognition in an airport security system.
Airport security is now a huge issue, with identity being one of the key issues. A particular problem is associating those that check in with those that are arriving at the gate. You are being asked to develop the software for a system which will take an image and encode it, following a predefined (but changeable daily) key. This image can then be printed onto the boarding pass and decoded at any point in the airport but cannot be easily forged by those wishing to circumvent the system.
You will need to develop a program that loads a jpeg image (.jpg) from a file and carries out a number of defined operations on the image to encode or decode it and then saves the image as a 8 bit resolution RGB bitmap image (.bmp) with dimensions 240 x 240 pixels. The operations are defined as a text file which your code must also load and then execute.
You are required to use Matlab. In Matlab you simply use the builtin ‘imread’ and ‘imwrite’ functions to load and save images. You can also plot the image using the ‘image’ function.
img=imread(‘testimage.jpg’); figure(1),image(img) imwrite(img,testimage.bmp’,’bmp’)
For this version 1.0 of your software you will need to develop algorithms and code in Matlab to carry out the following operations on a greyscale image.
The image you load in will not necessarily be of the right dimensions. This method should crop out the centre of the image such that it is 240×240 pixels.
This method should apply a specified operation to each tile of an image. It should take in a parameter that specifies the number of tiles in the horizontal direction to break the image into (each tile is square i.e. width (pixels) = height (pixels) thus the number of tiles in the horizontal direction equals the number of tiles in the vertical direction) and a parameter that specifies the operation that is to be applied to each tile as well as the parameter specific to that operation. Valid tile operations are Rotate Image, Reflect Image.
This method should divide the image into tiles and then move the tiles to new positions as specified. It should take in the filename of the code file which describes the new positions to shift the tiles to. The code file is a comma delimitated list of numbers. The length of the list is equal to the number of tiles that the image should be divided into. The tiles of the image are labelled sequentially from the top left corner as shown next page for an image divided into 9 tiles.
The code 4, 3, 6, 2, 8, 1, 7, 9, 5 would produce the following shuffled image
This method should rotate the image in a anti-clockwise direction. It should take in a single parameter that determines the angle of rotation (valid options: 0,90,180,270 degrees).
This method should invert the colours of the RGB image.
This method should swap the RGB colour components. E.g SwapRGB(‘RG’) should interchange the red (R) and green (G) colour components.
This method should reflect the image or tile about the specified axis. It should take in a single parameter that defines the axis about which the reflection takes place (valid options:horizontal, vertical, forward diagonal (/), backward diagonal (\))
Encoding/Decoding text file format
The encoding/decoding key which describes the sequence of operations that need to be carried out on the image to encode or decode it will be provided as a text file with the following comma delimited format. You will need to load in this file and parse it to obtain the correct sequence of operations.
File name: encodekey.txt or decodekey.txt
File Format (Comma delimited list of the form): “header, operation, parameter, operation, parameter, operation, parameter, …”
Header: encode or decode
Valid Operations: tile, tile shuffle, rotate, invert, reflect, swapRGB
Example: “encode, rotate, 90, invert, reflect, forward diagonal, tile, 20, rotate, 180, reflect, vertical, tile shuffle, code”
Valid Parameters: Tile: integer
Tile Shuffle: codefile.txt (comma delimited list of integers, the length of which determines the number of tiles).
Rotate: 90, 180, 270, 0
Invert: no parameters
SwapRGB: RG, RB, GB
Reflect: horizontal, vertical, forward diagonal, backward diagonal
e.g. The key file “encode, rotate, 90, invert, reflect, forward diagonal, tile, 20, rotate, 180, reflect, vertical, tile shuffle, code” specifies that the image should be encoded using the following steps: first crop image to 240×240 pixels if necessary, then rotate by 90 degrees anticlockwise, then invert the colours, then reflect about the forward diagonal, then divide into tiles 20 across and 20 down (i.e. each tile is 10x10pixels) each of the tiles are then individually rotated by 180 degrees clockwise, then the entire image is reflected about the vertical axis, finally the image is divided into four tiles (i.e. 2 across and 2 down) and shifted according to the code in the specified code file. Note the tile method, implements the only the method specified immediately after it on each tile, thus, the key for two consecutive tile operations would be for example “tile, 20, rotate, 90, tile, 10, reflect, horizontal”.
The design validation will be a test of the capabilities of your software. You will have to perform the following:
The final report is in the form of a system user guide and should be a 1000 words long. It should include the following:
• Introduction and system overview
• User guide, describing how the programme is used
• Description of the structure of the entire program and how it works (not actual