Exemplo n.º 1
0
 public static Task <(Dictionary <string, string>, Int32Rect)> TestBaiduAI(System.Drawing.Bitmap bitmap)
 {
     return(Task.Run(() => {
         string token = AccessToken.getAccessToken();
         string FaceJson = FaceDetect.faceDetect(token, bitmap);
         Dictionary <string, string> result;
         Int32Rect int32Rect;
         (result, int32Rect) = FaceParse.Parse(FaceJson);
         return (result, int32Rect);
     }));
 }
Exemplo n.º 2
0
        public static Task <Int32Rect> GetAIResult(Movie movie, string path)
        {
            return(Task.Run(() =>
            {
                System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(path);
                string token = AccessToken.getAccessToken();
                string FaceJson = FaceDetect.faceDetect(token, bitmap);

                Dictionary <string, string> result;
                Int32Rect int32Rect;
                (result, int32Rect) = FaceParse.Parse(FaceJson);
                if (result != null && int32Rect != Int32Rect.Empty)
                {
                    MySqlite dataBase = new MySqlite("AI");
                    dataBase.SaveBaiduAIByID(movie.id, result);
                    dataBase.CloseDB();
                    return int32Rect;
                }
                else
                {
                    return Int32Rect.Empty;
                }
            }));
        }