Removing line artifacts using “Black Area” data

After a comment on our de-noising explanation, I finally got around to something I had been looking at doing for a long time, attempting to remove line artefacts in high ISO images.

For each line of the sensor there is an analogue amplifier – where the amount of amplification is determined by the ISO setting. The amount of amplification of each line may however vary slightly, making line artefacts across the image.

Canon and a few other manufacturers have a part of their sensor outside the image covered, so it doesn’t receive any light. It has therefore been assumed that you could use the information from this black area to estimate the amount of amplification applied to a single line. This has been accepted by the community for some time, so I decided to research this to find the best method for compensating for this issue.

For the research test, I took a test image of a fairly uniform lit surface –  a defocused shot of a blue sky. The aim wasn’t to get a completely uniform surface, just get it uniform enough that we can expect adjacent lines to have the same light values.


Test image used, taken on a Canon 5D Mk2, ISO Hi2 (25600)

I then modified RawSpeed to print out comma separated values for one colour component (green) on every second line in both the black area, and 1000 pixels into the image. For each line I have 68 data points in both the black and image area.

After importing the data into a Spreadsheet, I began analysing the data. For estimating the black and light level for each line, I used a median function. This function should be better than a plain average, since it will ignore any values that are way out of range, like hot and black pixels.

I tried the two most obvious methods – first the most commonly accepted method, simply subtracting the black value median for each line,  and secondly estimating an amplification factor of the black area and use that to compensate the image data.

For this image, we can expect adjacent lines to have approximately the same image data lines, since there shouldn’t be any significant change between each line. Right from the start it seemed like there was something wrong, because the data didn’t support the theory, and there didn’t seem to be any clear correlation between the black data and the image data. Here is what I’ve found using the two methods above for calculating image values:

Average absolute difference between adjacent lines with no per-line compensation: 67.9 (Raw value)

Average absolute difference between adjacent lines with per-line compensation (subtract median black): 76.0 (Raw value)

Average absolute difference between adjacent lines with per-line compensation (normalize value based on black amplification): 107.2 (Raw value)

So using black area information actually makes the image look worse, making the line artefacts more visible than they were before. I have checked the code dumping the data several times, and I cannot find any defects. This is pretty discouraging, so it would seem that doing this kind of artefact removal automatically is out of the question.

Here is the data as OpenOffice and Excel spreadsheet.

So for now I have decided not to pursue this method anymore, unless I find evidence for the opposite.

Does anyone have test data or know cameras where this kind of artefact removal actually helps?

Comments (9)

9 responses to “Removing line artifacts using “Black Area” data”

  1. n8willis says:

    Seems like the median might be a good assumption for the image area, but might not be a good assumption for the black area. If I’m understanding correctly, the black area supposedly receives no sensor input, so its un-adjusted values are going to be all error. That could vary significantly more (though maybe over a smaller domain) than valid image data would.

    I haven’t plotted it or anything; I’m just thinking out loud.

    Nate

    • Klaus Post says:

      I did notice a few dead pixels reading 0 or 1, or a similar small value in the black area, so therefore I used the median, since it usually makes sense in a noisy environment.

      Using average gives slightly worse average difference when subtracting a single line (77.1), but improves amplification normalization slightly to 106.4.

      But it is still way worse than 68 for the uncompensated values.

      • n8willis says:

        But I don’t know that random sensor data (such as in the black) would even be normally distributed; I assume it’s “accumulated” so it would have a different shape (poisson? log-normal?); you certainly couldn’t expect it to be centered around 50% — maybe the geometric mean would be more appropriate, I know they use that for signal detection.

        Anyway, it’s been too long since I did any stats…. But now I can’t stop thinking about it….

        Nate

        • Klaus Post says:

          Looking at plots of the black area data, 50% seem like a sweet spot. There are a few values that are quite far away from the others, while most are on a “center line”.

          I did a similar shot at ISO 200, and the result is the same – there isn’t any reliable correlation between the black area data and image data, neither when using average nor median values.

          Excel sheet at:

          http://files.klauspost.com/black-area-test-image-data2.xlsx

          (The raw data show slight left to right gradient in the image data, but it shouldn’t really affect the result).

  2. Anders Brander says:

    I have tried the exact same method some years ago. I came to almost the same conclusion: The blacked out data is useless for this purpose as is :)

    • Anders Brander says:

      I have successfully used blacked out pixels for estimating black level for Canon cameras thou.

      Well. That was before RawSpeed.

      • Klaus Post says:

        Yes, it is very handy for estimating the overall black-level, when you don’t know what the sensor spits out, but unfortunately I cannot see it being useful for eliminating sensor amplification artefacts. :(

    • Klaus Post says:

      Not a useful comparison – it shows nothing. It shows by subtracting random data from random data close to black and clamping it to black gives a more black image.

      Granted, it seems like his camera has more vertical artefacts, but I cannot see why it should give a significantly different results.

      I don’t believe darkframes are the answer either – beside being hugely impractical, they must be taken with the same equipment, at the same time (sensor/amplifier temperature), and ISO/exposure settings. If your darkframe is not 100% correct, you will ADD noise to the image.

Leave a Reply to Klaus Post

Klaus Post on June 20, 2010

RSS feed