Google cardBoard Android API (五):Distortion
2016-03-21 15:00
411 查看
public class Distortion
Defines all required parameters to correct the distortion caused by the lenses.
▸From class java.lang.Object
Constructs a copy of another distortion object.
Parameters
Return distortion parameters for Cardboard v1.0.0.
Distorts a radius by its distortion factor from the center of the lenses.
Parameters
Returns
The distorted radius in tan-angle units.
Returns the distortion factor of a point.
Parameters
Returns
The distortion factor. Multiply by this factor to distort points.
Compares this instance with the specified object and indicates if they are equal.
Parameters
Returns
Builds an inverse-distortion object with least-squares-fitted coefficients.
This is intended for implementing application-side custom distortion. Use .getCoefficients() on the returned object to retrieve the inverse distortion function's coefficients.
This is an approximate inverse, and using .distort() on the returned object will be faster but less accurate than using the distortInverse() method on the original. For useful results, the input distortion must be well-behaved in the 0..maxRadius range.
Example for 50 degree half-angle FOV (100 degrees total), this will create an inverse distortion where inverse.distort(r) approximately equals distortion.distortInverse(r) in the range r = 0 ... maxFovHalfAngle.
Parameters
Returns
New distortion object.
Returns the current coefficients for lens distortion correction.
Returns
A floating point array with the current barrel distortion coefficients.
Sets the coefficients for lens distortion correction.
The coefficients Ki correspond to the pincushion distortion equation:
Where r is the distance from the optical center, p the input point and p' the output point.
Parameters
Returns a string containing a concise, human-readable description of this object.
Returns
A printable representation of this object.
Defines all required parameters to correct the distortion caused by the lenses.
Public Constructors
Distortion() |
Distortion(Distortion other) |
Public Methods
staticDistortion | cardboardV1Distortion() |
float | distort(float radius) |
float | distortionFactor(float radius) |
boolean | equals(Object other) |
Distortion | getApproximateInverseDistortion(float maxRadius, int numCoefficients) |
float[] | getCoefficients() |
void | )]setCoefficients(float[] coefficients) |
String | toString() |
Inherited Methods
▸From class java.lang.Object
Public Constructors
public Distortion ()
public Distortion (Distortion other)
Constructs a copy of another distortion object.Parameters
other | The distortion object to copy from. |
---|
Public Methods
public static Distortion cardboardV1Distortion ()
Return distortion parameters for Cardboard v1.0.0.
public float distort (float radius)
Distorts a radius by its distortion factor from the center of the lenses.Parameters
radius | Radius from the lens center in tan-angle units. |
---|
Returns
The distorted radius in tan-angle units.
public float distortionFactor (float radius)
Returns the distortion factor of a point.Parameters
radius | Radius of the point from the lens center in tan-angle units. |
---|
Returns
The distortion factor. Multiply by this factor to distort points.
public boolean equals (Object other)
Compares this instance with the specified object and indicates if they are equal.Parameters
other | The object to compare this instance with. |
---|
Returns
trueif the objects are equal,
falseotherwise.
public Distortion getApproximateInverseDistortion (float
maxRadius, int numCoefficients)
Builds an inverse-distortion object with least-squares-fitted coefficients.This is intended for implementing application-side custom distortion. Use .getCoefficients() on the returned object to retrieve the inverse distortion function's coefficients.
This is an approximate inverse, and using .distort() on the returned object will be faster but less accurate than using the distortInverse() method on the original. For useful results, the input distortion must be well-behaved in the 0..maxRadius range.
Example for 50 degree half-angle FOV (100 degrees total), this will create an inverse distortion where inverse.distort(r) approximately equals distortion.distortInverse(r) in the range r = 0 ... maxFovHalfAngle.
float maxFovHalfAngle = 50.0f * Math.PI / 180.0f; float maxRadiusLens = distortion.distortInverse(maxFovHalfAngle); Distortion inverse = distortion.getApproximateInverseDistortion( maxRadiusLens, 6);
Parameters
maxRadius | Maximum supported radius in tan-angle units in lens space (after applying barrel distortion). Should be set to inverseDistort(tan(maximum expected FOV angle)) to create an inverse that will be usable for inputs up to tan(maximum expected FOV angle). |
---|---|
numCoefficients | Number of desired coefficients, more provide a better fit. Does not need to match the number of coefficients in the input distortion object. 6 coefficients recommended for current Cardboard devices, using more can get numerically unstable. |
Returns
New distortion object.
public float[] getCoefficients ()
Returns the current coefficients for lens distortion correction.Returns
A floating point array with the current barrel distortion coefficients.
public void setCoefficients (float[] coefficients)
Sets the coefficients for lens distortion correction.The coefficients Ki correspond to the pincushion distortion equation:
p' = p (1 + K1 r^2 + K2 r^4 + ... + Kn r^(2n))
Where r is the distance from the optical center, p the input point and p' the output point.
Parameters
coefficients | Barrel distortion coefficients to set. |
---|
public String toString ()
Returns a string containing a concise, human-readable description of this object.Returns
A printable representation of this object.
相关文章推荐
- [原创]Android Lollipop (5.0) 原生代码 Settings 首页加载逻辑分析
- Android 动画机制 之 视图动画
- Android屏幕适配全攻略(最权威的官方适配指导)
- Android图片加载缓存框架Glide
- Google cardBoard Android API (四):Constants
- Google cardBoard Android API (三):CardboardView
- android ARM 汇编学习 —— hello world
- Fragment提交transaction导致state loss异常
- 获取svn版本号并替换AndroidManifest
- android 6.0权限管理特性
- Google cardBoard Android API (二):CardboardDeviceParams
- Android防止按钮被多次点击
- android SharedPreferences工具类
- android全屏和取消全屏 旋转屏幕
- 简单学习Android Socket的使用方法
- 自学Android第一步
- Android中 AsyncTask和Handler对比(特别有用)
- android的Animation用法简介
- Gson的详细使用(android必备,快速提高开发效率)
- Google cardBoard Android API (一):CardboardActivity