private void ImageView_Click(object sender, EventArgs e)
        {
            try
            {
                var ImageBitmap = ((TakePictureActivity)Activity).getImageBitmap();

                using (var stream = new MemoryStream())
                {
                    ImageBitmap.Compress(Bitmap.CompressFormat.Jpeg, 0, stream);
                    bitmapData = stream.ToArray();
                }


                BasicHttpBinding binding = CreateBasicHttp();
                binding.Name                   = "basicHttpBinding";
                binding.MaxBufferSize          = int.MaxValue;
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.ReceiveTimeout         = TimeSpan.FromMinutes(10.0);
                binding.SendTimeout            = TimeSpan.FromMinutes(10.0);
                binding.CloseTimeout           = TimeSpan.FromMinutes(5.0);
                binding.OpenTimeout            = TimeSpan.FromMinutes(5.0);


                TravelersGuideCloudService = new TravelersGuideClient(binding, EndPoint);
                TravelersGuideCloudService.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);
                TravelersGuideCloudService.Open();

                TravelersGuideCloudService.GetImageTextCompleted += TravelersGuideCloudService_GetImageTextCompleted;
                TravelersGuideCloudService.GetImageTextAsync(bitmapData);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }
Exemple #2
0
        private void DetectText()
        {
            try
            {
                var filePath    = imageDetail[0].ImagePath + "/" + imageDetail[0].ImageName;
                var ImageBitmap = ImageHelper.GetImageBitmapFromFilePath(filePath, imageDetail[0].ImageWidth, imageDetail[0].ImageHeight);

                byte[] bitmapData;
                using (var stream = new MemoryStream())
                {
                    ImageBitmap.Compress(Bitmap.CompressFormat.Jpeg, 0, stream);
                    bitmapData = stream.ToArray();
                }


                BasicHttpBinding binding = CreateBasicHttp();
                binding.Name                   = "basicHttpBinding";
                binding.MaxBufferSize          = int.MaxValue;
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.ReceiveTimeout         = TimeSpan.FromMinutes(10.0);
                binding.SendTimeout            = TimeSpan.FromMinutes(10.0);
                binding.CloseTimeout           = TimeSpan.FromMinutes(5.0);
                binding.OpenTimeout            = TimeSpan.FromMinutes(5.0);


                var TravelersGuideCloudService = new TravelersGuideClient(binding, EndPoint);
                TravelersGuideCloudService.InnerChannel.OperationTimeout = TimeSpan.FromMinutes(10);
                TravelersGuideCloudService.Open();

                TravelersGuideCloudService.GetImageTextCompleted += TravelersGuideCloudService_GetImageTextCompleted;
                TravelersGuideCloudService.GetImageTextAsync(bitmapData);
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }