added image flip and fixed focal length

This commit is contained in:
ori
2019-09-21 08:06:27 -07:00
parent 84ddc8ec4e
commit 4c315ac554
2 changed files with 8 additions and 4 deletions

View File

@@ -37,10 +37,11 @@ public class CameraValues {
HorizontalView = FastMath.atan(FastMath.tan(DiagonalView / 2) * (HorizontalRatio / DiagonalView)) * 2;
VerticalView = FastMath.atan(FastMath.tan(DiagonalView/2) * (VerticalRatio / DiagonalView)) * 2;
HorizontalFocalLength = ImageWidth / (2 * FastMath.tan(HorizontalView /2));
VerticalFocalLength = ImageWidth / (2 * FastMath.tan(VerticalView /2));
VerticalFocalLength = ImageHeight / (2 * FastMath.tan(VerticalView /2));
}
public double CalculatePitch(double PixelY, double centerY){
return (FastMath.toDegrees((FastMath.atan(PixelY - centerY) / VerticalFocalLength)) * -1);
double pitch = (FastMath.toDegrees((FastMath.atan(PixelY - centerY) / VerticalFocalLength)));
return (pitch * -1);
}
public double CalculateYaw(double PixelX, double centerX){
return FastMath.toDegrees(FastMath.atan(PixelX - centerX) / HorizontalFocalLength);