Fixing GH2 stuck green pixels

Started Jan 19, 2011 | Discussions thread
Flat view
bg2b Contributing Member • Posts: 897
Fixing GH2 stuck green pixels

(See the long thread referenced below if you don't know what the problem is.)

First, a huge thanks to Dave Coffin for writing dcraw and making the source code available. If you get some use out of this fix, please consider throwing a few bucks his way:

I modified dcraw to fix the stuck pairs of green pixels in GH2 RW2 files. Then Lightroom takes care of the rest of the stuck pixels on its own.

Here's the source code (in C):

Here's an executable for Mac OS X 10.5.8. I have no idea if this will work on anyone's system but mine. Besides, everyone knows you shouldn't download and run random binaries from the web :)...

Windows users will have to compile your own, sorry.

How to use it...

1. Download and compile the gh2dcraw source code, or try the executable if you feel lucky. The compilation command is given at the start of the file, or see the dcraw page above if you don't have the lcms and jpeg libraries. You can diff with the latest dcraw source to see what I changed.

2. Set RAW mode, manual mode with a high shutter speed, manual focus, and some high ISO like 800 or 1600 or 3200. Leave the lens cap on. Take a picture. Get the RW2 file on your computer, and call it "black.RW2".

3. Run the command "gh2dcraw -x badpixels black.RW2". That will produce a file called "badpixels" that has the coordinates of the stuck pairs. Or more precisely it has the coordinates of the first stuck pixel in the pair, and the second is the one diagonally down from it. The stuck pixels are idenitified as being pairs where both are more than 10 standard deviations from the mean of the black frame. You can change the threshold in routine gh2_find_stuck if you want to be more or less agressive in what's considered stuck.

(You only need to do steps 1-3 once, but maybe you'll want to have a separate stuck pixel file for different ISOs, or for long exposures, or whatever. If you're really into nit-picking and you notice something that was missed, you can just add the coordinates to the stuck pixel file with a text editor.)

To fix a RW2 file:

1. MAKE A COPY OF THE ORIGINAL RW2 FILE . I have tested this program on the small number of images that I've taken, but that's hardly a guarantee that it's bug free! This program overwrites RW2 files , and if you hit a bug, your precious shot of aliens kidnapping Elvis will be trashed. Do not blame me if this happens. Use at your own risk. Do not taunt Happy Fun Ball. MAKE A BACKUP .

2. Did you make a copy? If so, then...

3. Run "gh2dcraw -2 badpixels copy_of_my_precious.RW2". The RW2 file will be overwritten!

4. Import "copy_of_my_precious.RW2" in Lightroom and bask happily in the non-stuck glory of your wonderful cat photo.

If you run into a problem with some RW2 and can make the file available somehow, I'll try to fix the issue. Or you can do like in Star Wars: "Use the source, Luke."

The original thread describing the problem:

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