Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the angle the WP7 Camera sees?

Same question as Determine angle of view of smartphone camera, applied for WP7. Can't seem to find an appropriate method, and I don't want to put my users through calibrating it themselves (if possible). Thanks

like image 966
SBoss Avatar asked Nov 02 '11 15:11

SBoss


2 Answers

Please see this post

How to find out the aperture angle of an android camera

in WP7, there is no API function to get that, and no other option than

  • Ask user introduce it (they never know)
  • Make a list of phones you support and obtain/measure it for each one. Store it in your app. (crazy!)

(I am doing the same kind of stuff and we invested a lot in finding automatic calibration methods, without success.)

EDIT

Cheers and love for bill and microsoft co.

like image 57
Sam Avatar answered Nov 06 '22 15:11

Sam


I dont know how to get the angle of the camera, but I do have an app that will calculate the tilt of the phone based on the Yaw/Roll/Pitch.

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)));
        }
    }
}

The calculations were able to get me the angle of the tilt, here is an example I use for some trig calculation 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;
}

I dont know if this will help you with your camera, but I imagine if you knew the dimensions of the screen you could calculate the angle based on the tilt of the phone. Hopefully you find this helpful.

like image 3
Etch Avatar answered Nov 06 '22 14:11

Etch