**Part 2J: 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?

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

Section 2 Part J Quorum Commands – PDF

**1. Commands for VALUES of different Pixels**

a) Start your command lines with say or output (a mixture is used below) to see or hear the values you are extracting in the output box. The first three commands are given below:

***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 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.

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 your journal 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().

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.