Esempio n. 1
0
        public dynamic Capture(string base64String)
        {
            List <dynamic> strList = new List <dynamic>();

            if (!string.IsNullOrEmpty(base64String))
            {
                var      imageParts = base64String.Split(',').ToList <string>();
                byte[]   imageBytes = Convert.FromBase64String(imageParts[1]);
                DateTime nm         = DateTime.Now;
                string   date       = nm.ToString("yyyymmddMMss");
                var      path       = Server.MapPath("~/CapturedPhotos/" + date + "CamCapture.jpg");

                var response = APIExtensionCore.MakeFaceAnalysisRequest(imageBytes);
                strList.Add(response);


                System.IO.File.WriteAllBytes(path, imageBytes);

                //Analyze will bring all features of VISION API.
                var anaylze = VisionCore.SmartProcessingImageShowResult(path, "analyze");
                strList.Add(anaylze);
                //If you want to call individual feature of VISION API below are methods
                var describe = VisionCore.SmartProcessingImageShowResult(path, "describe");
                strList.Add(describe);

                var tag = VisionCore.SmartProcessingImageShowResult(path, "tag");
                strList.Add(tag);


                ////Text Recognition TextPic/HandwrittenPic
                //TextExtraction(path, false, "TextPic");
                //TextExtraction(path, false, "HandwrittenPic");
                ////Identify closest value into text recognition
                ////TextClosestExtraction(path, false, true);
                return(Json(data: strList));
            }
            else
            {
                return(Json(data: false));
            }
        }
Esempio n. 2
0
        public dynamic FileUploadedPicAI(byte[] imageBytes)
        {
            List <dynamic> strList = new List <dynamic>();
            DateTime       nm      = DateTime.Now;
            string         date    = nm.ToString("yyyymmddMMss");
            var            path    = Server.MapPath("~/CapturedPhotos/" + date + "CamCapture.jpg");

            var response = APIExtensionCore.MakeFaceAnalysisRequest(imageBytes);

            strList.Add(response);

            //var visionResponse = APIExtensionCore.MakeVisionAnalysisRequest(imageBytes);
            //strList.Add(visionResponse);
            //var byteToConvertThumbnail = await MakeVisionThumbnailAnalysisRequest(imageBytes, 80, 80);


            System.IO.File.WriteAllBytes(path, imageBytes);

            //Analyze will bring all features of VISION API.
            var anaylze = VisionCore.SmartProcessingImageShowResult(path, "analyze");

            strList.Add(anaylze);

            //Text Recognition TextPic/HandwrittenPic
            //var textPic = VisionCore.TextExtraction(path, false, "TextPic");
            //strList.Add(textPic);
            ////Handwritten pics
            //var handwrittenPic = VisionCore.TextExtraction(path, false, "HandwrittenPic");
            //strList.Add(handwrittenPic);
            //Identify closest value into text recognition
            var textClosestExtraction = VisionCore.TextClosestExtraction(path, false, true);

            strList.Add(textClosestExtraction);

            return(Json(data: strList));
        }