How to calculate vertical viewing angle? - Script Writing - CHDK Forum

# How to calculate vertical viewing angle?

• 6 Replies
• 2823 Views

#### artem78

• 11
##### How to calculate vertical viewing angle?
« on: 27 / March / 2019, 14:02:54 »
How can I get vertical viewing angle in degrees in Lua?
Canon PowerShot SX220 1.01a / CHDK 1.4.1-4599

#### reyalp

• 14087
##### Re: How to calculate vertical viewing angle?
« Reply #1 on: 27 / March / 2019, 16:25:40 »
How can I get vertical viewing angle in degrees in Lua?
You can get the 35mm equivalent focal length from get_dofinfo https://chdk.fandom.com/wiki/Script_commands#get_dofinfo and then use formulas or tables available from the internet https://en.wikipedia.org/wiki/Angle_of_view

Note: You need to ensure the calculation is correct for your cameras sensor aspect ratio. Most CHDK cameras are 4:3 (with some exceptions) while resources for SLRs might assume 3:2.
Don't forget what the H stands for.

#### artem78

• 11
##### Re: How to calculate vertical viewing angle?
« Reply #2 on: 27 / March / 2019, 17:21:50 »
From what I understand, I also need crop-factor or physical size of sensor in mm. How can I get one of them?
Canon PowerShot SX220 1.01a / CHDK 1.4.1-4599

#### reyalp

• 14087
##### Re: How to calculate vertical viewing angle?
« Reply #3 on: 27 / March / 2019, 17:25:26 »
From what I understand, I also need crop-factor or physical size of sensor in mm. How can I get one of them?
Not if you use EFL (35mm equivalent) which already has that conversion built in.
Don't forget what the H stands for.

#### artem78

• 11
##### Re: How to calculate vertical viewing angle?
« Reply #4 on: 28 / March / 2019, 08:04:50 »
resources for SLRs
What does it means?
Canon PowerShot SX220 1.01a / CHDK 1.4.1-4599

#### artem78

• 11
##### Re: How to calculate vertical viewing angle?
« Reply #5 on: 28 / March / 2019, 10:25:52 »
Most CHDK cameras are 4:3 (with some exceptions)
Where I can found this list? Is CHDK provide function for get sensor aspect ration?
Canon PowerShot SX220 1.01a / CHDK 1.4.1-4599

#### reyalp

• 14087
##### Re: How to calculate vertical viewing angle?
« Reply #6 on: 28 / March / 2019, 13:48:41 »
resources for SLRs
What does it means?
I mean if you find a formula or tool online, it might assume a different aspect ratio, because professional cameras like DSLRs are often different from what the CHDK cameras use.

Where I can found this list? Is CHDK provide function for get sensor aspect ration?
There is no function in CHDK that directly gives you the sensor aspect ratio.

You can get the current *image* aspect ratio from ASPECT_RATIO propcase: https://chdk.fandom.com/wiki/PropertyCase
but this doesn't exist (or isn't known) for propset 1, and the values might have different meanings between propsets.

You could get the sensor aspect ratio from raw dimensions at https://chdk.fandom.com/wiki/CameraFeatureTable
or from the CHDK source.

Or you could just not worry about it:  The vast majority of CHDK cameras are 4:3.  I believe the only 3:2 cameras are G7 X, EOS M3 and EOS M10

Some cameras have 16:9 screens, but I believe most (if not all?) still use 4:3 sensors.
Don't forget what the H stands for.