This is an old revision of the document!
L07. For expressions
In this lab, we will use matrices to encode Bitmap images. The format is called BPM, and more details are available here. Our format will be grayscale only. Each pixel of the matrix is encoded as an integer, with values from 0 to 255. Some examples are shown below:
0 0 1 0 0 0 1 0 1 0 0 1 1 1 0 letter A 1 0 0 0 1 1 0 0 0 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 shader 5 4 3 2 1 5 4 3 2 1
Add the following type definition for the rest of your lab:
type Img = List[List[Int]]
Also, in order to benefit from visualisation, instead of using a worksheet, you can create a new Scala project, containing an object with a main method:
object Matrix { // define your functions here def main(args: Array[String]) = { // write your tests here } }
7.1. Write a function