Hugin pano/HDR + darktable in scene-referred

Also, I noticed that in filmic when auto applying the white and black point, the black point is always at -16EV.

I get the same cast as you if I follow the steps from the op.

What works for me is to let white balance enabled before exporting the tiffs.

Also, when editing the stitched image in dt, I change the input profile from embedded matrix to linear Rec2020 RGB, which gives a result I like better. Also, at this stage, no need to do white balance.

Regarding this input profile setting thing, don’t trust me :man_shrugging:, because I’m not sure what I’m doing (my guess is: I exported a tiff with Rec2020 and I assume Hugin worked and preserved it. But it’s only an uninformed guess… )

I exported earlier with white balance enabled, but then I read this post. I think it makes sense, that WB multiplies the RGB values, and if Hugin is clipping at 1.0, we don’t get the full dynamic range. It is better to ensure that we don’t introduce any clipping in dt. But why the RGB values that should remain the same through stitching get changed so that multiplying the output with the same WB coefficients gives a different result than multiplying the input. Maybe @anon41087856 has some idea.

Also, when editing the stitched image in dt, I change the input profile from embedded matrix to linear Rec2020 RGB , which gives a result I like better.
I think your guess is right. I also change the input profile to linear Rec2020.

1 Like

Just a note you might want to consider.

dt’s rawprepare module (required for all raw files) use the black and Whitepoint parameters. For some cameras / files these are slightly wrong resulting in values above 1 at that stage already. WB coeffs and the demosaicer further contribute .

You might want to set exposure to a fixed value to ensure there is no clipping. Also the demosaicers differ somewhat, I would suggest to use RCD for low iso and lmmse for high ISO images as both keep overshoots under control quite well.

Just my experience …

1 Like

Thank you for the tips. I’m exposing in Manual mode, so I can control the clipping. I’m using for low ISO RCD+VNG4 to get smoother skies.

I was wondering, does it have any impact to the tones that white balance is normally applied to an image that has a standard color matrix applied, but now in this case it is applied to an image with Linear Rec2020 RGB?

Thanks for the tutorial! Finally got around to shooting some handheld panoramas and practicing them. In addition to the original post, I found a couple of gotchas:

  1. When adding 16-bit TIFFs to the project, Hugin (as of version 2021.0.0) doesn’t consider them linear files but sets out to fit a “response curve” to the data during the photometric calibration. Given the lack of multiple exposures per view, this is going to fail (as far as I understand). I wondered why the output TIFFs from Hugin looked like the contrast had been boosted and response to edits was really different from the original images. For 32-bit TIFFs, hugin flags them as “linear response” and doesn’t do the curve fitting. You can set the 16-bit TIFFs to linear as well by selecting them all, right click → Edit image variablesCamera responseTypeLinear. Afterwards, perform photometric calibration.

  2. Hugin seems to take white balance coefficients from the EXIF data and tries to utilize them to unify the white balance between the images. However I found that causing strange color casts in some parts of the panorama, and Hugin shouldn’t be applying any white balance adjustments to the scene-referred data anyway. After loading the images, select all images, right click → ResetReset user defined → check only Color and select *to one (no color correction). Click ok.

  3. After considering the above, I began wondering if any of the photometric corrections are meaningful. After setting the image response to Linear and disabling all the color corrections, vignetting correction is all that is left. However if lens correction is applied in darktable, vignetting should be already taken care of. After resetting the values as described above, one can probably actually skip pressing the photometric calibration button altogether and leave vignetting parameters to zero.

  4. Speaking of lens corrections, distortions are also already handled in darktable lens corrections module if data is present. Therefore you can skip optimizing the distortion parameters in Hugin. Select e.g. Positions (y, p, r) in the Geometric optimizations combobox instead of Everything. Note that the case may be different if you can’t undistort the image in darktable. For my handheld panorama this turned out to be sufficient.

Pretty satisfied with the outcome. Could have bracketed several exposures for each view to improve SNR in the dark areas, but I’ll leave it for the next time.

7 Likes

I’m having the same issues with white balance with this workflow: the after importing the HDR TiFF output from Hugin and copying the white balance values for D65 from one of my source RAWs, the result is not properly white balanced (it’s way too green).

I’ve set the camera response type for the source TIFFs in Hugin to linear. Also, the Darktable uses Linear Rec709 RGB automatically for the re-imported TIFF.

What’s going wrong here? And what would be the correct way to fix it?

Any screenshots and files (one of the raws, XMP for the processing before hugin, TIFF from Hugin and XMP for the processing after Hugin) would be pretty helpful. Also, if you exported the raws using linear Rec.2020 as the output profile, you should choose that as the input profile for the Hugin TIFF. I don’t know why darktable chooses Rec.709 automatically instead.

Linear Rec. 709 is the fallback if it doesn’t manage to detect an embedded profile.

1 Like

Sorry for the delay in reply.

This is one of the source RAWs, with just white balance (to D65) and lens correction enabled:

And this is what the result from Hugin looks like after re-importing in Darktable and copying the white balance values from the previous source RAW:

This is one of the source RAWs (the same one as the first screenshot):
IMG_4261.CR2 (32.1 MB)
IMG_4261.CR2.xmp (9.5 KB)

The TIFF result from Hugin is pretty large (too large to upload here)…

But doesn’t that mean you apply the white balance twice? Once before exporting to tiff, and once on returning to dt…

1 Like

Ah, no, sorry, I should’ve clarified.

I exported the raws to TIFF with just the settings recommended by @anon41087856 in the OP: all modules disabled except lens correction.

After re-importing the stitched image from Hugin I re-enabled white balance on one of the raws to get the settings to copy them, and to provide the screenshot.

Did you also set the response to linear in Hugin and cancel any WB adjustment Hugin might try to do? The steps 1 and 2 in my post above describe how to do that. I also got pretty weird results before those steps.

2 Likes

I think I did, but I’ll double-check when I get home.

FWIW, I indeed did that, but the issue remains.

This is another image I have difficulty with:

This is actually a set of bracketed stacks. I exported them from Darktable in linear colour space, with only Lens Correction enabled.

I imported them in Hugin, set the camera response to linear. I let Hugin create control points, geometric optimisation, and photometric optimisation, and cleared the colour corrections that Hugin had set.

After stitching and re-importing into Darktable, I get something like this.

What am I doing wrong?

I am having a problem similar to @Compizfox.

My goal is to stitch a bunch of non-bracketed photos. I followed the advice of anon41087856 and flannelhead but no luck.

Two issues:

  • I could never get the white balance properly. I looked at a source RAW and copied the values from White Balance > D65 to the merged panorama but they look horrible.
  • The left-most images aren’t being exposure merged which causes a visible border.

Welcome to the forum. Here is some advice I have for you. DT is great at preparing images and matching exposure and color to create tiff files for panorama stitching. Note I do not use the color calibration module for many of my images, because it can make a simple job hard. I am usually happy with the plain old white balance module.

Darktable doesn’t offer panorama stitching. However, DT can prepare the tiff files required for stitching in other programs.

  1. Open the first image
  2. Set white balance if the as shot default is not satisfactory. (I personally am reluctant to use the color calibration module for most images)
  3. Apply denoise (profile)
  4. Sharpen using the preset ‘sharpen demosaicing in the diffuse or sharpen module
  5. Apply the basic colorfullness preset found in the color balance RGB module
  6. Use ‘spot exposure mapping’ controls in the exposure module to set the correct exposure.
    a. Click on the eyedropper attached to the exposure slider
    b. Redraw the area selection box so it covers part of the blue sky (for your images)
    c. Expand the spot exposure mapping options and adjust the position of the lightness slider until a desired exposure result is obtained.
  7. Apply auto tune levels in filmic
  8. Because we are doing panorama stitching apply lens correction to reduce distortion
  9. Apply raw chromatic aberrations module and/or chromatic aberrations module to get rid of fringing if required
  10. Export the image as a 16-bit tiff file
  11. Use Ctrl + Shift+ C to bring up dialog for copying parameters adjusted. Select all parameters and this will be saved to your clipboard
  12. Open your second image
  13. Use the short cut Ctrl + V to paste the settings used from the first image. However, you may need to adjust exposure and filmic if the image does not look identical to your first image. See the next steps.
  14. Use ‘spot exposure mapping’ controls in the exposure module to set the correct exposure.
    a. Click on the eyedropper attached to the exposure slider
    b. Move or redraw the area selection box so it covers part of the blue sky similar to your first image
    c. The position of the lightness slider was set using the first image and the spot exposure mapping will match the exposure of the second image to the first image.
  15. Apply auto tune levels in filmic
  16. Export the image as a 16-bit tiff file
  17. Open the subsequent images and repeat the processes.
  18. The export tiff files are now ready for panorama stitching in Microsoft’s Image Composite Editor (ICE) or any other stitching program. If you have a windows computer ICE is a fantastic free stitching program that matches exposure differences if they exist.

The image doesn’t look like you have followed the instructions, the image should look green.

My workflow of

  1. Do the basic editing to the images and export them as 16 but tiffs
  2. Align the images in Hugin and save the project
  3. For all the images disable all modules except input and output color profile, orientation, noise profile and lens profile, and set the output profile to linear
  4. In Hugin change the image attributes as advices by @flannelhead and stich
  5. Import the output into darktable and check that the input profile is correct
  6. Copy the module stack from one of the source images and enable the disabled modules
  7. Crop and fine-tune

Your steps worked (with small additions)!

Steps 1-9 deviate from first post author who recommends limiting modules to a strict minimum. Is this intentional?

For Step 10 are these sane parameters for 16-bit tiff?

  • uncompressed
  • profile: linear Rec2020 RGB
  • intent: image settings

Hmm not sure where Microsoft ICE comes from… this thread refers to Darktable + Hugin.

Attempt 1:

  • Feature Matching: Hugin’s CPFind + Celeste
  • Optimize geometric: Position (y, p, r)
  • Optimize photometric: Low dynamic range
  • Panorama Output: Exposure corrected, LDR

Yuck! There’s a black distortion on the top-left.

  • Photos > select all + right click > Edit Image Variables > Camera Response > Type > set to Linear (I’m not sure if this did anything)
  • Photos > select all + right click > Reset > Reset User-defined > Color > to one (no color correction) (<- My solution!)
  • Feature Matching: Hugin’s CPFind + Celeste
  • Optimize geometric: Everything (<- I wasn’t sure if the problem was in view/barrel)
  • Optimize photometric: Low dynamic range
  • Panorama Output: Exposure corrected, LDR

100% success!

1 Like