和Determine angle of view of smartphone camera一样的问题,申请了WP7。似乎找不到合适的方法,我不想让我的用户自己校准它(如果可能的话)。谢谢
发布于 2011-11-03 16:11:35
请看这篇文章
How to find out the aperture angle of an android camera
在WP7中,没有API函数可以实现,也没有其他选项。
(我也在做同样的事情,我们在寻找自动校准方法方面投入了大量资金,但没有成功。)
编辑
为比尔和微软公司干杯,献爱心。
发布于 2011-11-03 11:50:53
我不知道如何获得相机的角度,但我有一个应用程序,将计算倾斜的基础上的手机偏航/滚动/俯仰。
namespace PhoneUtilities.Utilities
{
public class AccelerometerMath
{
public static double RadianToDegree(double radians)
{
return radians * (180 / Math.PI);
}
public static double Pitch(AccelerometerReading e)
{
return RadianToDegree((Math.Atan(e.Acceleration.X / Math.Sqrt(Math.Pow(e.Acceleration.Y, 2) + Math.Pow(e.Acceleration.Z, 2)))));
}
public static double Roll(AccelerometerReading e)
{
return RadianToDegree((Math.Atan(e.Acceleration.Y / Math.Sqrt(Math.Pow(e.Acceleration.X, 2) + Math.Pow(e.Acceleration.Z, 2)))));
}
public static double Yaw(AccelerometerReading e)
{
return RadianToDegree((Math.Atan(Math.Sqrt(Math.Pow(e.Acceleration.X, 2) + Math.Pow(e.Acceleration.Y, 2)) / e.Acceleration.Z)));
}
}
}计算得到了倾斜的角度,这是一个我用来进行三角计算的例子Cos( angle ) = adj/hyp:
private double CalcUpAdj(AccelerometerReading reading)
{
double angle = PhoneUtilities.Utilities.AccelerometerMath.Yaw(reading);
//Get the angleNeeded for calculation
double angleNeeded = Math.Abs(angle);
double adj = CalcAdj(angleNeeded);
tbAngle.Text = String.Format("{0:0.00}", angleNeeded) + (char)176;
textBlockAdj.Text = adj.ToString();
return adj;
}
private double CalcAdj(double angleNeeded)
{
double number;
if (double.TryParse(tbHyp.Text, out number))
{
double hyp = number;
double adj = Math.Cos(Math.PI * angleNeeded / 180) * hyp;
tbAngle.Text = String.Format("{0:0.00}", angleNeeded) + (char)176;
textBlockAdj.Text = adj.ToString();
return adj;
}
return 0;
}我不知道这是否对你的相机有帮助,但我想如果你知道屏幕的尺寸,你可以根据手机的倾斜来计算角度。希望你会发现这对你有帮助。
https://stackoverflow.com/questions/7982585
复制相似问题