[SOLVED] Workflow for creating master bias for Rawtherapee

Hello,

I’m stuck with my process of creating calibrations frames compatible with “dark frame” and “flat field” features in Rawtherapee.

Here is my process so far :

I have a 20 bias frames from my Canon 1000D taken at ISO100 with cap on and at the fastest shutter speed (1/4000).

I tried to put the files in my “dark frames” folder, they are recognized but it seems Rawtherapee is not able to make en average of those images by checking the “auto select” box.

So I thought : “let’s make an average frame and load it”

  • step 1 : demosaic the .CR2 files :
for file in `ls -1`; do dcraw -4 -T -o 0 $file; done
  • step 2 : make the average :
hugin_stacker --mode=avg --output="Canon EOS 1000D - ISO100.tiff" *.tiff
  • step 3 : convert the tiff into fake .dng (like suggested in another thread with Siril)
convert "Canon EOS 1000D - ISO100.tiff" "Canon EOS 1000D - ISO100.dng"
exiftool -tagsFromFile IMG_2232.CR2 -x BitsPerSample "Canon EOS 1000D - ISO100.dng"
  • step 4 : try the dark image in Rawtherapee

  • step 5 : cry because this is not working as expected because the result file as not been corrected.

  • step 6 : try to directly subtract the average image with the demosaic version of one of the frames :

convert "Canon EOS 1000D - ISO100.tiff" "IMG_2232.tiff" -compose minus -composite "beautiful_image.tiff"

The last step is working fine, I get an unbiased image but it’s not using Rawtherapee at all !

Here are the images (color leveled and scaled down to clearly see what is happening) :



And here is the result I’m getting with Rawtherapee (nothing changes) :

Hey, welcome to the forum.

We should start with the basics: what version of RT and what OS and version?

Hello, sorry.

I’m using RT dev branch build on Linux Mint 22.

And here is the “auto select” image from my “dark frames” folder :

So you will ask ‘why not using the auto checkbox ?’ → because I don’t want tons of Gigas of calibrating frames so the lower the better.

I know some programming so is it possible (in python) to directly average my CR2 files and output a CR2 file that a coul’d load into Rawthrapee ? That would save some time !

So after further search and some code exploring, it seems that RT is indeed averaging the images by creating a template as I can see (20 shots, 1 template) in the settings.

The new question is : How to extract the template as a raw file and import it back into the dark frames folder to delete all those previous frames and keep the template only ?

I made a bach script that seems to work. The fact that I couldn’t import the resulted tiff file from hungin_stacker command in RT was because hugin_stacker did save the tiff file with specific tags / parameters.

Here is my script :

#!/bin/bash

path=${1:-.}
output=${2:-Stacked_corrected.tiff}

# Demosaicing the raw images
for file in $(ls -1 ${path}/*.CR2); do
    dcraw -4 -T -D ${path}/$file
done

# Average the tiff
hugin_stacker --mode=avg --output="${path}/Stacked.tiff" ${path}/*.tiff

# Convert the output tiff for it to work in RT
convert "${path}/Stacked.tiff" -alpha off -compress none -depth 16 -type grayscale "${path}/${output}"

# Copy exif data from raw image to help RT choose the correct frame when "auto select" is on
exiftool -TagsFromFile $(ls -1 ${path}/*.CR2 | head -1) -all:all -overwrite_original "${path}/${output}"