Combined AMaZE and VNG4 demosaic

Ingo, I don’t like to sharpen too much, maybe because my eye sight is not perfect and blurs my world, I don’t like to see my images too sharp!

Ragarding the contrast threshold, indeed I tried to raise it, but depending on the scene, sometimes before 50 I start to see the bad behavior of the fast-pass on sharp edges.

Look at the antenna stems below (300% crop):

On side note: I tried to see what False color suppression does, but it doesn’t play well at all with the 4-pass algorithm. Maybe it should be disabled when 4-pass is selected.

@sguyader I agree about fast being not perfect. I will take a look whether I can steal the xtrans vng code from darktable. That may be better than simple ‘fast’ code in RT :wink:

@heckflosse I tried pushing USM sharpening on a clean 200 ISO file, and indeed the 4-pass algorithm allows for pushing it further (I tried 0.50 radius, 1000 amount). However, the advantage is there only when you don’t downsize the images too much (or if you crop significantly inside the image). If I resize to HD resolution, I don’t see much difference between 3-pass and 4-pass.

I just merged Amaze+VNG4 and xtrans 4-pass into dev

6 Likes

@heckflosse I’m getting this error trying to build on mac/clang-mp 3.9.

/Users/tune/repo-rt/rtengine/pixelshift.cc:326:129: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE' is not a member of class
      'RAWParams::BayerSensor'
                if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
                                                                                                              ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/pixelshift.cc:328:136: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4' is not a member of class
      'RAWParams::BayerSensor'
                } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
                                                                                                                     ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/pixelshift.cc:338:133: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE' is not a member of class
      'RAWParams::BayerSensor'
                    if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
                                                                                                                  ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/pixelshift.cc:340:140: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4' is not a member of class
      'RAWParams::BayerSensor'
                    } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
                                                                                                                         ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/pixelshift.cc:365:129: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE' is not a member of class
      'RAWParams::BayerSensor'
                if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::LMMSE)) {
                                                                                                              ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/pixelshift.cc:367:136: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZEVNG4' is not a member of class
      'RAWParams::BayerSensor'
                } else if (bayerParams.pixelShiftDemosaicMethod == bayerParams.getPSDemosaicMethodString(bayerParams.PSDemosaicMethod::AMAZEVNG4)) {
                                                                                                                     ~~~~~~~~~~~~~~~~~~^

@HIRAM Fix pushed. Thanks for reporting.

@heckflosse Thanks for fixing! Just a bit further into the build comes a similar error:

/Users/tune/repo-rt/rtengine/procparams.cc:4714:144: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::LMMSE' is not a member of class
      'rtengine::procparams::RAWParams::BayerSensor'
                        raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(raw.bayersensor.PSDemosaicMethod::LMMSE);
                                                                                                                             ~~~~~~~~~~~~~~~~~~^
/Users/tune/repo-rt/rtengine/procparams.cc:4716:144: error: 'rtengine::procparams::RAWParams::BayerSensor::PSDemosaicMethod::AMAZE' is not a member of class
      'rtengine::procparams::RAWParams::BayerSensor'
                        raw.bayersensor.pixelShiftDemosaicMethod = raw.bayersensor.getPSDemosaicMethodString(raw.bayersensor.PSDemosaicMethod::AMAZE);
                                                                                                                             ~~~~~~~~~~~~~~~~~~^

Fixed.

Compiles fine on Manjaro Linux.

1 Like

Sébastien, the new xtrans 4-pass needs documentation on rawpedia. As an xtrans user, could you provide some (or at least one) raw file(s) which show(s) the difference between 3-pass and 4-pass from a users perspective? That would be awesome!

Edit: I also have some xtrans raw files which (technically) could be used for rawpedia, but I don’t remember where I got them from, so I don’t like to use them.

Ingo, here are a few images. I release them under Creative Commons BY-NC-SA license.
DSCF1766.RAF (23.6 MB)
DSCF1399.RAF (22.0 MB)
DSCF1342.RAF (27.9 MB)

The effect is easier to see at higher than base ISO, because it is when noise starts to be visible that this algorithm shines. But I added a 200 ISO shot with plenty fine details, to see how far you can push sharpening.

1 Like

https://filebin.net/nesj62icf25f236r/RawTherapee_OSX_10.9_64_5.4-373-g039f68e54.zip?t=hqywo66q
ˆ-- :ok: on mac!

1 Like

@heckflosse In layman’s terms, how does the algorithm determine when to use AMaZE and VNG4?

@Carmelo_DrRaw Suitable for PhotoFlow? :wink:

Definitely, but first I need to finish the HDR stuff. VNG4 is not yet implemented in PhF, so this will take a little bit of time…

I have added the amaze_vng4 branch to the AppImages list, so that it will be updated daily whenever something new is pushed…

It’s already merged into dev. No need to build amaze_vng4 appimage

Ha, I didn’t realize that… build canceled, the updated dev appimage is already here: https://github.com/Beep6581/RawTherapee/releases/download/nightly/RawTherapee-dev-5.4-373-g039f68e5.AppImage

From the Luminance of the AMaZE demosaiced image a mask is build which represents the level of contrast (in a 5x5 grid). This mask then gets gaussian blurred with a sigma of 2 for smoother transitions between the two demosaic methods. Then the mask is used to blend AMaZE and VNG4.

If contrast is low => VNG4 else => AMaZE

2 Likes

Thank’s for the improvement !

For my Xtrans camera (X100s, 16M sensor and X-E3, 24M sensor), globally it helps well for high iso, nicelly reducing the hatch pattern. But I’m still astonished that there is only one raw method for Xtrans, which seems far from perfect regarding those hatch patterns, since Bayer have plenty different methods.
And especially for my X20 (very small Xtrans sensor), it helps a lot at low iso too, since this sensor is quite noisy.

1 Like

That’s not really a surprise. Fuji decided to go their own way ditching about 30 years of research into demosaicing by using their own pripriarity color filter array which has no benefits whatsoever. What they claim regarding aliasing is completely bogus. Quite to the opposite, what you are seeing in terms of artifacts usually are bad cases where x-trans is worse with regard of aliasing and normal anti aliasing hardware filters are rendered dysfunctional by the CFA, so even if they wanted they couldn’t release a camera which doesn’t suffer from excess aliasing…