예제 #1
0
        public async Task <ImageInfoGet> Put([FromBody] object imageForServer)
        {
            Console.Out.WriteLine("Put");
            var des = JsonConvert.DeserializeObject <ImageInfoGet>(imageForServer.ToString());

            var tmp   = new ImageInfoGet();
            var image = dB.GetImage(des.Path, des.JpegCover);

            if (image == null)
            {
                ImageRecognizer imageRecognizer = new ImageRecognizer();

                var info = imageRecognizer.RecognizeImage(Convert.FromBase64String(des.JpegCover), des.Path);

                tmp.Class      = info.className[0];
                tmp.Confidence = info.confidence[0];

                tmp.Name      = des.Name;
                tmp.Path      = des.Path;
                tmp.JpegCover = des.JpegCover;

                dB.AddToDB(tmp);

                return(tmp);
            }
            return(image);
        }
예제 #2
0
            public void Run()
            {
                ByteBuffer buffer = mImage.GetPlanes()[0].Buffer;

                byte[] bytes = new byte[buffer.Remaining()];
                buffer.Get(bytes);
                Bitmap bitmapImage = BitmapFactory.DecodeByteArray(bytes, 0, bytes.Length, null);

                textRecognizer = new TextRecognizer.Builder(context).Build();
                imageRecognizer.RecognizeImage(bitmapImage, activity, owner);
            }