M) Manipulation of Matrices 2

Chris introduces Part M in this :30 video by refering back to the board with an “L” on each side.

*******************************************************

A PDF of a text file of the commands of this Part, Part M, is available at this link:

The list of all the Quorum Matrix Commands is linked here again for your convenience:

********************************************************

Having more than one image allows brightness values for objects to be added together. How could you assure that the same positions were being added together? Let’s try some matrix manipulation to give us an idea of what could be done. Later in this section we will try some image manipulations in Afterglow Access.

If you use the same Quorum Box as the previous part, you can use the matrices you have already defined, just delete the rest of the code you typed in from the previous part. Or just open a new Quorum Box (recall: Whenever you open a Quorum Box for Matrices using the link, you will see the code you have already done – it will not be blank. You may reset it, or keep what you need and delete the rest – the link below is for your convenience). Make sure the first command is:

use Libraries.Compute.Matrix

I will use my first matrix, m1. Output the original matrix, and then a “space” so you can compare it to the result. Please use the “say” command if that is more convenient.

1. SHIFT Command

output m1:ToText()

output “space”

output m1:Shift(2,3,0.0):ToText()

Compare the two matrices. Did it do what you imagined? Comment in the JOURNAL BOX below.

This is what happened with the Shift COMMAND: we first specified the number of rows to shift down by, then the number of columns to shift over by, and the last number told Quorum what number to fill in the new rows with.

Let’s define the output of the shift as a new matrix. See if you can remember before looking at the example that follows.

Matrix m1s

m1s = m1:Shift(2,3,0.0)

output m1s:ToText()

****************************************************

The first 38 seconds introduces the Flip commands. You may then follow along for step by step instructions or skip to below the video to follow the typed instructions.

2. FLIP Command

Afterglow Access has the ability to flip vertical or horizontal. Do you remembering trying that when looking at the Display Settings on Afterglow Access (AgA)? If not, go to AgA and try using that setting with any image.

Now try Flip with any of the the matrices you have defined above. If you use the example below, make sure you use the name of your matrix! Again, follow the video for more detailed instructions if you would like.

output “space”

output m1:FlipVertical():ToText()

Examine the flipped matrix. How did it change? Record in the JOURNAL BOX below.

Now try to flip it in the horizontal direction. Recall, this command will use the matrix m1 you defined previously, not the ‘FlipVertical’ matrix you made when you used that command – unless you saved it as a new matrix.

output “space”

output m1:FlipHorizontal():ToText()

Examine the new matrix. How is it different from the vertical flip? Also relate it to the image orientation activity you did with the “L”. Can you show each other the “L” flipped vertically and horizontally? Are you correct? Record in the JOURNAL BOX below.

*******************************

Chris introduces the Reshape command in the first part of this 3:19 video. Then you can follow his step by step instructions, or skip to the instructions below the video.

3. RESHAPE Command

This command allows you to move the matrix down any number of rows from the first row, and then move it over any number of columns from the first column. Study the example below and discuss what you think will happen before trying it.

output “space”

output m1:Reshape(2,3,7,7,10):ToText()

In this case, you shifted the original matrix down two rows and over three columns: it is now a 7 x 7 matrix.

– The new rows and columns have been filled in with the value of 10.0, and will just drop the part of the original matrix that has been shifted out.

********************************

Chris introduces the idea of Transpose in the first 1:10. Then you can follow his step by step instructions, or skip to the instructions below the video.

4. TRANSPOSE Command

What do you think happens here? Let’s try it:

output “space”

output m1:Transpose():ToText()

Examine the new matrix. Describe what took place. Is it what you expected? Type your answer in the JOURNAL BOX below.

********************************

Chris introduces the idea of Rotate in the first 29 seconds. Then you can follow his step by step instructions, or skip to the instructions below the video.

5. ROTATE Command

This does exactly what you think, either to the left or right. How many degrees does a ‘rotate’ mean? Try it and enter your answer into the JOURNAL BOX below.

output “space”

output m1:RotateRight():ToText()

output “space”

output m1:RotateLeft():ToText()

You will have the opportunity to align two matrices towards the end of this section, Section 2.

************************************

JOURNAL BOX

Optional CHALLENGE:

Use the Quorum Box below with the more complicated preloaded matrix to test out these same commands. Did you get what you expected?

********************************************

QUORUM BOX for Challenge exercise

Previous Page ** Next Page