Magenta edge tinging at high ISO and a possible solution...

Started Aug 17, 2009 | Discussions thread
GordonBGood Veteran Member • Posts: 6,308
Re: Magenta edge tinging at high ISO and a possible solution...

dlacoutu wrote:

Thanks again for the effort!

Dominique, just a request for a little support from you if you get some time in the next day or so: Could you email me (email address in profile) with a link where I can download one of your ISO 6400 lens cap on DNG shots for use to confirm that the program does what I think it does, as I don't have a K20D myself. You may as well send me a PEF file as well so I can do the same for it, too, as I plan to support PEF in the near future. I can confirm that the general correction algorithm is working from the raw sample images available from Imaging Resources ( ) and can even see that my White Balance (WB) "smudge" is effective as there are lots of white areas in test samples, but I can't really prove that the magenta is greatly reduced unless the erroneous magenta is about the only thing in the image.

Also, you mentioned that you shoot images with UniWB (for others, do a search on this forum or the Internet to see what that means) so that As-Shot WB values don't have much meaning to you. Given this, what program do you use for raw conversion, how do you determine WB, and how did you show that after correction there was left a green tint. It would seem to me that this would indicate that you implemented the test correction in JPEG colour space after you had already developed the image with some sort of manual WB?

Briefly, the magenta edge tinging is caused by positive drift of the black offset of the colour channel raw data, which is not being properly compensated in-camera to have an average = mean =~ median value of zero, especially with regards to this offset drift.

As this is turning into a bit of a development blog for the project, I will describe the correction algorithm in a little detail, as follows:

  1. Read in the raw file format and parse it enough to confirm that the file is from a supported camera (currently K20D and maybe later the K-7) and that the tags are complete enough to be able to read the raw data, as well reading the ISO sensitivity from the EXIF (if necessary) and the As-Shot Neutral (WB) values for the RGB channels as well as the location in the file where the As-Shot Neutral and the raw data are located.

  2. Read the raw data and decompress/unpack it as necessary.

  3. Apply the correction using the masked black photosites on the right to be applied to the horizontal rows in landscape orientation and (possibly, if effective, the same correction using the masked black photosites at the bottom of the sensor in landscape orientation. It appears that the K20D scans some channels horizontally and some channels vertically, and this is the likely explanation for why there is both Horizontal and Vertical Pattern Noise (HPN and VPN) . It appears that the red and blue channels are read by horizontal rows and that the green channel is read by vertical columns, with the red and blue channels read from the center of the sensor toward the upper and lower edge while the green channel is read from the right to the left, all for landscape orientation.

  4. For both, the correction consists of determining the best fit straight lines for the channel data as to change of true mean = median, from the center to the top and bottom vertically and right to left horizontally in landscape orientation. Since this data appears to always have the median level slightly offset positively, the median can be determined as that level for which 50% of the readings are either at the level or lower.

  5. The best fit trend line is calculated on the basis of a running window of 256 samples across the black masked photosites of a given colour channel, which will produce several straight line trend lines of which likely only the green(s) will be used horizontally and the vertical four trend lines will be used vertically from center to top and center to bottom for each of the blue and red channels.

  6. The results of these trend lines will be subtracted from all of the rows for the red and blue raw data and from all the columns for the green.

  7. The resulting raw data will be repacked/re-compressed in the identical way as for the original raw data format.

  8. The As-Shot Neutral values will be "smudged" according to the average correction applied.

  9. The magenta corrected data will be written out to a file that is identical to the original file other than the corrected raw data and the "smudged" As-Shot Neutral values will be patched in.

Toward the end of today (as in about six hours from now), I will try to provide a screen shot of what the program looks like and a few comments on its use.

Regards, GordonBGood

Post (hide subjects) Posted by
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow