Waveform monitor
The waveform monitor gives information about the luminance within an image by showing the brightness value of pixels. You can use the waveform monitor to analyse the parts of the image that may be over or under exposed. Ideally you want the brightest part of the image not to exceed 100% brightness and the darkest part of the image not to fall below 0%.
Within Mavis apps a pixel can have a maximum brightness value of 100% and this would be considered over exposed. A pixel can also have a minimum brightness value of 0% and this is considered underexposed. Occasionally you might get a small part of the image that is over or under exposed (e.g. a specular reflection or the sun) but you don't want too much of this. Getting an entire image within this range can be particularly difficult on an iPhone, for number of reasons, so you can use the waveform monitor to give you a proper analysis.
Drawing luminance
The waveform monitor forms a graph that plots horizontal samples running on the X axis against luminance running on the Y axis. As each sample is read the brightness value is calculated and plotted onto the graph.
The animation running above shows a single scanline of horizontal samples. This means we have taken a single frame of video and isolated a single line of pixels. As we read the samples from that line we can plot the brightness of each sample onto the waveform monitor. At the beginning of the line we have black, with a brightness of 0, so we start by plotting 0. We then read in a white sample so we plot 1.0 (or 100%). As we move from 0 to 1.0 we draw a trace between the two values. This is an important step as it make it much easier to see what luminance values are being analysed.
Moving further along the samples we then have black so we plot 0, again drawing a trace between the two points. We then read in a grey sample. This grey sample has an unknown value but using the waveform monitor we can see that this particular grey sample is in fact 50% grey. We know this because 0.5 (or 50%) has been plotted onto the waveform monitor.
One important thing to remember is that we are drawing a trace between each pixel analysed. It is this trace that is used to build up the final graph shown on the waveform monitor.
Drawing a frame
Now we understand how to plot luminance values onto the waveform monitor, lets see how we analyse and display a complete frame of video. In this example we are drawing a frame that consists of a black background with three solid white bars - two white bars are in the first set of scanlines, one is in the second.
Starting at the top of the frame we first analyse and draw a single scanline of horizontal samples. This is drawn on the waveform monitor as a faint trace. As we move down each scanline we draw another faint line on top of the last. As the trace gets more prominent you can see two peaks appear which correspond to the two white bars that are in the first set of scanlines.
As we draw the second set of scanlines a third peak is drawn on the waveform monitor. This peak corresponds to the single white bar in the second set of scanlines. Finally once the complete frame of video has been analysed we end up with three peaks, one for each white bar. You will also notice that the peaks show a luminance value of 1.0 (or 100%) so we know that the solid white bars are pure white.
This process happens for every frame of video so its happening imperceptibly fast. When you see a waveform monitor analysing real video you'll see the graph constantly changing to reflect the current frame of video. You will also see on the Mavis waveform monitor that the trace is not green, rather, we have drawn it to reflect the corresponding colour value of each sample.
Real-world example
For a real-world example of how to use a waveform monitor we can use the MAVIS hero image. The image below highlights the part of the waveform that shows the over exposed sun. Use your copy of MAVIS and have a go at trying to work out what parts of the image are over/under exposed. Point MAVIS at a window or bright object and move it around the frame. See what happens as you increase or decrease the exposure. Remember the idea is to use the waveform to inform you about luminance within your image.