How to use hdrgen to synthesize HDR images

Hey everyone,

I am currently working on creating an HDR image by merging 19 JPG images captured using a Raspberry Pi camera. However, when I attempt to process these images with HDRgen, I receive the error: “Cannot solve for response function.”

Here is a link to the 19 JPG files I captured: [JPG.rar - Google Drive]. Additionally, I have included two separate images that show the exposure times and frame numbers I used during the capture process.My camera’s aperture should be 2.0.

I suspect that this issue might be related to:

  1. The quality or characteristics of the images (e.g., noise, overexposure, or underexposure).
  2. The range or step size of the exposure values not being sufficient for hdrgen to calculate the response function.

Could anyone help me identify the root cause of this problem or suggest any adjustments to the input files or settings to resolve the issue?

Thank you for your time and support! :pray:

Best regards,
Sida


Hi Sida,

Welcome to the forum. This question probably belongs under HDRI rather than radiance-general, so I may try to move it if I can.

The main problem with this capture is that the lights are flickering with the AC supply. There’s no way to get a consistent response, because the scene itself is not consistent shot-to-shot.

You need to either have exposure times starting much longer than the AC frequency, 50 or 60 Hz, so 1/30th second or longer, or get a different set of lights that don’t flicker so badly.

Best,
-Greg

1 Like

Hi Sida,
As Greg said – HDR photography with flickering light sources is very problematic.
You can find more information in my presentation titled ‘Glare measurement using HDR photography’ at the 2012 Radiance workshop (page 23):
https://www.jaloxa.eu/mirrors/radiance_workshops/2012/index.html
Regards
Axel

2 Likes

Another solution is to compute the camera response using a daylit scene and re-use the response, which is recommended anyway, for your electrically-lit scene. The flicker may affect the accuracy of your HDR results, but at least you won’t fail completely because you’ll have your calibration.

-G

1 Like

Hey Greg,
I hope you are doing well. I followed your suggestion to perform HDR composition in a Daylit scene, but unfortunately, I am still encountering the error shown in the attached screenshot. I am trying to understand what might be causing the issue.

To clarify, my JPG images do not contain dynamic clouds or other external light sources. Given this, I am wondering if you could help me pinpoint the potential cause of the error.

Additionally, I have provided the link below to the JPG files I used for the HDR composition, both before and after processing, and I have provided the formula for calculating the -s value:

https://drive.google.com/drive/folders/1woGREwwDMccr2iuaM76txe1L-FqEDk75?usp=sharing

Best regards,
Sida

Have you tried running without the s-factors? You should be able to just give hdrgen a bunch of JPG files.

Also, your darkest photographs are essentially black. Try removing them from the sequence.

There are some useful utilities in the webhdrtools Perl scripts that go with hdrgen:
https://www.jaloxa.eu/resources/hdr/webhdrtools/index.shtml

Try, for instance the heat map.

Although WebHDR no longer exists, the demo is still available. You can see a heat map on this page:
https://www.jaloxa.eu/webhdr/demo3.shtml

I would also suggest that you use a normal digital camera first, before moving onto a Raspi with a fisheye lens.

Regards
Axel

1 Like

Unfortunately, there is no aperture (f-stop) recorded in the Exif headers, so the -s options are necessary. However, you are not computing these accurately. For example, I can see that exposure 11 and 12 are exactly the same, yet you have different -s calibration values.

You cannot get correct output without providing consistent input.

Best,
-Greg

2 Likes

What if Sida added the aperture to the Exif header with something like exiftools?

Would they still need to account for the FrameRate? Would the true ExposureTime be something like ExposureTime / FrameRate?

I guess this is where Raspi is unlike normal digital cameras, because it’s actually a video camera.

A

2 Likes

Hey Axel and Greg,

Thank you both once again for your helpful replies. I am pleased to share that I have successfully composed HDR images. However, I have identified two issues with my Raspberry Pi camera during this process:

  1. There seems to be a relationship between exposure time and frame rate. When the frame rate parameter is set, the actual exposure time of the captured JPG images may not match the intended settings.
  2. The exposure time settings have an upper and lower limit, with the lower limit being 60 microseconds in my case.

Additionally, I need to crop the outer edges of my JPG files for better results.


Best regards,
Sida

1 Like

Glad you got this to work! To answer @Axel_Jacobs2 question, adding the aperture to the JPEG files using exiftool or similar would work as an alternative to the -s option in some camera modes but not others. I am not familiar with this unit, but some of the shared JPEGs had the rest of the necessary metadata (exposure time and ASA) and others had no useful metadata.

Cheers,
-Greg