Page 1 of 1
The math behind Iris to Aperture values
Posted: Thu Feb 09, 2017 1:14 am
by Mohamed Selim
Hi,
I would like to know how ARRIRAW Converter spits out the "exr/aperture" value which is not detected in the raw file in Nuke for example.
I have read the Metadata white paper and honestly the math is to complicated for me. I would like to build a tool in Nuke to auto convert the Lens Iris values in the raw metadata to an aperture value.
for example i have an ARRIRAW file loaded in ARRIRAW Converter with the following:
- Iris: 5.6+3/10
- Linear Iris: 6272
The same file in Nuke:
- arri/camera/LensIris: 6.21606
EXR converted from ARRIRAW Converter and read in Nuke:
- exr/aperture: 5.65685
- exr/com.arri.camera.LensLinearIris 6.272
I'm after the aperture value which in this case is 5.65685. How do you convert those Iris or Linear Iris to that number?
Thanks
Re: The math behind Iris to Aperture values
Posted: Thu Feb 09, 2017 3:14 pm
by Jan Heugel
Dear Mohamed,
out of "there's a hundred pages document which you should look at", this is what's relevant for you:
Regular iris values
How to calculate regular Iris values from linear iris values:
Code: Select all
nt16 n = (LinearIris + 50) / 1000;
// now n equals the index + 1 of the correct T-stop without fraction (because n is an integer value)
// +50 is just because of rounding
n -= 1;
// subtract an offset of -1 to get the correct index
double FullAperture = exp2((double)n / 2);
// now calc 2^(n/2). n/2 has to be calculated float, result FullAperature is also floating point
To get the [1/10] of Aperture Stop out of the fraction do the following:
// get the fraction
int16 FractionAperture = (LinearIris + 50) % 1000;
// get the Aperture Tenth
int16 ApertureTenth = FractionAperture / 100;
While the above code is mathematically correct, it does not match the rounding conventions established in film and photography for centuries. A tabled approach prints the more familiar values:
Code: Select all
void printApertureValue(U32 apertureValue)
{
[i] // Standard full-stop f-number scale
// (conventional rounding of sqrt(2.0^N) N=-1,0,1,2,...,16)[/i]
double fNumberScale[18] = {0.7,1.0,1.4,2,2.8,4,5.6,8,11,16,22,32,45,64,90,128,180,256};
int linearIris = apertureValue + 50; // + 50 for rounding
int fullApertureIdx = linearIris / 1000;
int fractionAperture = linearIris % 1000;
int apertureTenth = fractionAperture / 100;
if(0 <= fullApertureIdx && fullApertureIdx < 18)
{
if(apertureTenth == 0)
{
printf("%.1f\n", fNumberScale[fullApertureIdx]);
}
else
{
printf("%.1f + %d/10\n", fNumberScale[fullApertureIdx], apertureTenth);
}
}
else
{
printf("out of bounds\n");
}
}
Here's an example list:
Iris_Example-list.png
Best regards,
Jan
Re: The math behind Iris to Aperture values
Posted: Fri Feb 10, 2017 1:07 pm
by Mohamed Selim
Hey Jan
Thanks. But the code posted above is exactly what I don't understand. How exactly do you do this on a calculator for instance?
This seems like code you have to do in some keda be of software?
Cheers
Re: The math behind Iris to Aperture values
Posted: Wed Apr 03, 2024 12:56 am
by fpalomares
Hi Arri Team,
So if my LensIris is set to: 2.0 +3/10, what would be the tcl formula to add to a Text node in Nuke?
Could you shed some light please?
Thanks
Re: The math behind Iris to Aperture values
Posted: Mon Apr 08, 2024 11:58 am
by Jan Heugel
Hi
@fpalomares
Why would you reverse this into the LDS-encoder's value?
@Mohamed,
yep that's the code I got for Nuke.
Best,
Jan