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.
18 lines
779 B
18 lines
779 B
#include "basicCameraInfo.h"
|
|
|
|
float calcFOV(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.f * atanf((SensorSize * 25.4f) / (2.f * FN));
|
|
};
|
|
|
|
float calcMaxDistance(float SensorSize, float MaxFL, int ImageWidth ){
|
|
double tFOV, tt;
|
|
tFOV = calcFOV(SensorSize, MaxFL);
|
|
tt = tFOV / ((float)ImageWidth); // 1 pixel
|
|
return .01 / tan(tt / 2.0); // return Distance in meters to see 1 cm as 1 pixel
|
|
};
|