J) Exploring Images 3

There is a lot of information stored in a matrix, which is our model of an image stored in a computer. The tools we use in Afterglow Access use the information stored similar to the practices below.

In this 2:09 video, Chris discusses other pieces of information which can be extracted: the biggest number value in the matrix, the smallest number value, and the total value of all the numbers in the matrix added together. He also talks about Mean/Median/Mode.

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

Open Afterglow Access if you do not already have it open. Then THINK about the following questions before continuing.

a. Brainstorm, with others if possible, as to which AgA Display Settings might use the values Chris talks about in the video.

b. Why might these values be useful?

If desired, record some ideas in the Journal Box below.

para7003: >

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

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

para71: >

1. Commands for VALUES of different Pixels

a) Start your command lines with the say or output (a mixture is used below) to see or hear the values you are extracting in the console output window. The first three commands are highlighted below the Quorum Box link:

***Again, use the same Quorum box you have been using for Matrices (or open a new one at the following link, but 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.

output m2:GetMaximum()

say m2:GetMinimum()

output m2:GetTotal()

Notice the commands do not need anything in the (). You just need to state what matrix you want information from.

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

2. Commands for finding STATISTICS of your Matrix

a) Mean/Median/Mode have similar commands. These are used in the coding of the AgA settings that change the display of the image in the viewport.

Recall from math class what these are:

i. Mean – average of all the values

ii. Median – middle number of all the values

iii. Mode – the value that occurs most often. There can be more than one mode.

b) The output of GetMean() and GetMedian() are numbers, so you can assign these to number variables.

c) The output from GetModes() is a number array – a set of numbers – which can’t be used with output or say. Instead, we use GetModesAsText() which converts the number array into text, which then can be used with output or say.

Think of a reason you might want to assign variables to these commands instead of just outputting the answer. (Hint: Think math class and equations!). Use the Journal Box to record your reason.

number mean = m2:GetMean()

output mean

number median = m2:GetMedian()

output median

output m2:GetModesAsText()

Again, the GetModes() command does not output a number since there may be more than one mode; we use GetModesAsText() so output can use it.

Try the above commands on any of your matrices. If you copy and paste, be careful of added spaces and symbols which may copy incorrectly.

The commands we have been using on matrices are similar to the commands the software program uses behind the scenes on the data arrays from the CCD cameras stored in the computer. All the information is used in mathematical equations (algorithms) that display the brightness values (counts) of the pixels in different ways. A setting or tool, which is essentially a group of algorithms, may be set to display values of different ranges, for example, to possibly suppress bright values, but allow dim values to show up. The mean, median, and mode are some of the variables used in the algorithms to set the range for particular settings. The software program does this for us with the tools we use. The work we have just done with matrices helps us gain some insight into what is going on behind the scenes in the software.

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

JOURNAL BOX

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

3. ACTIVITY

Look at the Quorum Box below. It has code written for a large matrix. Before doing the activity, see if you can figure out what this matrix might look like. Then, use the given matrix to find the following information by writing the codes needed. Add your code to this same Quorum Box.

a. Size

b. # of rows

c. # of columns

d. The contents of row 3

e. The contents of column 2

f. The maximum value in the matrix

g. The minimum value in the matrix

h. The mean, median, and mode of the matrix

i. Output the matrix to your console output window to check your prediction of what the matrix looks like.

j. Comment in the Journal above how your prediction and the actual matrix compared.

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

QUORUM BOX for ACTIVITY

Previous Page ** Next Page