Exemplo n.º 1
0
    public void LoadXML(XmlReader r)
    {
        Name = r.GetAttribute("Name");
        string type = r.GetAttribute("Type");

        ConnectionType = EConnectionType.RTP;
        if (type == "WebRTC")
        {
            ConnectionType = EConnectionType.WebRTC;
        }
        if (type == "Ovrvision")
        {
            ConnectionType = EConnectionType.Ovrvision;
        }
        else if (type == "RTP")
        {
            ConnectionType = EConnectionType.RTP;
        }
        else if (type == "Local")
        {
            ConnectionType = EConnectionType.Local;
            int count;
            int.TryParse(r.GetAttribute("Count"), out count);
            for (int i = 0; i < count; ++i)
            {
                int idx;
                if (int.TryParse(r.GetAttribute("Index" + i.ToString()), out idx))
                {
                    CameraIndex.Add(idx);
                }
            }
        }
        else if (type == "Movie")
        {
            ConnectionType = EConnectionType.Movie;
            MediaPath      = r.GetAttribute("Path");
        }

        type        = r.GetAttribute("StreamCodec");
        StreamCodec = EStreamCodec.Coded;
        if (type == "Raw")
        {
            StreamCodec = EStreamCodec.Raw;
        }
        else if (type == "Coded")
        {
            StreamCodec = EStreamCodec.Coded;
        }
        else if (type == "Ovrvision")
        {
            StreamCodec = EStreamCodec.Ovrvision;
        }

        IP       = r.GetAttribute("IP");
        URL      = r.GetAttribute("URL");
        Location = r.GetAttribute("Location");
        string v = r.GetAttribute("Longitude");

        if (v != null && v != "")
        {
            lng = double.Parse(v);
        }

        v = r.GetAttribute("Latitude");
        if (v != null && v != "")
        {
            lat = double.Parse(v);
        }
    }
Exemplo n.º 2
0
    /*
     * //http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html
     * public float fov=60;			//horizontal field of view for the camera measured in degrees
     * public float cameraOffset=0;	//physical offset from human eye
     * public float stereoOffset=0.065f;	//physical distance between both eyes
     *
     * public ECameraRotation[] cameraRotation=new ECameraRotation[2];
     *
     * public Vector2 OpticalCenter=new Vector2(0.5f,0.5f);
     * public Vector2 FocalCoeff=new Vector2(1,1);
     * public Vector4 KPCoeff=Vector4.zero;
     * public string Name="";*/


    public void LoadXML(XmlReader r)
    {
        Name    = r.GetAttribute("Name");
        Encoder = r.GetAttribute("Encoder");
        int.TryParse(r.GetAttribute("StreamsCount"), out StreamsCount);
        int.TryParse(r.GetAttribute("CameraStreams"), out CameraStreams);
        bool.TryParse(r.GetAttribute("OptimizeOVR"), out OptimizeOVRVision);
        bool.TryParse(r.GetAttribute("FlipX"), out FlipXAxis);
        bool.TryParse(r.GetAttribute("FlipY"), out FlipYAxis);
        bool.TryParse(r.GetAttribute("SeparateStreams"), out SeparateStreams);
        float.TryParse(r.GetAttribute("FOV"), out FoV);
        float.TryParse(r.GetAttribute("CameraOffset"), out CameraOffset);
        FrameSize   = Utilities.ParseVector2(r.GetAttribute("FrameSize"));
        LensCenter  = Utilities.ParseVector2(r.GetAttribute("OpticalCenter"));
        FocalLength = Utilities.ParseVector2(r.GetAttribute("FocalCoeff"));
        KPCoeff     = Utilities.ParseVector4(r.GetAttribute("KPCoeff"));
        Vector4 PixelShift = Utilities.ParseVector4(r.GetAttribute("PixelShift"));

        PixelShiftLeft.Set(PixelShift.x, PixelShift.y);
        PixelShiftRight.Set(PixelShift.z, PixelShift.w);
        string rot;

        switch (r.GetAttribute("Type"))
        {
        case "POV":
            CameraType = ECameraType.WebCamera;
            break;

        case "OMNI":
            CameraType = ECameraType.RicohTheta;
            break;
        }
        switch (r.GetAttribute("StreamCodec"))
        {
        case "Raw":
            streamCodec = EStreamCodec.Raw;
            break;

        case "Coded":
            streamCodec = EStreamCodec.Coded;
            break;

        case "Ovrvision":
            streamCodec = EStreamCodec.Ovrvision;
            break;

        case "FoveatedOVR":
            streamCodec = EStreamCodec.FoveatedOvrvision;
            break;

        case "EyegazeRaw":
            streamCodec = EStreamCodec.EyegazeRaw;
            break;
        }
        string[] names = new string[] { "LeftRotation", "RightRotation" };
        for (int i = 0; i < 2; ++i)
        {
            rot = r.GetAttribute(names[i]).ToLower();
            switch (rot)
            {
            case "none":
                Rotation[i] = ECameraRotation.None;
                break;

            case "flipped":
                Rotation[i] = ECameraRotation.Flipped;
                break;

            case "cw":
                Rotation[i] = ECameraRotation.CW;
                break;

            case "ccw":
                Rotation[i] = ECameraRotation.CCW;
                break;
            }
        }

        //look for text Block
        while (r.Read())
        {
            if (r.NodeType == XmlNodeType.Text)
            {
                CamerConfigurationsStr = r.Value;
                break;
            }
        }
    }