Demosaicing Experiements

I’ve been playing with demosaicing, and since my shooting style seems to promote moire and aliasing I have been especially interested in reducing it.

Here it is compared to LMMSE. LMMSE is on the left.

it works by first, demosaicing the image twice. On one the green channel is interpolated horizontally, the other vertically. Then the G-R and G-B is interpolated. This gives two very different moire patterns for each image. Then I choose which part of each image has the least chroma variation using a multiscale approach. This outputs an image with the least moire, and most accurate colours, which is used to guide a final demosaic from the original bayer data.

I’m interpolating the colour differences by using the green channel to guide interpolation direction.

I’ve added minimum chroma demosaicing to my testing folder and hopefully it will propagate through the system

@David_Tschumperle I think I’ve synced it with the repository, do I need to do a Pull request?

3 Likes

@Iain, your filter has been updated it should appear right now after pushing the refresh button.
I don’t have a periodic generation of the update file anymore (since I’ve changed my PC), but this is something I could set up again :slight_smile:

And of course, thanks a lot, that looks really interesting !

Thanks!

That looks interesting. Could you share the raw file to compare it to other methods?

Here is the raw file

https://dl.dropboxusercontent.com/u/10782279/Med%20School%20Ball%202013-07-27_21-32-48.NEF

Why is the overall color grayer than the LMMSE, even in the absence of aliasing?

The LMMSE depicts the jacket as more purple.

The LMMSE was done using RawTherapee and the other one was done by extracting the raw data using DCRAW and then processed using GMIC GIMP plugin. I couldn’t make a comparison to any other known demosaicing algorithms in GMIC, so I didn’t bother to be to precise.

I see.

Also, can you give an example to show how it handles high ISO noise?

I’m very excited about the performance of this algorithm, since I have two AA-less cameras.

The basic principle can be applied to lots demosaic methods. Here is an example of the two I’ve used in the version I provided. One gives more details and finer grain noise at the expense of zipper artefacts at colour boundaries, and the other has fewer zipper artefacts but blotchier noise.

y

You’ll also notice some moire in the guy’s shirt still visible. That can be reduced by using FFT instead of a multiscale comparison, in the algorithm, but it is much slower.

Here’s the raw file for the previous image

https://dl.dropboxusercontent.com/u/10782279/2009-12-27_01-49-09_8596.NEF

Hmm, that noise/zipper tradeoff is annoying.

Is there any way to detect zipper as distinct from noise and get the best of both worlds?

There’s a couple of places that it could probably work.

The initial demosaicing step has a lot of flexibility, and there’s an opportunity before the final demonic step as well.

Although my initial thoughts about the algorithm was that it was best suited to being applied to just the moire area.

I have done some tests and this algorithm is not good at chroma edges. This is because it looks for the least chroma variation between two choices so it picks the image with soft chroma edges.

So I don’t see any way of improving the algorithm without detecting chroma edges and using a different algorithm for that.

Thanks a lot. It’s nasty indeed. :slight_smile:

Here’s a version that follows the same principles, but uses FFT instead of a pyramidal decomposition.

It’s conceptually a bit simpler. It takes the two version of the demosaiced image (as mentioned above) , breaks them into tiles and then chooses the lowest level in the FFT for each tile pair. On the plus side, there are no zipper effects and the noise rendering is not too bad, on the downside, the fine vertical and horizontal detail is missing. EG the stripes on the shirt are gone and the image is a little soft.

1 Like