-
Notifications
You must be signed in to change notification settings - Fork 1.2k
create mean image and subtract dark frame #19132
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
base: align_image_stack
Are you sure you want to change the base?
create mean image and subtract dark frame #19132
Conversation
Instead of a period in the first sentence, add a blank line before the auxiliary sentence for better visual separation.
loading screen: reclaim mem if user toggles preference
…intenance [maintenance] TIFF loader: fix a typo in the URL, remove unused code
…iptions-remove-ending-period [GUI] Remove period from description texts of some modules for consistency
to recent pot file
…-250528 Translations update: en@truecase and Ukrainian
input is visible. RELEASE_NOTES.md - added release note to Lua bug fixes section
…le-description-fixes [GUI] Sigmoid module description grammar/style fixes
dt_get_thread_num() can be the same value for multiple chunks under some circumstances. Using it for the start and end calculation will thus be unreliable, resulting in parts of the image containing just black pixels. Fixes darktable-org#18127.
Can test "in-real" as without access to any windows system.
…p_code Remove dead code in crop module
I would have done that in the darkroom not in lighttable. The HDR code is in lighttable because from multiple images you create a new one. In the case here, we want to correct one image using a dark-frame. So I would have created a new module possibly named dark-frame having a way to load a specific image created by the camera and use this to correct the main image. You may have a look at the external raster mask or overlay module (using an image from the collection) for inspiration. @jenshannoschwalm may have further hints because it is our expert in this area. |
that is exactly the same for the mean image and dark frame subtraction. |
You could also do it like suggested by @TurboGit as in overlay, that would mean you'd have to implement "how to select multiple files". |
@ Hanno Also the workflow is fine in lighttable: In my opinion this is much faster to handle than a solution in darkroom. |
Well, I will start to work with the implemented solution in real life and check, how it performs. But I also will take a look into the overlay module and see, if it could make sense to implement |
The dark frame subtraction belongs in the darkroom, it seems to me, since you're actually processing an image. Not sure about the mean image. |
The mean image is a new one, like HDR it gives new information. So I would keep the mean image creation in lighttable. For dark frame subtraction my questions are, how I can make sure that:
@jenshannoschwalm At the moment both features work fine in ligthtable, so they can be used and tested. But I will take a look to the Thank you very much for your support. |
I'll opine that mean image should be done in lighttable, while dark frame subtraction is more appropriate for darkroom - in addition to likely wanting to apply the same dark frame to multiple images, the dark frame itself is likely to be a mean image. So we create one new file for the mean image, but then avoid adding a new image for each image to which DFS is applied. You might want to check whether the composite module can already be used for DFS - centered at 100% scale, 100% opacity and using a difference blend mode. I suspect that its current limitation of rendering the overlay at 8 bpc will cause problems, though. |
@ralfbrown From processing point of view, we should keep in mind that the DFS will fail, if any other filter was applied! I do a lot of DFS for many different camera types in my daily scientific and industrial work and I know very (at the moment for my work, a correct result is more important to me than the question, if lighttable or darkroom But let me try to understand the pixel pipe and where to place this new module. Thank you for this fresh and productive discussion. |
Right, forgot that DFS needs to be done on the raw raw data. That means it should come between raw black/white point and (legacy) white balance in the pixelpipe. |
Definitely not after rawprepare (raw black/white point). It has to be either before rawprepare (and add the expected black point value), or be integrated into rawprepare as an optional replacement of black point subtraction. Note that rawprepare already has support of applying gain map from DNG, which is flat-field correction and is closely related to dark-frame subtraction. |
@parafin But we have to make sure not to clip at zero due to read noise, so we should add again some margin ... Alternatively, we go through the final image and add just enough offset that no pixel is clipped at zero. |
From last year problems with rawprepare and GFX100 I learned that I will take a look into the code, perhaps this could be a template to pass the 2nd image to rawprepare. |
Clipping is totally separate issue, which doesn’t depend on whether you’re using just black level or dark frame. If you shift zero, then image is no longer linear, and all subsequent maths are invalid. As far as I understand, image is already in the float format in the rawprepare output, so it can hold negative values. Though I’m not sure which following iops can handle them and when the clipping will happen. |
you are right, as rawprepare outputs as float, clipping is no issue. |
I added two functions into light table:
1st.:
you can select now two or more RAW images and create a mean image.
If the images show the same scene, this reduces read noise and shot noise.
This is mainly of interest for long exposure dark frames which should be subtracted
from long exposure images. This reduced the extra noise by the dark frame.
2nd.:
you can select two RAW images, including the written DNG from above.
The image with the lower mean value gets identified as dark frame and will be
subtracted from the other image.
This reduces fixed pattern noise, e.g. dark current non uniformity, specially in
log exposure shots or at high temperature.
Best practice is:
a) do the shot first and then take about 16 dark images, i.e. with the lens cap on, with the same exposure time.
b) create the mean image of the 16 dark images
c) subtract the mean dark image from the shot
This increases read noise in the final image by about 10 % only.
Using a single dark image instead of the mean image increases the read noise
in the final image by about 41 % which make the noise reduction profile less efficient.
I copied the code from
create HDR
as a template.I kept the same structure and naming convention to keep the code readable.
Karsten