/// <summary> /// Show the result of face /// </summary> /// <param name="result"></param> protected override void OnPostExecute(string result) { pd.Dismiss(); if (result != null) { var faces = JsonConvert.DeserializeObject<List<FaceModel>>(result); if (faces.Count >= 1) { var bitmap = FaceFunction.DrawRectanglesOnBitmap(cognitiveActivity.mBitmap, faces); FaceFunction.setImageOutput(faces, cognitiveActivity); cognitiveActivity.imageView.SetImageBitmap(bitmap); //감정 인식 스레드 실행 new EmotionTask(cognitiveActivity).Execute(cognitiveActivity.inputStream1); //Emotion Task 시작점 } else { //상황 인식 스레드 실행 new VisionTask(cognitiveActivity).Execute(cognitiveActivity.inputStream3); //Vision Task 시작점 } } else { //상황 인식 스레드 실행 new VisionTask(cognitiveActivity).Execute(cognitiveActivity.inputStream3); //Vision Task 시작점 } }
/// <summary> /// Show the result of face /// </summary> /// <param name="result"></param> protected override void OnPostExecute(string result) { if (result != null) { var faces = JsonConvert.DeserializeObject <List <FaceModel> >(result); if (faces != null) { var bitmap = FaceFunction.DrawRectanglesOnBitmap(cognitiveActivity.mBitmap, faces); FaceFunction.setImageOutput(faces, cognitiveActivity); cognitiveActivity.imageView.SetImageBitmap(bitmap); pd.Dismiss(); new EmotionTask(cognitiveActivity).Execute(cognitiveActivity.inputStream1); //Emotion Task 시작점 } else { cognitiveActivity.tvText.Text = "얼굴을 인식할 수 없습니다."; } } else { cognitiveActivity.tvText.Text = "얼굴을 인식할 수 없습니다."; } }
/// <summary> /// Execute the input function in each face /// </summary> /// <param name="func"></param> public void FunctionExec( FaceFunction func ) { // execute in each face the function FaceTreeExec(FaceRoot, func); }
private void FaceTreeExec(FaceDistTreeNode faceNode, FaceFunction func) { // check if we are in leaf if (faceNode.isLeaf) { // pass all the faces foreach (Face fa in faceNode.FaceList) { func(fa); } } else { FaceTreeExec(faceNode.DownLeft, func); FaceTreeExec(faceNode.UpLeft, func); FaceTreeExec(faceNode.DownRight, func); FaceTreeExec(faceNode.UpRight, func); } }
/// <summary> /// Execute the input function in each face /// </summary> /// <param name="func"></param> public void FunctionExec( FaceFunction func ) { // execute in each face the function foreach ( Face fe in FaceList ) func( fe ); }
/// <summary> /// Execute the input function in each face /// </summary> /// <param name="func"></param> public void FaceFunctionExec(FaceFunction func) { // pass the function to the higher level faceTree.FunctionExec(func); }