Example #1
0
        async Task <string> SendPostRequest(Tb_Trans_Driver_Logs t)

        {
            // Remove this line

            //throw new NotImplementedException();


            // Create JObject instance as 'jsonObject', then Add( "key" , value);
            string url = "http://my-first-web-cutto.azurewebsites.net/api/DriverLogs";
            // string contentType = "application/json"; // or application/xml
            JObject jsonObject = new JObject();
            // Create JObject instance as 'jsonObject', then Add( "key" , value);


            string jsonObjectA = JsonConvert.SerializeObject(t);

            //wrap it around in object container notation
            //var  jSoNToPost = string.Concat("{", jsonObjectA, "}");
            //convert it to JSON acceptible content
            HttpContent content  = new StringContent(jsonObjectA, Encoding.UTF8, "application/json");
            var         client   = new HttpClient();
            var         response = await client.PostAsync(url, content);


            // Create StringContent object with json, Encoding.UTF8 format, and content type



            return(string.Empty);
        }
Example #2
0
        async private void ImageAnalyzer_FaceDetecyionCompleted(object sender, EventArgs e)
        {
            if (sender != null)

            {
                ImageAnalyzer imags = (ImageAnalyzer)sender;



                if (imags.DetectedFaces.Count() > 0)

                {
                    var face = imags.DetectedFaces.FirstOrDefault();

                    Tb_Trans_Driver_Logs logs = new Tb_Trans_Driver_Logs();
                    this.ProcessHeadPose(face);
                    this.ProcessMouth(face);
                    this.ProcessEyes(face);
                    SetTransDriverlog(logs, face);

                    await SendPostRequest(logs);
                }
            }
            return;
        }
Example #3
0
        public void SetTransDriverlog(Tb_Trans_Driver_Logs t, Microsoft.ProjectOxford.Face.Contract.Face f)
        {
            t.EyeAperture            = eyeAperture;
            t.EyeLeftBottom_X        = f.FaceLandmarks.EyeLeftBottom.X;
            t.EyeLeftBottom_Y        = f.FaceLandmarks.EyeLeftBottom.Y;
            t.EyeLeftInner_X         = f.FaceLandmarks.EyeLeftInner.X;
            t.EyeLeftInner_Y         = f.FaceLandmarks.EyeLeftInner.Y;
            t.EyeLeftOuter_X         = f.FaceLandmarks.EyeLeftOuter.X;
            t.EyeLeftOuter_Y         = f.FaceLandmarks.EyeLeftOuter.Y;
            t.EyeLeftTop_X           = f.FaceLandmarks.EyeLeftTop.X;
            t.EyeLeftTop_Y           = f.FaceLandmarks.EyeLeftTop.Y;
            t.EyeRightBottom_X       = f.FaceLandmarks.EyeRightBottom.X;
            t.EyeRightBottom_Y       = f.FaceLandmarks.EyeRightBottom.Y;
            t.EyeRightInner_X        = f.FaceLandmarks.EyeRightInner.X;
            t.EyeRightInner_Y        = f.FaceLandmarks.EyeRightInner.Y;
            t.EyeRightOuter_X        = f.FaceLandmarks.EyeRightOuter.X;
            t.EyeRightOuter_Y        = f.FaceLandmarks.EyeRightOuter.Y;
            t.EyeRightTop_X          = f.FaceLandmarks.EyeRightTop.X;
            t.EyeRightTop_Y          = f.FaceLandmarks.EyeRightTop.Y;
            t.HeadPost_Pitch         = f.FaceAttributes.HeadPose.Pitch;
            t.HeadPost_PoseDeviation = headPoseDeviation;
            t.HeadPost_Roll          = f.FaceAttributes.HeadPose.Roll;
            t.HeadPost_Yaw           = f.FaceAttributes.HeadPose.Yaw;
            t.MouthAperture          = mouthAperture;
            t.MouthLeft_X            = f.FaceLandmarks.MouthLeft.X;
            t.MouthLeft_Y            = f.FaceLandmarks.MouthLeft.Y;
            t.MouthRight_X           = f.FaceLandmarks.MouthRight.X;
            t.MouthRight_Y           = f.FaceLandmarks.MouthRight.Y;
            t.RefRegisterID          = 1;
            t.TransID          = 1;
            t.TimeStamp        = DateTime.Now;
            t.UnderLipBottom_X = f.FaceLandmarks.UnderLipBottom.X;
            t.UnderLipBottom_Y = f.FaceLandmarks.UnderLipBottom.Y;

            t.UnderLipTop_X    = f.FaceLandmarks.UnderLipTop.X;
            t.UnderLipTop_Y    = f.FaceLandmarks.UnderLipTop.Y;
            t.UpperLipBottom_X = f.FaceLandmarks.UpperLipBottom.X;
            t.UpperLipBottom_Y = f.FaceLandmarks.UpperLipBottom.Y;
            t.UpperLipTop_X    = f.FaceLandmarks.UpperLipTop.X;
            t.UpperLipTop_Y    = f.FaceLandmarks.UpperLipTop.Y;
        }