Examining Video Non Linearity with Tangra


This articles gives an example of how one can detect and possibly measure the gamma correction applied/introduced by their video recording system. Most of the time the non linearity will come from the video camera but could also be added by the video grabber or recorder . However having said that I haven't actually seen grabber or recorder to apply/reverse gamma however this is entirely possible and should be tested to be excluded.

This article also shows an accidently discovered anomaly with Average Background computations for objects with changing brightness that was found in both Tangra and LiMovie. Further tests will be required to study this anomaly further.


The idea is that the observer records a very close miss of asteroidal occultation where the star and asteroid have similar brightness. It is best if the merged asteroid and star do not produce saturated image. Once the video is recorded with the system with unknown gamma/non linearity then the observer reduces the light curves of the merging objects and two comparison stars and examines the normalized light curve of the star and asteroid. If the system doesn't apply gamma correction then the curve should be a flat line. If the curve shows a gradual dip or a hump then this is an indication of non linearity. This is how we detect non linearity - most probably gamma corection.

To measure the value of the applied gamma now the observer does the measurements again but this time reversing a pre selected value of gamma before doing the second measurement. If the correct value of gamma is reversed then the produced star-asteroid light curve should be now a flat line. Usually the applied gamma is 0.45 or 0.35. The first value is known as LO gamma and the second is known as HI gamma. If the observed non linearity is a hump then something in the system may be reversing gamma from the signal which doesn't have gamma applied in first place. In this case the 'applied' gamma will be 2.22 (1/0.45) or 2.86 (1/0.35). Finally if the non linearity is not caused by gamma correction then even after trying to reversing gamma with any of the above given values the light curve will still not become flat. I haven't seen such a case yet but again this should not be excluded as a possibility.

Equipment, Observation and Data Reduction

In my small experiment I recorded (37) Fides missing 2UCAC 40984281 on 7 Apr 2011 from 9:19 UT to 9:26 UT. I used an 8" LX90 with a WAT-120N+ video camera configured to use LO gamma, 16 frame integration and maximum gain. The video was recorded on a DVR that writes directly to a hard drive using MPEG4 compression. The star was magnitude 11.4 and the asteroid was 12.0. The image below shows the star and asteroid before the close approach.

I then reduced the video using Tangra. For this I used a large manually positioned aperture for the asteroid-star pair. I measured the interval between 9:17:35 and 9:25:11.


I then binned the data in bins of 16 measurements and normalized the data using the yellow star. This star was bright but not saturated. I then left only one comparison star (not the one used for normalization) and the asteroid and got something like this:

It is clearly evident that the light curve is not flat and this indicates presence of non linearity in this case caused by the LO gamma correction of the video camera. The reason to get such a light curve is because after the linear intensities (corresponding to electrons) have been added up being collected in the same CCD wells (due to the merging of the objects on the sky) a gamma has been applied to each CCD well before it has be transformed into a pixel from the video. Because of this the ratio of the intensities of the different CCD wells is not the same as the ratio of the resuling video pixels. As a result the measured intensity (the sum of the pixels) of the merged objects is not equal to the sum of the pixel intensities of the separated objects. And this is what creates the gradual dimming.

Now that non linearity was observed I tried to correct this by reversing the gamma of 0.45 which I know that was applied by the video camera. For this I did a Quick Re-Process of the light curve specifying an Encoding Gamma of 0.45. This time the light curves looked flat.

Average Background Inconsistency

To be precise the light curved looked almost flat. If we look more carefully the image above we can still see a small dimming of about 50 intensity points that begins around frame 18,500.

To further test this non linearity I now plotted the same light curves but instead of Signal-minus-Background I now used Signal-Only data. Well looking at this light curve I could say that the non linearity now appears to be gone.

And if the Signal-minus-Background shows non linearity but the Signal-Only doesn't then the obvious cause was the background. And indeed looking at the light curve of the Background-Only measurements immediately showed a gradual increase in the background readings of the mearging star and asteroid. Because of this when the background was subtracted from the signal this created a dimming effect.

My next step was to try a different method to measure the background. So I did another Quick Re-Process in Tangra this time using Background Mode. This time the noise in the background was higher but the non linearity seemed to be gone. Examining only the blue light curve under magnification did not show a gradual increase/decrease trend. I also measured the background using the PSF Background method and again did not see a trend.

So seems that the Average Background method was somehow creating a non linearity or was being affected by the brightening of the merging star and asteroid producing higher readings. Tangra measures the Average Background from an automatically placed annulus around the measuring aperture which starts (by default) from 2 signal apertures from the center and contains at least 350 pixels. To picture this the screenshot below shows the background annulus. This looks to be too far from the star and asteroid but can the brightening of the mering object really increase the average brightness in an area that is that far away from the center? This corresponds to an area of 12 to 16 pixels away.

My next thought was that the Average Background measurements in Tangra may not work correctly. So next I used a different measurement tool to reduce the same video. For this I used LiMovie 0.9.29b and used the following measuring apertures:

I only wanted to compare apples to apples so I configured LiMovie for Gamma Reverse Correction of 0.45 and measured the same interval. I then expored the data in CSV and produced normalized data of the measured background of the merging stars and the backgrund of the third object. I then plotted the data in Excel and the results were pretty much the same. While the red background plot of the purple object does not show a variation i.e. is flat line, the blue background measured for the merging asteroid and star clearly showed a trend up.



Gamma can be measured videoing a merging asteroid and a star. If there is no gamma then the light curve should be flat line. If there is gamma correction the light curve will show a dip or a hump. Reversing the correct value of gamma (which is most probably 0.35, 0.45, 2.22 or 2.86) before a second measurement will now make the light curve flat line.

It was also observed that the Average Background of the merging objects did not stay consistent during the merging/brightening and this was detected in both Tangra and LiMovie. The current experiment however could not rule out that this was not something to do with the reversed gamma corrections. However Background Mode and PSF Background measured for the same gamma reversed video did not show anomaly so the current hypothesis is that the anomaly has something to do with the Average Background and the brightness of the area up to 15 pixels away from the merging asteroid and star. In the current scenario the measuring aperture was 6.25 pixels which corresponds to an area of 123 pixels. The observed total increase of the average background was around 50 intensity points. In order to get such an increase each pixel from the background should have increased in brightness by about 0.4 points. This is something beyond the ability of a human to notice on the video and could be only picked up by an automated measurement. The nature of the increase in brightness remains unexplained. More tests with Gamma = 1 are needed to reproduce this anomaly and to exclude the reverse Gamma correction as possible factor that could have affected the measurements.

I am planning to do a series of experiements that will focus on comparing very precise background measurements using the different background measurment algorithms.

Hristo Pavlov, 8 April 2011