Author Topic: Auto exposure algorithm for shooting - auto iso, ae (autoexpo.mo)  (Read 127159 times)

pravdomil

  • Member
  • ***
  • Posts: 166
I discover how to get brightness value so I implement new automatic exposure algorithm based on predefined curves.
It's like a real 'P' where you actually program what you want the camera to do depending on the light.





Instructions
Autoexpo is based on APEX system
Tv minimum
sets the minimum shutter value
Av range
sets aperture range, if it not match with current lens, it doesn't matter, it will be compensated with shutter
Av curve
by main dial you set point where will start aperture decreasing (in BV value)
speed dial sets how much will be aperture decreased, it sets the slope (minus EV per one BV)
ISO range
100 - 25600 make sure that you set correct ISO range (you can set this values via Canon ISO menu), otherwise you can get incorrect exposure. It also solves the 5D2 auto ISO bug, where is ISO hardcored to 400.
ISO curve
by main dial you set point where will start ISO increasing (in BV value)
speed dial sets how much will be ISO increased, it sets the slope (plus EV per one BV)
Graph
on the X axis is light (Brightness Value)
on Y is shutter (Time Value), aperture (Aperture Value), ISO (Speed Value) and EC (Exposure Compensation)
on the left you have bright scenes on the right dark
here is a few BV values you can get:
16   light sand or snow
16 - 13   daylight
13 - 8   cloudy, shade
8 - 1   Indoor
> 1   low light
-12   complete darkness
full list
graph shows what combinations will be used depending on light conditions (on BV)
last BV value of current scene is marked with the cyan line
shutter value is computed dynamically as BV - AV + SV - EC


Download Source  Buy me a beer  :)


Porting to other cameras
http://www.magiclantern.fm/forum/index.php?topic=7208.msg62915#msg62915
http://www.magiclantern.fm/forum/index.php?topic=7208.msg66952#msg66952

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 10547
  • 5D Mark Free
Re: Auto exposure algorithm (auto iso, auto ae, 5D2 only)
« Reply #1 on: July 20, 2013, 11:07:26 AM »
Nice find!

I guess you want to find the luminance level of the scene, right?

Take the BV value from the expo menu (that is Av + Tv - ISO). When Bv is higher, the scene is brighter. Therefore, you should add the metered value to this.

That quantity would be the X axis on your graph (if you reverse it).

Theory: http://dougkerr.net/pumpkin/articles/APEX.pdf (mirror: http://acoutts.com/a1ex/APEX.pdf )

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm (auto iso, auto ae, 5D2 only)
« Reply #2 on: July 20, 2013, 11:20:49 AM »
Yes, luminance level of the scene. This is planned for shooting.

I already computed the bv val, and it works nicely with about +/- 0,5 EV tolerance, it depends of c. fn I exposure increment settings.
Code: [Select]
int bv = APEX_AV(lens_info.raw_aperture) + APEX_TV(lens_info.raw_shutter) - APEX_SV(lens_info.iso_equiv_raw) + (EXPO_COMP / 256);
Thanks for docs, but understanding apex is not too hard, I want to do some "blending" between shutter and iso. I need some hint. Maybe I can create some public excel doc, where will be the equation.

Btw: expo_comp int works in all modes not only M

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #3 on: July 21, 2013, 12:21:59 AM »
Yes...

Andy600

  • Hero Member
  • *****
  • Posts: 1838
  • Have you tried turning it off and on again?
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #4 on: July 21, 2013, 05:15:54 PM »
Nice :)

I don't think I can test because I only have manual lenses but I've found possible addresses on the 50D using your spy_ae module (by changing Exposure comp value and looking what changes):

77b4
1c18
3028
3074
3b38
3078

Maybe 1% or GregoryOfManhatten can take a look?

Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #5 on: July 21, 2013, 06:23:12 PM »
It works even if you unplug you lens (on 5D2)! Look at screen shot.
For better finding, here is what values it can acquire. (int16_t)

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #6 on: July 21, 2013, 06:53:26 PM »
So this allows us to set a minimum shutter value?

Andy600

  • Hero Member
  • *****
  • Posts: 1838
  • Have you tried turning it off and on again?
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #7 on: July 21, 2013, 06:54:50 PM »
3074 and 3078 show AE overflow and ISO is locked at 100 or AUTO (manual lens).

The other addresses don't seem to do anything.

TBH I'm not sure how to test this or what settings to change in the module, or if the settings will do anything without a chipped lens

Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #8 on: July 21, 2013, 07:34:45 PM »
Yes, this finding allows set all exposure setting dynamically.
I added minimum shutter option.
I don't know how to test it on other cameras without having it physically, send me you camera and I will implement it :).
For first release look above.

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #9 on: July 21, 2013, 07:46:24 PM »
I'll test... Installing now.

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #10 on: July 21, 2013, 07:49:13 PM »
Delete your module conf and download it now.
I have already test it, and it overexposures on bright scenes.

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #11 on: July 21, 2013, 08:06:54 PM »
Delete your module conf and download it now.
I have already test it, and it overexposures on bright scenes.

Download a new module? The one you first uploaded was buggy?

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #12 on: July 21, 2013, 08:46:24 PM »
no its still buggy, I did only cosmetics changes

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #13 on: July 22, 2013, 06:52:23 AM »
Next release.  This can be usable for shooting.

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #14 on: July 24, 2013, 02:52:13 AM »
Lock ISO & AV implemented, bugs fixed, look above.
Please test and port it!

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #15 on: July 24, 2013, 02:55:39 AM »
Well I tested. The thing is though I can only use this in Manual mode. Could you enable use in Av, Tv, P, or a Custom mode?

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #16 on: July 24, 2013, 03:06:14 AM »
Override automatic exposure in P mode, it doesn't have a sense. We cannot block Canon automatic exposure for now.
BTW: what are the disadvantages in M mode?

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #17 on: July 24, 2013, 03:10:41 AM »
I'm looking to be able to set a minimum shutter speed for a custom shooting mode (C1,C2,C3). Selecting min and max ISO, and wether to decrease the shutter speed and compensate with ISO, or the opposite, would also be nice.

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #18 on: July 24, 2013, 03:21:54 AM »
There was a discussion to attach different configs to custom modes.
But devs could not do it, because some there was some difficulties.
But I dont see any problems if custom modes will set to M.

How shutter speed compensation should work?

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #19 on: July 24, 2013, 03:38:44 AM »
How it will work? Well take this situation into account.

Say I'm shooting sunset with auto ISO and auto shutter speed. My settings in manual is 1/80 of a second my ISO is 800. Aperture value is irrelevant. The 5D mark II with auto ISO and auto shutterspeed would change the shutterspeed value to 1/30 or something lower, and the ISO to 200. I want for this module to make a cap on the shutter speed to he 1/80 so the ISO won't change to lower values. This minimum shutter speed setting is found in newer canon models such as the 6D, and 5D Mark III.

Basically the 5D mark II optimizes for lower ISO over a higher shutterspeed, I would like for it to be the opposite. This would be when the camera chooses a higher shutter speed over a lower ISO.

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #20 on: July 24, 2013, 03:54:42 AM »
set tv minimum to 1/80 thats the solution or not? and you can modify graph as you want?

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #21 on: July 24, 2013, 04:03:25 AM »
Ok let test this for a sec then.


xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #22 on: July 24, 2013, 04:28:04 AM »
Ok well this works fine but I can't choose an auto shutter speed in Manual mode, which is the reason why I'd like this to work in AV mode.

pravdomil

  • Member
  • ***
  • Posts: 166
Re: Auto exposure algorithm for shooting - auto iso, auto ae, 5D2 only
« Reply #23 on: July 24, 2013, 04:35:46 AM »
well this hack can run only in M mode, because only there this module can set all exposure values

xNiNELiVES

  • Senior
  • ****
  • Posts: 461
  • 5D II, 17-35mm F2.8L, 50mm F1.4, 70-200 F4L