You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

34 lines
1.5 KiB

#include "basicCameraInfo.h"
float calcFOV_inch(float SensorSize, float FN){
/*
The calculator below converts between the focal length f and the field of view (FOV) of a rectilinear lens.
The formula that it implements is FOV = 2 arctan (x / (2 f)), where x is the diagonal of the film.
The FOV is measured across the frame's diagonal, and is therefore smaller across the horizontal dimension,
and even smaller across the vertical dimension.
*/
return 2.0f * atanf((SensorSize * 25.4f) / (2.0f * FN));
};
float calcFOV_mm(float SensorSize, float FN){
/*
The calculator below converts between the focal length f and the field of view (FOV) of a rectilinear lens.
The formula that it implements is FOV = 2 arctan (x / (2 f)), where x is the diagonal of the film.
The FOV is measured across the frame's diagonal, and is therefore smaller across the horizontal dimension,
and even smaller across the vertical dimension.
*/
return 2.0f * atanf( SensorSize / (2.0f * FN));
};
float calcMaxDistance_inch( float SensorSize, float MaxFL, int ImageWidth ){
float tFOV, tt;
tFOV = calcFOV_inch( SensorSize, MaxFL);
tt = tFOV / ((float)ImageWidth); // 1 pixel
return .1 / tanf( tt / 2.0f ); // return Distance in meters to see 1 cm as 1 pixel
};
float calcMaxDistance_mm( float SensorSize, float MaxFL, int ImageWidth ){
float tFOV, tt;
tFOV = calcFOV_mm( SensorSize, MaxFL);
tt = tFOV / ((float)ImageWidth); // 1 pixel
return .1 / tanf( tt / 2.0f ); // return Distance in meters to see 1 cm as 1 pixel
};