Dual ISO - massive dynamic range improvement (dual_iso.mo)

Started by a1ex, July 16, 2013, 06:33:50 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

akry

@a1ex,
1. Maybe text sidecar file(s) if it is not possible to write metadata directly. I can postprocess it later with LR plugin.
2. Sorry, couldn't find it. I'll check again.
3. Two jpegs as previews with two ISO settings. I realize it would be impossible to implement.

a1ex

1. Right, sidecar could work. We could start with a generic metadata library, I guess XMP is the obvious choice, to accept various settings that normally are in EXIF. Once we understand how to change the CR2 EXIF, we can modify the backend. Some related discussion here: http://www.magiclantern.fm/forum/index.php?topic=6226

3. The embedded JPEG is generated from the raw data, and it's possible to modify it. Here's an experiment on this: it does a simple dual iso processing right in the camera, so you can get the preview adjusted for either the high or the low ISO: http://www.magiclantern.fm/forum/index.php?topic=8667

However, the code is quite fragile, slow, and it's very likely to cause weird issues, including data loss. ML has to modify the raw buffer to generate the JPEG preview, then undo the changes before saving the CR2. All of this happens in Canon's picture taking tasks (SCS state & friends), which are very complex.

I might revisit it once I'll understand the picture taking process better.

Until then, raw histogram and raw zebras are your friends. Maybe also ML's playback exposure adjustment, sharpness 0, and monochrome picture style.

Marsu42

Quote from: a1ex on May 01, 2014, 09:13:10 PM
We could start with a generic metadata library

One step further towards some keyword tags in the sidecar file :-)

Quote from: a1ex on May 01, 2014, 09:13:10 PMand monochrome picture style.

Good thinking there, I think this deserves a "set picstyle to monochrome" setting in dual_iso to eliminate the magenta/cyan distraction!

a1ex

Quote from: Marsu42 on May 02, 2014, 12:29:40 AM
I think this deserves a "set picstyle to monochrome" setting in dual_iso to eliminate the magenta/cyan distraction!

From a grayscale JPEG, I even hope to be able to get a decent preview for checking the focus :D

(if you are bored, upload a screenshot of a dual iso picture, taken with monochrome style and sharpness 0, and zoomed in playback at 100% on some sharp detail; I might use it as test data for the algorithm)

Marsu42

Quote from: a1ex on May 02, 2014, 12:34:37 PM
if you are bored

In that case, I'd work on my modules :-p ... though I could probably manage a pull request for monochrome picstyle on dual_iso_is_active(), but I'd really really rather have you do it in 10 seconds.

The added goodie of this solution is that (at least on 6d) you can make the camera display a ! in the *viewfinder* that is otherwise inaccessible to ML so you could immediately see if dual_iso is enabled or not!

a1ex

Good point.

Meanwhile, I think I've got the preview correction working fairly well, with a very simple algorithm: if the pattern repeats every N lines (usual values are from 2 to 5, depending on zoom level), filter it with a Nx1 box blur twice (which will average out the lines), then sharpen the result with a 3x1 filter to bring back some details. Works on color shots too, but keeps the weird cast :)

Marsu42

Quote from: a1ex on May 02, 2014, 03:54:44 PM
Good point. [...] Meanwhile, preview correction working fairly well [...] but keeps the weird cast

I cannot test it atm since my laptop's sd card reader is going crazy, but sounds like a reasonable approach. Still, I'd +1 for the monochrome option since (next to the ! sign) the color cast is really distracting and doesn't help much to predict the final look, even with some dual_iso experience - ymmv.

a1ex

Done. It took a little more than 10 seconds, and it's not yet fully idiot-proof.

I'm starting to see the need for a backend for persistent storage, separate from the config file. Config can be enabled or disabled, but this persistent storage should be always on.

Common scenario: you change some Canon setting (here, the picture style), and you want to undo that change at shutdown (or, if the shutdown was unclean, at next reboot). The GPS trick from 6D is similar (change at shutdown, remember you changed it, restore at next boot). H.264 sound, now disabled by FPS override, could make use of it too (since you end up with sound disabled if you take the battery out while recording). Same for the AF button (picture taking routines, like bracketing, will move it to the back button to disable autofocus, so if you take the battery out in the middle of a bracket, you may end up with AF button misconfigured).

The file prefix is not persistent IIRC (need to double-check on 5D3, but on 60D and 5D2, Canon will reset it back to IMG_ at next boot).

A higher-level API could try to run all these cleanup routines at shutdown, and if the shutdown was not clean, they can be scheduled for next boot.

Battery discharge rate (now saved in the config file) could make use of this persistent storage too.

Marsu42

Quote from: a1ex on May 02, 2014, 05:55:38 PM
Done. It took a little more than 10 seconds, and it's not yet fully idiot-proof.

Yeah, that's why I like delegating tasks :-p because in my ML experience things are seldom as easy as they appear: multitudes of different situations pop up out of nowhere, not to mention the support for all eos models which you'll never see or own. Still, you're the most qualified person for dealing with the unexpected, thanks :-) !

joshuamk

Hi All,

Sorry if this isn't the best place to post this but i'm trying to test out one of your recent cr2hdr-20 bit updates but am having a bit of a battle with the dcraw and exiftool.

What happens when I drop a CR2 or DNG onto the cr2hdr executable is the command prompt flashes open then closes immediately. However I caught it open in this screen shot so perhaps it will give some clue as to the problem. Again i'm sure this is basic but you could just save my bacon if you can help me get this working.

https://www.dropbox.com/s/shzqgvmk6lbbwr3/Screen%20Shot%202014-05-04%20at%2014.43.52.png

a1ex

Looks like the CR2 files are on a network path; try copying them to a local directory.

Marsu42

Quote from: a1ex on May 04, 2014, 09:59:12 PM
Looks like the CR2 files are on a network path; try copying them to a local directory.

... or assign a drive letter to the unc path, many windows programs still cannot handle them. You'll still copy the temporary files over the network two times, if that's a problem.

Speaking of which: Probably cr2hdr deserves an option to assign a temp working directory where to copy/process the intermediary files, people could also use a ram disk or their fastest drive where the temp dir should be. This would also be handy if processing dual_iso files directly from the sf/cf card.

Audionut

cr2hdr is processor bound.

If cr2hdr cached a number of files in a ram drive, it may speed up processing by some very small percentage.  Pointless imo.

Marsu42

Quote from: Audionut on May 05, 2014, 02:59:49 AM
cr2hdr is processor bound.

Not if you're processing the files directly from the cf/sd card as the temp files also end up there, you have to copy the files first off the card or you're killing the card with additional r/w cycles and the speed is crawling. This and the unc path problem imho are enough to warrant a "temp file path" option.

RTLdan

Quote from: joshuamk on May 04, 2014, 03:52:32 PM
Hi All,

Sorry if this isn't the best place to post this but i'm trying to test out one of your recent cr2hdr-20 bit updates but am having a bit of a battle with the dcraw and exiftool.

What happens when I drop a CR2 or DNG onto the cr2hdr executable is the command prompt flashes open then closes immediately. However I caught it open in this screen shot so perhaps it will give some clue as to the problem. Again i'm sure this is basic but you could just save my bacon if you can help me get this working.

https://www.dropbox.com/s/shzqgvmk6lbbwr3/Screen%20Shot%202014-05-04%20at%2014.43.52.png

Hi Joshua,
I had this exact same problem the other night trying to get it to run on XP via Bootcamp.
After much frustration, I did get it working by doing the following:

I downloaded an earlier version of cr2hdr from https://bitbucket.org/a_d_/magic-lantern/downloads. The one dated 2013-10-04.

I then took the dcraw and exiftool files and copied them into c:/windows/system32.
Cr2HDR is a command line application. It relies on dcraw and exiftool. Basically, by placing them in the system32 folder, the command line knows exactly where to find them.

Finally, I downloaded the most current version of Cr2Hdr from the dual ISO thread page here:
http://www.magiclantern.fm/forum/index.php?topic=7139.0. Go ahead and delete the dcraw and exiftool that come with it.

You should now be able to use the application like normal -- by dragging your files over it.

Hope this solution works well for you like it did for me.
-Daniel

joshuamk

Hi All,

Thank you all for the feedback 10 points! RTLdan your step-by-step was well appreciated.

The images I get out of the 20 bit version are much better. Just waiting on an after effects output then we'll see how the aliasing stands up to scrutiny when played back.

Can't thank you enough I'm glad I got involved in the forums.

joshuamk

Just processed a bunch of images and there is some improvement over the original mac GUI that I have been using (as you would expect).

But I do seem miles away from the kind of smooth edges that A1ex had demonstrated in the dng of the batman figure. http://www.magiclantern.fm/forum/index.php?topic=7139.1925

Here are two sections from a frame i have been testing cr2hdr on. the first was done using the original mac GUI which was released on 02/12/2013 and the second I processed today with what I was sure was the latest build. But now looking at them I am questioning that I have this right.
https://www.dropbox.com/s/2gt40u0k80nx459/crop1.jpg
https://www.dropbox.com/s/80py07v30n2qid4/crop%20new.jpg

I'm certain i'm making an error here because there is barely any difference regarding the aliasing in particular (which to me is the first hurdle to getting usable dual iso video).
The batman image was taken using the same iso spacing and from what I can tell had more edge aliasing to contend with.

How can I get better results? Which build should I be using to re-create the results that have been demonstrated so far.


a1ex


joshuamk

haha nice. If only that were an option. Prefer not to shoot video in 'tallscreen'

ShaunWoo

Hey guys, ive been going crazy here, i been trying to use the latest: cr2hdr-20bit.exe a1ex has provided, it is stored in "C:\0" along side dcraw.exe and exiftool.exe files in the same folder, some dual iso dng files process fine, but then i get to a certain file and it cause cr2hdr-20bit.exe to crash forcing me to click the close program button, it is not just one video, its many, it works completely fine with older versions of cr2hdr, like the 2013.10.04 version, also 2014.01.23, but they dont have the "same levels" parameter options that i need to keep the sequence flicker free. i found other versions of dcraw, exiftool, replaced them, same thing, so im assuming its cr2hdr.exe file, or something wrong with me, i even tried on another computer, rebooting it, cant think of anything else, i shot another video, same thing, it will crash on certain frames, im very sure the frames are fine as they have the same dng file size as its neighbouring files and they open fine in photoshop, bridge, etc, tried running with the --same-levels parameters initially, same results if i clicked and dragged dng files onto the original exe, or the shortcut with the parameters, tried individual files, all the same, tried redownloading your latest cr2hdr file, same

Hope to hear something back because im lost, i dont understand why this version crashes, am i the only one?



a1ex

It doesn't crash here. Do you have a screenshot when it crashes? Does it crash if you try to process only that file, or only when you try to process many files at once?

nachordez

A1ex, the Linux version that's in the linux ML tools post, is the 20 bit one? Or there are just .exe builds of it? I use linux and I'm trying the 20 bit by wine, but I would like to build it native if possible...

Great work! Thanks!
EOS 600D  /  OpenSuse 13.1

a1ex

You can identify it from the changeset number (it prints this at startup), then look it up in Bitbucket.

But on Linux it should be very easy to build your own (make cr2hdr).