Author Topic: Automatic color grading script for photos (uniform_exposure.py)  (Read 94471 times)

brapodam

  • Member
  • ***
  • Posts: 121
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #25 on: July 15, 2013, 09:39:50 AM »
Sure, here is the dev.log: https://docs.google.com/file/d/0BzFGDdZw7pVwTmFSTW9TUFdIb3M/edit?usp=sharing

Intermediate files open fine, I'll try enfuse now

EDIT: enfuse produces a file with the same error, though I don't see anything unusual in the command prompt when I run enfuse
Quote
enfuse: info: input image "00000001-h0.jpg" does not have an alpha channel;
enfuse: info: assuming all pixels should contribute to the final image
enfuse: info: input image "00000001-h1.jpg" does not have an alpha channel;
enfuse: info: assuming all pixels should contribute to the final image
enfuse: info: input image "00000001-m.jpg" does not have an alpha channel;
enfuse: info: assuming all pixels should contribute to the final image
enfuse: info: input image "00000001-s0.jpg" does not have an alpha channel;
enfuse: info: assuming all pixels should contribute to the final image
enfuse: info: input image "00000001-s1.jpg" does not have an alpha channel;
enfuse: info: assuming all pixels should contribute to the final image
enfuse: warning: no usable resolution found in first image "00000001-h0.jpg";
enfuse: warning:   will use 300 dpi
enfuse: info: loading next image: 00000001-h0.jpg 1/1
enfuse: info: loading next image: 00000001-h1.jpg 1/1
enfuse: info: loading next image: 00000001-m.jpg 1/1
enfuse: info: loading next image: 00000001-s0.jpg 1/1
enfuse: info: loading next image: 00000001-s1.jpg 1/1

Here's a final output file: https://docs.google.com/file/d/0BzFGDdZw7pVwRlZLMzh1d3lMcFU/edit?usp=sharing

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #26 on: July 15, 2013, 09:44:57 AM »
Can you upload a final jpeg file?

I have enfuse 4.0-753b534c819d, what version is yours? I know syntax changed a little between 3.x and 4.x, but I'm not using any advanced options here.

brapodam

  • Member
  • ***
  • Posts: 121
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #27 on: July 15, 2013, 09:50:41 AM »
Strangely enough though, GIMP is able to open it. Some programs, like the default image viewer in Ubuntu, as well as Avidemux (which I use for time lapse sequences) are unable to open it

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #28 on: July 15, 2013, 09:53:52 AM »
Here, imagemagick says:

Code: [Select]
convert: Sorry, there are legal restrictions on arithmetic coding `00000001.jpg' @ error/jpeg.c/EmitMessage/235.

So... try to output a png or tiff or something:

Code: [Select]
j  = os.path.join(out_dir, change_ext(f, ".tif"))

Audionut

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3454
  • Blunt and to the point
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #29 on: July 15, 2013, 09:58:07 AM »
As Alex wrote, 3 stops is expected for 5DIII.

I haven't got my head around how the logarithmic SNR ratio plays into the equation.
Judging from the histogram (and others I've been playing with) I posted above, the tonal quality of a single ISO 100 shot falls to crap around -10.5EV.  The histogram of the enfused shots, show all but 100% tonal quality over the entire 16EV.  That's more then 3 stops improvement :)  I haven't done any testing by eye.

http://www.clarkvision.com/articles/evaluation-canon-5diii/
Quote
Table 2 shows the noise as a function of ISO in image form. The images illustrate several things: 1) lower banding noise at higher ISOs. 2) Better detection of smaller signals at higher ISOs (the random noise decreases). 3) At a certain high ISO, improvements decrease, meaning there is no benefit to higher ISO. Note, ISO is a post sensor gain and does not increase sensitivity. Increasing ISO digitizes a smaller range (see Table 1) but does improve the noise floor. While some banding noise is apparent at ISO 1600, would not be noticeable in many images. At ISO 3200 and higher, banding noise is almost negligible.

It depends on the model............It also depends on the ISOs used

Indeed.  Just like everything in life, there are compromises.  From what I've seen of a1ex's code so far, this little trick doesn't come for free ;)

brapodam

  • Member
  • ***
  • Posts: 121
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #30 on: July 15, 2013, 09:59:33 AM »
Here, imagemagick says:

Code: [Select]
convert: Sorry, there are legal restrictions on arithmetic coding `00000001.jpg' @ error/jpeg.c/EmitMessage/235.

So... try to output a png or tiff or something:

Code: [Select]
j  = os.path.join(out_dir, change_ext(f, ".tif"))
Ok, setting the output file to png works. Thanks!

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #31 on: July 15, 2013, 10:07:37 AM »
Cool.

For timelapse, this script may not be ideal; you probably want the same settings on all files, rather than analyzing every single image and deciding how many exposures it needs.

If you disable highlight/shadow recovery (e.g. by setting the thresholds to extreme values), you should get similar results as with ML post deflicker. Maybe slightly less accurate because of downsampling.

pascal

  • Freshman
  • **
  • Posts: 90
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #32 on: July 15, 2013, 10:08:21 AM »
Hi, does this ISO trick also work for video captures? I see you merge 2 ISO images somehow. But that does not work für video production then, unless we capture something static right?

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #33 on: July 15, 2013, 10:13:01 AM »
You'll see when I'll announce it. There are still some little glitches in the workflow, and I'll try to publish the code these days.

brapodam

  • Member
  • ***
  • Posts: 121
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #34 on: July 15, 2013, 11:30:12 AM »
Cool.

For timelapse, this script may not be ideal; you probably want the same settings on all files, rather than analyzing every single image and deciding how many exposures it needs.

If you disable highlight/shadow recovery (e.g. by setting the thresholds to extreme values), you should get similar results as with ML post deflicker. Maybe slightly less accurate because of downsampling.
I doubt setting the thresholds to extreme values will help, especially in something like a sunrise/sunset/day to night time lapse. If you set highlight level to the max (65k or something), for the dark photos in the whole sequence, the script will try to push the highlights up, causing what is supposed to be a dark sky to appear bright.

Nevertheless, I'll still try playing around with the thresholds to see if it works. Maybe something like setting the shadow level to 1 but lowering the highlight level from the default value.

UPDATE: setting shadow_level to 1 and highlight_level to 500000 as suggested by a1ex produced results similar to post deflicker (no highlight or shadow recovery) for time lapse purposes. Exposure transitions were smooth for the most part but there were a few inconsistencies towards the end of the video


Quote
# from 0 to 65535
highlight_level = 50000
midtone_level = 10000
shadow_level = 1000
The values there can't be 0. Using 0 as the shadow level results in a divide by 0 error  :)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #35 on: July 15, 2013, 12:05:24 PM »
Setting highlight_level to 500000 and shadow_level to 1 should disable any correction. It's out of range, but it works because highlight correction is always negative compared to midtones, shadow correction is always positive.

CarVac

  • New to the forum
  • *
  • Posts: 12
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #36 on: July 15, 2013, 10:16:46 PM »
Can I expect this magical HDR readout mode to read the sensor quickly enough to be hand-holdable, or is it just a way to do HDR capture on a tripod, but in a single file (by effectively doing multiple silent exposures at different ISOs, for example)

I dream of getting clean shadows from handheld shots. I have written a tonemapping program of sorts that benefits enormously from clean shadows, but there are so many times when I don't have a tripod for bracketed shots.

Danne

  • Hero Member
  • *****
  • Posts: 3611
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #37 on: July 15, 2013, 10:25:05 PM »
I,m amazed

togg

  • Senior
  • ****
  • Posts: 287
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #38 on: July 16, 2013, 12:14:16 AM »
No, just one.

I'm not sure I've got it. You have found/invented something that increase the DR of a single photo?

Yoshiyuki Blade

  • Member
  • ***
  • Posts: 103
  • 5D2
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #39 on: July 16, 2013, 01:09:25 AM »
Easy, with that theory that almost nobody believed: ISO 1600 is less noisy than ISO 100.

;)

Something along these lines: http://www.guillermoluijk.com/article/nonoise/index_en.htm

Dang, I wish I learned about this earlier  ;D I've been dabbling with enfuse by pushing an image in different directions and merging them together and thought, "Damn, it's great that I can see lots of shadow+highlight detail in one exposure now, but man it's noisy in the shadows." Now I gotta grab some new footage while it's still day outside at a high ISO and play with it later.  :o

brapodam

  • Member
  • ***
  • Posts: 121
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #40 on: July 16, 2013, 02:07:11 AM »
I'm not sure I've got it. You have found/invented something that increase the DR of a single photo?
The DR is there, he just found a good way to squeeze all of it out of the image. I don't think you can "increase the DR of a single photo"; what's captured in a raw photo is stored in the raw photo, you just need to be able to bring it out.

CarVac

  • New to the forum
  • *
  • Posts: 12
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #41 on: July 16, 2013, 04:05:15 AM »
The DR is there, he just found a good way to squeeze all of it out of the image. I don't think you can "increase the DR of a single photo"; what's captured in a raw photo is stored in the raw photo, you just need to be able to bring it out.

No, I don't think that's the case. The DR is not there; this supposedly actually reduces the noise in the shadows relative to an ordinary image readout.

hjfilmspeed

  • Senior
  • ****
  • Posts: 469
  • 5D III and IV
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #42 on: July 16, 2013, 05:35:52 AM »
Im so confused. So far it seams to be a a way to merge 2 exposures but not a standard HDR way. I read a little and from what i understand one exposure is a normal exposure possibly protecting highlights a little and the other is for shadows, not to bring up shadows but to clean them up. But ive always found canon iso to be strange. i thought sensors had a native iso so how can canon have all these iso options. is it just meta data or what? I would love to try this what ever it is.

ilguercio

  • Hero Member
  • *****
  • Posts: 843
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #43 on: July 16, 2013, 07:52:37 AM »
I guess there is more behind it than simple automatic color grading.
:)
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

ilguercio

  • Hero Member
  • *****
  • Posts: 843
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #44 on: July 16, 2013, 05:14:48 PM »
I guess this also mean that now you know how the heck the ISO speed works on a Canon DSLR.
Any hints?
Canon EOS 6D, 60D, 50D.
Sigma 70-200 EX OS HSM, Sigma 70-200 Apo EX HSM, Samyang 14 2.8, Samyang 35 1.4, Samyang 85 1.4.
Proud supporter of Magic Lantern.

IliasG

  • Member
  • ***
  • Posts: 124
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #45 on: July 16, 2013, 05:37:06 PM »
I haven't got my head around how the logarithmic SNR ratio plays into the equation.

It's simple when working in stops (log2). ISO 1600 should have 4 stops less DR than ISO100. DXO measures it at only 1stop lower so the gain is 3 stops.

Quote
Judging from the histogram (and others I've been playing with) I posted above, the tonal quality of a single ISO 100 shot falls to crap around -10.5EV.  The histogram of the enfused shots, show all but 100% tonal quality over the entire 16EV.  That's more then 3 stops improvement :)  I haven't done any testing by eye.

At -10.5EV SNR is 1.0 .. totally crap .. but I would call it simply crap even at -9EV where SNR is around 4.0 ..



Look at how many values have population ..  8500 from 50000 available at best. On 0R0A0640-fullres-soft.DNG I count 12800 from 52000 available.
Raw levels density starts at 1:1 at the darks and goes up to 1:9 at highlights. Looks like a 14bit log file linearized at 16bit

Quote
Indeed.  Just like everything in life, there are compromises.  From what I've seen of a1ex's code so far, this little trick doesn't come for free ;)

Can you clarify .. what's the cost as you see it ?.




escho

  • Senior
  • ****
  • Posts: 482
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #46 on: July 16, 2013, 06:22:59 PM »
I hoped, the dual iso trick would work with my 600D. But as I see in the code of alex, it only works on 5d3 and 7d. Nevertheless great work!

Edgar

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10711
  • 5D Mark Free
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #47 on: July 16, 2013, 06:36:37 PM »
The mistery should clear up now.

Announced here: http://www.magiclantern.fm/forum/index.php?topic=7139

IliasG

  • Member
  • ***
  • Posts: 124
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #48 on: July 16, 2013, 07:31:09 PM »
Really magic !!!!!!

togg

  • Senior
  • ****
  • Posts: 287
Re: Automatic color grading script for photos (uniform_exposure.py)
« Reply #49 on: July 17, 2013, 03:56:30 AM »
The mistery should clear up now.

Announced here: http://www.magiclantern.fm/forum/index.php?topic=7139

Now we are talking :D I want to read the pdf to understand how all of that was possible.