Hi !

I am currently trying various things to improve noise reduction in
It seems that NLM on RAW is a very good idea !
On my early tests it works really well.
I have made a (ugly and slow) prototype (without sensor profiling),
available here:
(branch is draft-denoise-NLM-raw, commit

To test it, you only have to activate raw denoise module.
The threshold parameter controls the force of the non local means algorithm.
The GUI is not updated yet, there are plenty of things remaining to do, and
the code is ugly and slow.
Consider activating the module only at 100% zoom level so that it doesn't
take too long to execute.

Please also note that I modified slightly the algorithm compared to the
normal NLM: you have to use the opacity of the module to make the balance
between the original pixel value and the value computed from OTHER pixels
(excluding the original pixel)
It seems that using an opacity of 70% works quite well.
The reason why I put this is that I don't like when denoise modules give
not uniform results (ie there is some noise remaining in some parts of the
image). This is (maybe) temporary, as I may test other ways to ensure some

Also note that in the current state, I do not handle the borders of the
image, as I did not want to make the code too complicated before being
confident about the interest of the approach.
Again, this is a prototype, it will evolve pretty soon !

Best regards,

2018-02-21 23:18 GMT+01:00 Björn Sozumschein <wilecoyote2...@gmail.com>:

> Hi,
> thank you for the information!
> I have tried out a simple approach by profiling the color filters in the
> Sensor pattern separately, and use only patches for each pixel that are
> centered around a pixel that has the same position in the repeating filter
> pattern. The results are quite interesting, as the algorithm seems to
> perform very well in flat surfaces and texture is also rendered quite
> nicely. Maybe it is worth investigating whether that may be developed into
> a more sophisticated approach.
> I've uploaded the code I used and a sample image to try it out here:
> https://github.com/wilecoyote2015/NLMeans_Raw_Test
> One can use profile_camera.py to profile the camera and nlm_raw_profiled
> to denoise a raw image. The code isn't elaborated and slow as hell, but it
> provides an idea of the results. It only works with Bayer sensors.
> Best,
> Bjoern
> 2018-02-18 13:33 GMT+01:00 johannes hanika <hana...@gmail.com>:
>> hi!
>> sure, everything that improves noise reduction will be a welcomed
>> addition. glancing over the paper you mention, it is based on
>> non-local means and a global minimisation/total variation step. keep
>> in mind that for interactive usage we need to render several
>> megapixels through all necessary modules in a very short time frame.
>> this usually means a couple 10 milliseconds per module.
>> currently we run a generalised anscombe transform (gaussian and
>> poissonian noise), which can be combined with wavelet or non-local
>> means. the closest they have as comparison is in table II in
>> conjunction with BM3D, which seems to be the winning combination.
>> working on raw data seems like a good idea and i had started that
>> years ago in some unfinished branch. one thing about raw data is also
>> that the black point has not been subtracted yet and that you can
>> effectively better filter gaussian noise near zero using the negative
>> values still contained in the data. designing denoising algorithms in
>> this space is a bit painful to implement and needs to consider the
>> different colour filter array layouts, which is tedious and can result
>> in slow algorithms. also the anscombe transform doesn't work very well
>> near zero, so this branch was based on a fisz transform and wavelets.
>> in the end the results were usually not all that different except in
>> one or two extreme oddball images. in this context a specialised
>> nlmeans approach may be useful (but the gaussian part of the noise is
>> important).
>> cheers,
>>  jo
>> On Sun, Feb 18, 2018 at 1:43 AM, Björn Sozumschein
>> <wilecoyote2...@gmail.com> wrote:
>> > Hello all,
>> >
>> > the Paper "Adaptive regularization of the NL-means: Application to
>> image and
>> > video denoising" by Sutour et al, 2014 provides a nice overview
>> regarding
>> > methods to adapt the NL Means algorithm for poisson noise and introduces
>> > regularization in order to remove typical artifacts. As far as I have
>> read
>> > from the documentation, the profiled denoise with NL-Means uses the
>> profile
>> > to transform the image data to uniform standard deviation in order to
>> apply
>> > NL-Means for simple gaussian noise. As stated in Sutour et al., it
>> isn't too
>> > complicated to adapt the algorithm to other noise using the likelihood
>> with
>> > respect to the noise model for weights and distance.
>> >
>> > I would be interested in experimenting a bit with this, and I believe it
>> > would also be interesting to look into adaption of the NL-means for
>> mosaiced
>> > RAW data in order to be able to deal with the noise before it's
>> patterns get
>> > spatially correlated by demosaicing.
>> >
>> > Do you believe that this could be worth giving it a try?
>> > I must say, however, that I'm quite busy with my master thesis and work
>> > currently, so that I won't be able to do actual coding work for
>> darktable
>> > soon, so that I'd consider this as a mid-term side project ;)
>> >
>> > Best,
>> > Bjoern
>> >
>> > ____________________________________________________________
>> _______________
>> > darktable developer mailing list to unsubscribe send a mail to
>> > darktable-dev+unsubscr...@lists.darktable.org
> ___________________________________________________________________________
> darktable developer mailing list to unsubscribe send a mail to
> darktable-dev+unsubscr...@lists.darktable.org

darktable developer mailing list
to unsubscribe send a mail to darktable-dev+unsubscr...@lists.darktable.org

Reply via email to