ABBYY Cloud OCR SDK的名片识别接口

由于公司最近的软件项目设备选型是windows 8平板电脑,开发Windows app store上的Metro应用,该应用要实现客户名片识别的功能,即使用平板电脑上的摄像头给客户的名片拍照,应用能即时可识别该客户名片上的信息,并自动输入应用中,网上看了一大堆的资料,国内的开发商提供的接口服务费都太高了,动辄就要几十万。国外有个免费的,这个就是ABBYY Cloud OCR SDK,但ABBYY Cloud OCR SDK的名片识别接口没有js的接口。它只提供了C#语言和iPhone的例子。这样需要在服务器上用C#做一个转换的方法。由平板向服务器发送客户名片的照片,服务器再向ABBYY Cloud OCR SDK的名片识别接口发出识别请求,服务器接收到识别结果再向平板返回结果了。

 

C#的请求识别代码:

public void ProcessFile(string sourceFilePath, string outputFileBase, ProcessingSettings settings)
        {
            Console.WriteLine("Uploading to www.fenhon.com ...");
            Task task = restClient.ProcessImage(sourceFilePath, settings);

            TaskId taskId = task.Id;

            while (true)
            {
                task = restClient.GetTaskStatus(taskId);
                if (!Task.IsTaskActive(task.Status))
                    break;

                Console.WriteLine(String.Format("Task status: {0}", task.Status));
                System.Threading.Thread.Sleep(1000);
            }

            if (task.Status == TaskStatus.Completed)
            {
                Console.WriteLine("Processing completed.");
                for (int i = 0; i < settings.OutputFormats.Count; i++)
                {
                    var outputFormat = settings.OutputFormats[i];
                    string ext = settings.GetOutputFileExt(outputFormat);
                    restClient.DownloadUrl(task.DownloadUrls[i], outputFileBase + ext);
                }
                Console.WriteLine("Download completed.");
            }
            else if (task.Status == TaskStatus.NotEnoughCredits)
            {
                Console.WriteLine("Not enough credits to process the file. Please add more pages to your application balance.");
            }
            else
            {
                Console.WriteLine("Error while processing the task");
            }
        }

 

附:
1、 ocrsdk名片识别的接口:[POST] http(s)://cloud.ocrsdk.com/processBusinessCard

processBusinessCard Method
The method allows you to recognize a business card on an image. The method loads the image, creates a processing task for the image with the specified parameters, and passes the task for processing.

[POST] http(s)://cloud.ocrsdk.com/processBusinessCard
The image file is transmitted in the request body.

2、 C#语言的例子
http://ocrsdk.com/documentation/quick-start/cs/

3、 iPhone的例子
http://ocrsdk.com/documentation/quick-start/iphone-ocr-sdk/

转载于:https://www.cnblogs.com/jsjlhj/p/3346934.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值