Starting from:

$30

CS1022-Matrix-Convolution-ARM-Assembly Solved

Introduction
In each of the template Vision projects accompanying this assignment, an image of the (old) TCD crest has been stored in memory using an RBG (Red Green Blue) colour model. The image is stored as a two-dimensional array of word-size values. Each word-size value corresponds to a single pixel in the image. The Blue, Green and Red components of a pixel are stored in bytes 0, 1 and 2 of the word-size value respectively (with byte 0 being the least-significant byte and byte 3 being the most significant byte). Byte 3 (the most significant byte) is not used and is always zero.

You are asked to design, write and test three subroutines to manipulate the image stored in memory. In each case, your solution must make use of further subroutines and must demonstrate problem decomposition.

A number of other subroutines are provided to assist you and the labels and interfaces for these subroutines are shown in Table 1.

Part 1 – Brightness and Contrast [20%]
The brightness of the pixels in an image can be increased (or decreased) in a simple manner by adding a positive (or negative) constant value to the red, green and blue components of each pixel of the image. Similarly, the contrast can be adjusted in a simple manner by multiplying the red, green and blue components of each pixel by a constant value.

The formulae below express how the Red (R), Green (G) and Blue (B) components of a pixel at coordinates i,j might be be modified to change brightness (β) and contrast (α). Note that the

subroutine label
interface
getPicAddr
; getPicAddr subroutine

; Returns the starting address of an image stored in memory

; Parameters             none

; Return values R0: starting address of image
getPicWidth
; getPicWidth subroutine

; Returns the width in pixels of an image stored in memory

; Parameters             none

; Return values R0: width in pixels
getPicHeight
; getPicHeight subroutine

; Returns the height in pixels of an image stored in memory

; Parameters             none

; Return values R0: height in pixels
putPic
; putPic subroutine

; Displays the image stored in memory on the LCD

; Parameters             none

; Return values none
Table 1: Subroutine interfaces

contrast is decreased if α< 16, increased if α> 16 and is unchanged if α = 16.

Ri0,j  Gi0,j  

Bi0,j  

Design, write and test an ARM Assembly Language subroutine that will adjust the brightness and contrast of the TCD crest image stored in memory. Take care to handle cases where the adjustment causes the value of the red, green or blue components to exceed 255 (or fall below

0).

Part 2 – Blur Effect [25%]
A “motion blur” effect can be applied to an image in a simple way by replacing the Red, Green and Blue values of each pixel with the average of the corresponding colour channels from the pixels in a line through each pixel. For example, in Figure 1 below, the pixel marked  is replaced with the average colour of the diagonal line of shaded pixels. (Note that the original pixel marked  is also included in the average.)

The “blurriness” of the resulting image is determined by the radius of the effect, r, in pixels. In the example in Figure 1, the radius is 5 pixels. The image in Figure 2 illustrates the effect on the TCD crest.

Alternatively you can try any other type of blur that you want. The only stipulation is that the

 

Figure 1: The shaded pixels are used to compute the new value of the pixel marked .

Figure 2: Motion blur effect applied to the TCD crest.

output value of a pixel must depend on the input of at least 1 pixel other than itself. Some possibilities are Gaussian blur, posterisation , pixelisation.

Design, write and test an ARM Assembly Language subroutine that will apply a motion blur effect parallel to a diagonal line from the top-left to the bottom-right of the image (or other blur effect). Test your effect using different radii.

Part 3 – Bonus Effect [30%]
Design, write and test a subroutine that will apply an effect of your choice to the TCD crest image stored in memory. Try to choose an effect that requires each pixel to be replaced with a value based on other pixels. (The blurring effect above replaces each pixel with a value based on other pixels but the brightness effect above does not.) Marks will be awarded for the quality of your solution and also its sophistication. (More complex effects will attract more marks.) Examples of more complex effects include: (i) sharpening, (ii) another type of blurring, (iii) edge detection, (iv) unsharp masking or (v) generic application of a convolution matrix (vi) lens effect.

More products