2I

I) Exploring Images 2
Chris discusses some ideas about managing the counts in a matrix in this 1:30 video.
*********************************************************
A PDF of a text file of the commands of this Part, Part I, is available at this link:
1. MANAGING THE COUNTS OF A PIXEL
Why might an astronomer need to display a different value in selected pixels of an image?
See if you can come up with a couple of ideas. Record in the Journal below.
a) COMMAND: The “Set()” command changes the value at a given point in the matrix:
Again, have two windows open; the instructions, and the Quorum Box for Matrices. Arrange how it best fits your vision. You can just add on to the commands already there. Again, be careful of copying and pasting. You may get Build errors.
**NOTE: 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.
m1:Set(2,3,5)
This Set() command changes the pixel value displayed at row 2, column 3 in the matrix m1, to a value of 5.
To see the result, use the “Get()” command, which finds the value at that position and outputs it, as done in the next line:
output m1:Get(2,3)
– You can also “say” the result, OR assign it a number variable and then output the variable.
b) Try to change the value at another point. Make sure the output is what you expected.
c) What happens if you try to “Get()” from a position not in your matrix? Try it and see what happens. Record the result in the Journal Box below.
*************************************************************************************
Chris discusses other information that can be extracted from matrices in this 1:43 video.
2. SIZE OF MATRIX (or, size of image)
What is the importance of knowing the size of your image?
Answer the questions in the Journal below.
i. Are images always square? Why or Why not?
ii. Are images all the same size? Why or why not?
a) The COMMAND “GetSize()” gives the total number of pixels.
m1:GetSize()
This is an integer created by multiplying the number of rows by the number of columns. The empty parentheses means no input is needed to perform this function.
b) Again, to see the result, you can output or say the command. The result is not a matrix, so no need for the ToText() command.
output m1:GetSize()
c) ‘Get’ and output the size of all the matrices you have in your Quorum box.
3. DIMENSIONS OF A MATRIX (dimension of an image)
a) The dimensions are used when comparing two images.
m1:GetColumns()
This command does not output anything to the console output window unless you tell it to do so. Give it a try, either in one line of code, or by assigning a variable to output.

b) The next command gets the number of rows of m1. What do you need to do to see this number? Give it a try.
m1:GetRows()
How do any of these commands relate to Afterglow Access? The Image Orientation Options, found in the Display Settings panel, can manipulate the position of, and the number of, rows and columns. Therefore, the software has a need for knowing these values. Again, we will explore the settings of Afterglow Access in a later part. For now, let’s look at some more of the underlying commands that Afterglow Access uses “behind the scenes”.
4. CONTENTS OF A ROW OR COLUMN
a) The previous commands retrieved how many rows or columns the matrix contained. This next command outputs the CONTENTS of any row or column. Notice how this is different from the previous command.
output m1:GetRow(0):ToText()
Examine what is returned to you in the output console window. Then, answer these questions in the Journal Box below:
1) Why was the output command used?
2) Why was the ToText() command used?
3) Using words in a sentence, type the result seen in the console output window into your journal.
output m1:GetColumn(3):ToText()
4) How does the above command’s output appear in the console output window? Why?
5) Type the result as a sentence into the Journal Box.

*******************************************************************
JOURNAL BOX

  • Previous Page ** Next Page