Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astrophoto denoise #400

Open
phweyland opened this issue Dec 9, 2021 · 6 comments
Open

astrophoto denoise #400

phweyland opened this issue Dec 9, 2021 · 6 comments
Milestone

Comments

@phweyland
Copy link
Contributor

We have difficulty to understand this text:

This is accomplished by averaging each pixel with some surrounding pixels in the image. The weight of such a pixel in the averaging process depends on the similarity of its neighborhood with the neighborhood of the pixel being denoised. A patch with a defined size is used to measure that similarity.

The highlighted part doesn't make sense to me and I cannot translate it.
The former doc, on https://darktable.gitlab.io/doc/en/, is clearer on the subject.
Help needed

@elstoc
Copy link
Contributor

elstoc commented Dec 9, 2021

I think I just copied that verbatim from the old user manual. I assume it means something like "take a patch centred on the target pixel and compare it with a similar-sized patched centred on a nearby pixel. Weight the averaging based on the similarity of those nearby patches to the target patch". Indeed the old doc (which you link in the issue) has exactly the same English text for denoise (NL means). See
https://darktable.gitlab.io/doc/en/modules.html#denoise_non_local_means

@phweyland
Copy link
Contributor Author

phweyland commented Dec 9, 2021

Thanks. Trying to understand.
Denoising is based on a blurring process (averaging).
To preserve the structure blurring should not be applied on the structure.
To identify the structure there is a comparison, pixel by pixel, between there respective centered patches.
How the comparison is made ? Luma, color, gradient, ... ?
Once this is done, the more the 2 patches are similar the more they are averaged. That's a guess...
If true, the patch is not only used to measure the similitude but also the burring.
...

I think it's useless to have such a piece of explanation because it doesn't allow to connect the dots.
Either it should be removed (parameters are enough) or completed to explain correctly the principle.

Thoughts ?

@elstoc
Copy link
Contributor

elstoc commented Dec 9, 2021

@rawfiner knows about denoising. Perhaps he can provide some clarification as to how it works?

I don't particularly mind removing the text if it's not adding anything.

@elstoc elstoc added this to the 4.0 milestone Dec 9, 2021
@rawfiner
Copy link
Contributor

rawfiner commented Dec 9, 2021

To denoise one pixel of the image, non-local means performs a weighted average of pixels of the image that are spatially not very far from the pixel.
To define the weight of one pixel in the average, we compare its close neighbourhood (a patch), to the close neighbourhood of the pixel we want to denoise. The more alike the 2 patches are, the bigger is the weight. This is done by measuring the mean squared difference between the 2 patches.
I think for astrophoto denoise the difference is based only on the L channel, in denoise profiled it considers all 3 channel.

If you are familiar with bilateral filter, non-local means works the same way, but instead of having a weight that depends on the difference between the 2 pixels value, we consider the average difference on a patch

@phweyland
Copy link
Contributor Author

Thanks @rawfiner !

@rawfiner
Copy link
Contributor

Don't hesitate if it remains unclear, I can try to explain differently :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants