Exemplo n.º 1
0
        private AppResult CreatePersonFaceInfo(AppBody _appbody, HwsFaceCores.PersonInfo _faceDetectBody)
        {
            AppResult appResult = new AppResult();
            ApiResult apiResult = new ApiResult();

            try
            {
                apiResult.IsSuccessStatusCode = true;
                var model = PersonFaceInfoModel.New();
                model.PersonId                            = _faceDetectBody.PersonId;
                model.FaceConfidence                      = _faceDetectBody.FaceConfidence;
                model.FaceRectangle_Width                 = _faceDetectBody.FaceRectangle.Width;
                model.FaceRectangle_Height                = _faceDetectBody.FaceRectangle.Height;
                model.FaceRectangle_Left                  = _faceDetectBody.FaceRectangle.Left;
                model.FaceRectangle_Top                   = _faceDetectBody.FaceRectangle.Top;
                model.FaceLandmarks_PupilLeft_X           = _faceDetectBody.FaceLandmarks.PupilLeftX;
                model.FaceLandmarks_PupilLeft_Y           = _faceDetectBody.FaceLandmarks.PupilLeftY;
                model.FaceLandmarks_PupilRight_X          = _faceDetectBody.FaceLandmarks.PupilRightX;
                model.FaceLandmarks_PupilRight_Y          = _faceDetectBody.FaceLandmarks.PupilRightY;
                model.FaceLandmarks_NoseTip_X             = _faceDetectBody.FaceLandmarks.NoseTipX;
                model.FaceLandmarks_NoseTip_Y             = _faceDetectBody.FaceLandmarks.NoseTipY;
                model.FaceLandmarks_MouseLeft_X           = _faceDetectBody.FaceLandmarks.MouthLeftX;
                model.FaceLandmarks_MouseLeft_Y           = _faceDetectBody.FaceLandmarks.MouthLeftY;
                model.FaceLandmarks_MouseRight_X          = _faceDetectBody.FaceLandmarks.MouthRightX;
                model.FaceLandmarks_MouseRight_Y          = _faceDetectBody.FaceLandmarks.MouthRightY;
                model.FaceLandmarks_EyebrowLeftOuter_X    = _faceDetectBody.FaceLandmarks.EyebrowLeftOuterX;
                model.FaceLandmarks_EyebrowLeftOuter_Y    = _faceDetectBody.FaceLandmarks.EyebrowLeftOuterY;
                model.FaceLandmarks_EyebrowLeftInner_X    = _faceDetectBody.FaceLandmarks.EyebrowLeftInnerX;
                model.FaceLandmarks_EyebrowLeftInner_Y    = _faceDetectBody.FaceLandmarks.EyebrowLeftInnerY;
                model.FaceLandmarks_EyeLeftOuter_X        = _faceDetectBody.FaceLandmarks.EyeLeftOuterX;
                model.FaceLandmarks_EyeLeftOuter_Y        = _faceDetectBody.FaceLandmarks.EyeLeftOuterY;
                model.FaceLandmarks_EyeLeftTop_X          = _faceDetectBody.FaceLandmarks.EyeLeftTopX;
                model.FaceLandmarks_EyeLeftTop_Y          = _faceDetectBody.FaceLandmarks.EyeLeftTopY;
                model.FaceLandmarks_EyeLeftBottom_X       = _faceDetectBody.FaceLandmarks.EyeLeftBottomX;
                model.FaceLandmarks_EyeLeftBottom_Y       = _faceDetectBody.FaceLandmarks.EyeLeftBottomY;
                model.FaceLandmarks_EyeLeftInner_X        = _faceDetectBody.FaceLandmarks.EyeLeftInnerX;
                model.FaceLandmarks_EyeLeftInner_Y        = _faceDetectBody.FaceLandmarks.EyeLeftInnerY;
                model.FaceLandmarks_EyebrowRightInner_X   = _faceDetectBody.FaceLandmarks.EyebrowRightInnerX;
                model.FaceLandmarks_EyebrowRightInner_Y   = _faceDetectBody.FaceLandmarks.EyebrowRightInnerY;
                model.FaceLandmarks_EyebrowRightOuter_X   = _faceDetectBody.FaceLandmarks.EyebrowRightOuterX;
                model.FaceLandmarks_EyebrowRightOuter_Y   = _faceDetectBody.FaceLandmarks.EyebrowRightOuterY;
                model.FaceLandmarks_EyeRightInner_X       = _faceDetectBody.FaceLandmarks.EyeRightInnerX;
                model.FaceLandmarks_EyeRightInner_Y       = _faceDetectBody.FaceLandmarks.EyeRightInnerY;
                model.FaceLandmarks_EyeRightTop_X         = _faceDetectBody.FaceLandmarks.EyeRightTopX;
                model.FaceLandmarks_EyeRightTop_Y         = _faceDetectBody.FaceLandmarks.EyeRightTopY;
                model.FaceLandmarks_EyeRightBottom_X      = _faceDetectBody.FaceLandmarks.EyeRightBottomX;
                model.FaceLandmarks_EyeRightBottom_Y      = _faceDetectBody.FaceLandmarks.EyeRightBottomY;
                model.FaceLandmarks_EyeRightOuter_X       = _faceDetectBody.FaceLandmarks.EyeRightOuterX;
                model.FaceLandmarks_EyeRightOuter_Y       = _faceDetectBody.FaceLandmarks.EyeRightOuterY;
                model.FaceLandmarks_NoseRootLeft_X        = _faceDetectBody.FaceLandmarks.NoseRootLeftX;
                model.FaceLandmarks_NoseRootLeft_Y        = _faceDetectBody.FaceLandmarks.NoseRootLeftY;
                model.FaceLandmarks_NoseRootRight_X       = _faceDetectBody.FaceLandmarks.NoseRootRightX;
                model.FaceLandmarks_NoseRootRight_Y       = _faceDetectBody.FaceLandmarks.NoseRootRightY;
                model.FaceLandmarks_NoseLeftAlarTop_X     = _faceDetectBody.FaceLandmarks.NoseLeftAlarTopX;
                model.FaceLandmarks_NoseLeftAlarTop_Y     = _faceDetectBody.FaceLandmarks.NoseLeftAlarTopY;
                model.FaceLandmarks_NoseRightAlarTop_X    = _faceDetectBody.FaceLandmarks.NoseRightAlarTopX;
                model.FaceLandmarks_NoseRightAlarTop_Y    = _faceDetectBody.FaceLandmarks.NoseRightAlarTopY;
                model.FaceLandmarks_NoseLeftAlarOutTip_X  = _faceDetectBody.FaceLandmarks.NoseLeftAlarOutTipX;
                model.FaceLandmarks_NoseLeftAlarOutTip_Y  = _faceDetectBody.FaceLandmarks.NoseLeftAlarOutTipY;
                model.FaceLandmarks_NoseRightAlarOutTip_X = _faceDetectBody.FaceLandmarks.NoseRightAlarOutTipX;
                model.FaceLandmarks_NoseRightAlarOutTip_Y = _faceDetectBody.FaceLandmarks.NoseRightAlarOutTipY;
                model.FaceLandmarks_UpperLipTop_X         = _faceDetectBody.FaceLandmarks.UpperLipTopX;
                model.FaceLandmarks_UpperLipTop_Y         = _faceDetectBody.FaceLandmarks.UpperLipTopY;
                model.FaceLandmarks_UpperLipBottom_X      = _faceDetectBody.FaceLandmarks.UpperLipBottomX;
                model.FaceLandmarks_UpperLipBottom_Y      = _faceDetectBody.FaceLandmarks.UpperLipBottomY;
                model.FaceLandmarks_UnderLipTop_X         = _faceDetectBody.FaceLandmarks.UnderLipTopX;
                model.FaceLandmarks_UnderLipTop_Y         = _faceDetectBody.FaceLandmarks.UnderLipTopY;
                model.FaceLandmarks_UnderLipBottom_X      = _faceDetectBody.FaceLandmarks.UnderLipBottomX;
                model.FaceLandmarks_UnderLipBottom_Y      = _faceDetectBody.FaceLandmarks.UnderLipBottomY;
                model.FaceAttributes_Age                  = _faceDetectBody.FaceAttributes.Age;
                model.FaceAttributes_Gender               = _faceDetectBody.FaceAttributes.Gender;
                model.FaceAttributes_Smile                = _faceDetectBody.FaceAttributes.Smile;
                model.FaceAttributes_FacialHair_Moustache = _faceDetectBody.FaceAttributes.FacialHair.Moustache;
                model.FaceAttributes_FacialHair_Beard     = _faceDetectBody.FaceAttributes.FacialHair.Beard;
                model.FaceAttributes_FacialHair_Sideburns = _faceDetectBody.FaceAttributes.FacialHair.Sideburns;
                model.FaceAttributes_Glasses              = _faceDetectBody.FaceAttributes.Glasses;
                model.FaceAttributes_HeadPose_Roll        = _faceDetectBody.FaceAttributes.HeadPose.Roll;
                model.FaceAttributes_HeadPose_Yaw         = _faceDetectBody.FaceAttributes.HeadPose.Yaw;
                model.FaceAttributes_HeadPose_Pitch       = _faceDetectBody.FaceAttributes.HeadPose.Pitch;

                model.Save();
            }
            catch (Exception ex)
            {
                apiResult.IsSuccessStatusCode = false;
                apiResult.Message             = ex.Message;
            }
            appResult.apiResult = apiResult;
            appResult.appBody   = _appbody;

            return(appResult);
        }