jcelaya / hdrmerge

HDR exposure merging
http://jcelaya.github.io/hdrmerge/
Other
355 stars 78 forks source link

Crash with Fuji DR RAF #165

Closed Floessie closed 5 years ago

Floessie commented 5 years ago

Hi,

I was about to develop a RAF from my F600EXR in RT when to my surprise I learned that it contains two subframes, because it was taken in "Dynamic Range" mode. Thus, I fired up HDRMerge (master) to see if it would try to combine the frames. Unfortunately, I couldn't find it out, as it crashes immediately.

So here's the file in the hope that you can figure out what makes it so special. :wink:

Best, Flössie

heckflosse commented 5 years ago

@Floessie Currently HDRMerge supports only files with one or three frames. But it should be easy to support two frames now as there is an example file available... Just try it ;-)

https://github.com/jcelaya/hdrmerge/blob/master/src/ImageIO.cpp#L98

heckflosse commented 5 years ago

@Floessie The exr cameras also have a mode where the exposure of both frames is equal. In this case one can just combine them in RT (after adding some lines of code of course).

Here's an example. Left is one frame, right is combination of both frames. Much less noise grafik

If you're interested, please open an issue in RawTherapee. The engine code is easy...

Floessie commented 5 years ago

@heckflosse Splendid! Ingo, thanks a lot. Fix confirmed, RAF developed, all fine! :+1:

The exr cameras also have a mode where the exposure of both frames is equal. In this case one can just combine them in RT (after adding some lines of code of course).

I think you mean the SN mode ("Signal/Noise"). Yes, I sometimes use it and would be a beneficiary. I have to dig through my archive to find such a RAF...

heckflosse commented 5 years ago

@Floessie All exr RAF which are not made in DR mode should contain 2 frames with equal exposure.

Floessie commented 5 years ago

@heckflosse There are three modes: DR, SN and HR (which I never use). So even HR should contain two frames?

heckflosse commented 5 years ago

@Floessie exactly

Floessie commented 5 years ago

@heckflosse I coincidentally have a stack (-1, 0, +1 EV) of DR RAFs, and had expected them to show up with six frames, now that you kindly fixed the DR case, but only got three. Wouldn't that be beneficial, to get the most out of the stack?

I tried to work around it, by first merging the single DR shots and then combining the stack, but HDRMerge won't let me load its own DNGs.

Beep6581 commented 5 years ago

All exr RAF which are not made in DR mode should contain 2 frames with equal exposure.

I wanted to point out #60

LigH-de commented 4 years ago

@heckflosse - it seems that not all EXR cameras produce the same kind of RAF file content. I have a Fujifilm FinePix S200EXR and took a triple shot in different explicit EXR modes. The results are as follows:

So I guess there is the following content:

Check them yourself.

A pity the example provided by @Floessie already expired. So I can't compare.

heckflosse commented 4 years ago

@LigH-de You can use this file for tests.

It contains two frames with different exposure.

LigH-de commented 4 years ago

OK, my mistake ... the camera stores two separate frames in the RAF only if it detects a sufficient contrast. Even if you force a specific contrast mode, the motive may still fit in the value range of only one frame.

heckflosse commented 4 years ago

@LigH-de

the camera stores two separate frames in the RAF only if it detects a sufficient contrast. Even if you force a specific contrast mode, the motive may still fit in the value range of only one frame.

Interesting and good to know :+1:

LigH-de commented 4 years ago

If you are curious, a few more EXR-DR samples

Naming scheme:

EXR-DR_Axxxx_Dyyy.RAF with xxxx = "Auto sensitivity up to xxxx ISO" and yyy = "Dynamic range up to yyy%", according to the camera menu.

You will notice that the contrast was moderate so that the 200% DR shot fit in only one raw frame.

LigH-de commented 4 years ago

I went out today and shot several photos with high dynamic range. Hope you can use a few to improve handling of 2 frame raw images.

MediaFire: EXR-DR

BTW, I missed a guide how to use them correctly: Do I open one, or do I have to add a second copy? Without a copy, the preview is only green (1 layer), blue areas (layer 2) only appear with a stack of 2 times the dual frame RAF.

LigH-de commented 4 years ago

As suggested by @heckflosse I started HDRMerge 0.5 as hdrmerge.exe -vv and opened a RAF file. Upon closing the application, I got an APPCRASH dialog.

heckflosse commented 4 years ago

@LigH-de I also suggested to post the output. I meant what's written in console.

LigH-de commented 4 years ago

The GUI version (hdrmerge.exe) wrote nothing on the console.

I tried the CLI version too:

hdrmerge.com -vv -a --single DSCF4758.RAF
[  0%] Loading DSCF4758.RAF
DSCF4758.RAF: 2824x2128 (2880x2128+28+0, by Fujifilm S200EXR, 100ISO 1/67.6492sec f3.4822 EV:-9.68
b4b4b4b4 RGBG, sat 16383, black 512, flip 0, wb: 667 336 615 336, cblack: 512 512 512 512
Load files: 0.105006 seconds
[ 50%] Aligning
Compute response functions: 0 seconds
Generate mask: 0.013001 seconds
[100%] Done loading!
Writing result to K:/PICs/private/EXR-Modi/EXR-DR/DSCF4758.dng
Writing K:/PICs/private/EXR-Modi/EXR-DR/DSCF4758.dng, 16-bit, 2824x2128
[  0%] Rendering image
Adjusted white balance: 1.98512 1 1.83036 1
Fatten mask: 0.033002 seconds
Blur: 0.17901 seconds
Compose: 0.065004 seconds
[ 33%] Rendering preview
Render preview: 4.35725 seconds
[ 66%] Writing output
Write output: 0.392022 seconds
[100%] Done writing!
heckflosse commented 4 years ago

Did you start it from console?

LigH-de commented 4 years ago

Yes, I started the GUI version in a console.

heckflosse commented 4 years ago

Ok, HDRMerge found only one frame. Nothing we can do about that, as we get the number of frames from libraw.

heckflosse commented 4 years ago

Yes, I started the GUI version in a console.

Ah, ok, you're on windows. There console output from gui version might not work :(

LigH-de commented 4 years ago

Well, you have plenty of test files in these archives.

I remember that PlaneShift (an OpenSource multi-platform game) has similar issues that consoles don't work the same way in Linux and Windows. Here you may use DebugView messages as an alternative way to communicate with a developer. Or you would have to design your application as CLI type anyway and hand-weave the whole window handling.

LigH-de commented 4 years ago

Ok, HDRMerge found only one frame. Nothing we can do about that, as we get the number of frames from libraw.

Nothing ... except maybe helping to improve libraw.

heckflosse commented 4 years ago

For the Windows console thing we could use the code from RT where it works fine...

LigH-de commented 4 years ago

Is there any more recent test version you can point at? If not, I may have to try if I can build it in MSYS2/MinGW.

heckflosse commented 4 years ago

@LigH-de https://keybase.pub/gaaned92/HDRMergeNightlyBuilds/HDRMerge_master_continuous-64-g1408e42_release_64.zip

LigH-de commented 4 years ago

Now this version seems to work as expected. I see green and blue layer areas covering the image about 50:50. And the DNG looks quite credible in RawTherapee 5.7.