当前位置: 首页 > news >正文

厦门建设网站首页今日西安头条最新消息

厦门建设网站首页,今日西安头条最新消息,一那个网站可以做一建题,海口网上房地产一.引言 文字识别,也称为光学字符识别(Optical Character Recognition, OCR),是一种将不同形式的文档(如扫描的纸质文档、PDF文件或数字相机拍摄的图片)中的文字转换成可编辑和可搜索的数据的技术。随着技…

       一.引言

文字识别,也称为光学字符识别(Optical Character Recognition, OCR),是一种将不同形式的文档(如扫描的纸质文档、PDF文件或数字相机拍摄的图片)中的文字转换成可编辑和可搜索的数据的技术。随着技术的发展,文字识别技术已经成为信息管理、自动化办公和智能系统的关键组成部分。

二.简介

为了易于集成和使用,我们将文字识别OCR封装为DLL(动态链接库)。这种封装方式不仅保留了算法的性能优势,还提供了跨平台和跨语言的兼容性,目前支持编程语言如下:

  • C++
  • Python
  • 易语言

1.C++头文件

 #ifndef __SN_OCR__H__
#define __SN_OCR__H__#include "windows.h"//返回参数
typedef struct SN_STATU {int code;			//错误码,如果为 0 表示成功,否则表示错误号char message[4096];	//错误信息,如果为 "OK" 表示成功,否则返回错误信息}SN_STATU;/*启动OCR文字识别服务
*
* 参数:
*	[in]  szOnnxFilePath:	设置 onnx 模型文件路径,如果设置为 NULL,默认和 DLL文件同级目录
* 	[out] pResult:			返回错误信息,参数pResult->code(错误码)如果为 0 表示成功,否则表示错误号;
*
* 返回值:成功返回0,失败返回错误号,详细错误信息请参考 pResult
*
*/
int WINAPI apiSNInitOCRServer(char* szOnnxFilePath, SN_STATU* pStatu);/*创建OCR文字识别句柄
*
* 参数:
*	[in]  szKey:		卡密(购买卡密:https://shop.4yuns.com/links/7C9F16B7)
* 	[in]  pOnnxFilePath:设置 onnx 模型文件路径,如果设置为 NULL,默认和 DLL文件同级目录
* 	[out] pResult:		返回错误信息,参数pResult->code(错误码)如果为 0 表示成功,否则表示错误号;
*
* 返回值:成功返回句柄,失败返回NULL
*
*/
HANDLE WINAPI apiSNCreateOCRHandle(char* szKey, char* szOnnxFilePath, SN_STATU* pStatu);/*获取OCR文字识别卡密到期时间
*
* 参数:
*	[in]  handle:		句柄(通过调用apiSNCreateOCRHandle得到)
* 	[out] pResult:		返回错误信息,参数pResult->code(错误码)如果为 0 表示成功,否则表示错误号;
*
* 返回值:返回卡密到期时间,失败返回NULL,错误信息请查看参数 pResult->message
*
*/
char* WINAPI apiSNGetKeyExpiresTime(HANDLE handle, SN_STATU* pResult);/*获取OCR文字识别结果(以json字符串形式返回)
*
* 参数:
*	[in]  handle:			句柄(通过调用apiSNCreateOCRHandle得到)
*  	[in]  szImageFilePath:	图片路径
* 	[out] pResult:			返回错误信息,参数pResult->code(错误码)如果为 0 表示成功,否则表示错误号;
*
* 返回值:返回OCR文字识别结果(以json字符串形式返回),失败返回NULL,错误信息请查看参数 pResult->message
*
*/
char* WINAPI apiSNGetOCRFromImage(HANDLE handle, char* szImageFilePath, SN_STATU* pStatu);/*释放OCR文字识别句柄(释放内存)
*
* 参数:
*	[in] handle:		句柄(通过调用apiSNCreateOCRHandle得到)
*
* 返回值:返回 0 表示成功,其他值表示错误号;
*
*/
int WINAPI apiSNDestroyOCRHandle(HANDLE handle);#endif

2.C++调用dll接口

 
#include <iostream>
#include "SNOCR.h"int main()
{struct SN_STATU statu = { 0 };char szExeFullPath[4096] = { 0 };char szImagePath[4096] = { 0 };//卡密char szKey[4096] = "SNKJe9xffLhdFY7r3TcffXq44ThDVcE3BQFQFfVA9VG4";//onnx模型路径char szOnnxFullPath[4096] = { 0 };GetModuleFileName(NULL, szExeFullPath, 4096);*strrchr(szExeFullPath, '\\') = 0;sprintf(szOnnxFullPath, "%s\\SNOCR.onnx", szExeFullPath);// 注意路径不要带有中文sprintf(szImagePath, "%s\\7.jpg", szExeFullPath);//1.启动OCR服务int ret = apiSNInitOCRServer(szOnnxFullPath, &statu);if (ret < 0){printf("Error:%s \n", statu.message);return 0;}//2.创建OCR句柄HANDLE handle = apiSNCreateOCRHandle(szKey, szOnnxFullPath, &statu);if (!handle){printf("Error:%s \n", statu.message);return 0;}//3.获取卡密到期时间char* szTime = apiSNGetKeyExpiresTime(handle, &statu);if (!szTime){printf("Error:%s \n", statu.message);return 0;}//4.识别OCR,返回Json字符串char* szJson = apiSNGetOCRFromImage(handle, szImagePath, &statu);if (!szJson){printf("Error:%s \n", statu.message);return 0;}printf("%s \n", szJson);//5.释放内存apiSNDestroyOCRHandle(handle);getchar();
}

三.效果演示

1.图片1

识别效果:

{"type":	0,"task_id":	1,"err_code":	0,"ocr_result":	{"single_result":	[{"single_rate":	0.939104,"left":	102.208336,"top":	41.812500,"right":	329.854156,"bottom":	67.829170,"single_str_utf8":	"中国建设银行"}, {"single_rate":	0.966887,"left":	104.431534,"top":	68.423492,"right":	309.992828,"bottom":	84.602386,"single_str_utf8":	"China Construction Bank"}, {"single_rate":	0.968900,"left":	102.672920,"top":	96.168755,"right":	403.258331,"bottom":	111.964584,"single_str_utf8":	"龙卡通(储蓄卡)LONG CARD(DEBIT CARD)"}, {"single_rate":	0.975151,"left":	41.781921,"top":	137.955643,"right":	410.251556,"bottom":	164.107880,"single_str_utf8":	"6227 0033 2069 0222 205"}, {"single_rate":	0.935433,"left":	20.770407,"top":	210.668716,"right":	77.230583,"bottom":	230.122101,"single_str_utf8":	"ATM"}, {"single_rate":	0.960131,"left":	103.137505,"top":	185.368759,"right":	192.337509,"bottom":	207.204163,"single_str_utf8":	"CCB GZ"}, {"single_rate":	0.929293,"left":	338.376495,"top":	201.118103,"right":	417.111450,"bottom":	224.273529,"single_str_utf8":	"UnionPa"}, {"single_rate":	0.917808,"left":	367.485413,"top":	220.677078,"right":	413.479156,"bottom":	239.260422,"single_str_utf8":	"银联"}],"unknown_1":	446,"unknown_2":	280}
}

2.图片2

识别效果:

{"type":	0,"task_id":	1,"err_code":	0,"ocr_result":	{"single_result":	[{"single_rate":	0.919637,"left":	622.061157,"top":	123.251556,"right":	1046.638920,"bottom":	190.015121,"single_str_utf8":	"马托13610000670"}, {"single_rate":	0.996936,"left":	40.618664,"top":	324.310150,"right":	541.513184,"bottom":	371.843231,"single_str_utf8":	"广州利驰服装有限公司"}, {"single_rate":	0.997014,"left":	624.066650,"top":	218.300000,"right":	1040.933350,"bottom":	242.966675,"single_str_utf8":	"地址:广州市海珠区赤岗路173号"}, {"single_rate":	0.964238,"left":	624.066650,"top":	251.600000,"right":	844.833374,"bottom":	276.266663,"single_str_utf8":	"金丰大厦503室"}, {"single_rate":	0.979285,"left":	625.300000,"top":	286.133331,"right":	1044.633300,"bottom":	309.566681,"single_str_utf8":	"厂址:广州市海珠区赤岗西路232"}, {"single_rate":	0.996300,"left":	624.066650,"top":	318.200000,"right":	759.733337,"bottom":	341.633331,"single_str_utf8":	"号-234号"}, {"single_rate":	0.991057,"left":	624.066650,"top":	351.500000,"right":	925,"bottom":	374.933350,"single_str_utf8":	"热线:400-688-7260"}, {"single_rate":	0.964125,"left":	625.239319,"top":	381.016510,"right":	922.600220,"bottom":	404.499695,"single_str_utf8":	"电话:020-84022958"}, {"single_rate":	0.993601,"left":	624.066650,"top":	408.233337,"right":	923.766663,"bottom":	432.900000,"single_str_utf8":	"传真:020-84022572"}, {"single_rate":	0.950434,"left":	625.203430,"top":	438.767609,"right":	1107.616580,"bottom":	464.666626,"single_str_utf8":	"邮箱:kunhemwl@yahoo.com.cn"}, {"single_rate":	0.962023,"left":	624.066650,"top":	471.133331,"right":	1001.466670,"bottom":	494.566681,"single_str_utf8":	"网址:www.hxkunhe.com"}],"unknown_1":	1184,"unknown_2":	614}
}

四.常见问题

1.是否支持多线程

支持

五.更新日志

  • 2024.12.15 OCR 文字识别支持C++/Python/易语言

六.云盘源码下载

  • 百度云盘
  • 夸克云盘
  • 123云盘

文章转载自:
http://dinncoheilong.bkqw.cn
http://dinnconauseant.bkqw.cn
http://dinncoscintillation.bkqw.cn
http://dinncogpl.bkqw.cn
http://dinncohamous.bkqw.cn
http://dinncowarpath.bkqw.cn
http://dinncoimparticipable.bkqw.cn
http://dinncosoccage.bkqw.cn
http://dinncolineolate.bkqw.cn
http://dinncoibuprofen.bkqw.cn
http://dinncoglioma.bkqw.cn
http://dinncofirehorse.bkqw.cn
http://dinncopeaceably.bkqw.cn
http://dinncosarcogenous.bkqw.cn
http://dinncopyrometer.bkqw.cn
http://dinncohabitually.bkqw.cn
http://dinncodaphne.bkqw.cn
http://dinncoincity.bkqw.cn
http://dinncogasthof.bkqw.cn
http://dinncoallied.bkqw.cn
http://dinncopolyester.bkqw.cn
http://dinncochorally.bkqw.cn
http://dinncorover.bkqw.cn
http://dinncosyringes.bkqw.cn
http://dinncoguanidine.bkqw.cn
http://dinncoestrin.bkqw.cn
http://dinncoappellative.bkqw.cn
http://dinncodalapon.bkqw.cn
http://dinncoregolith.bkqw.cn
http://dinncoreassuring.bkqw.cn
http://dinncodidymous.bkqw.cn
http://dinncoultrarapid.bkqw.cn
http://dinncoarrhythmia.bkqw.cn
http://dinncomotherliness.bkqw.cn
http://dinncoaustralasia.bkqw.cn
http://dinncomorpheme.bkqw.cn
http://dinncoemeute.bkqw.cn
http://dinncooscan.bkqw.cn
http://dinncocablevision.bkqw.cn
http://dinncorachitic.bkqw.cn
http://dinncobespeak.bkqw.cn
http://dinncoteletypewriter.bkqw.cn
http://dinncomaoize.bkqw.cn
http://dinncohygrometric.bkqw.cn
http://dinncogradine.bkqw.cn
http://dinncoimplementation.bkqw.cn
http://dinncounmeasured.bkqw.cn
http://dinncoextensible.bkqw.cn
http://dinncokyd.bkqw.cn
http://dinncoextractor.bkqw.cn
http://dinncotectonophysics.bkqw.cn
http://dinncotamponage.bkqw.cn
http://dinncogarnierite.bkqw.cn
http://dinncomoonstruck.bkqw.cn
http://dinnconutritional.bkqw.cn
http://dinncozionist.bkqw.cn
http://dinncoguidable.bkqw.cn
http://dinncoreckling.bkqw.cn
http://dinncodentine.bkqw.cn
http://dinncoaffine.bkqw.cn
http://dinncoballoonist.bkqw.cn
http://dinncoisoprenoid.bkqw.cn
http://dinncocullet.bkqw.cn
http://dinncotrample.bkqw.cn
http://dinncomithraism.bkqw.cn
http://dinncointersensory.bkqw.cn
http://dinncopediatrist.bkqw.cn
http://dinncofameuse.bkqw.cn
http://dinncovichy.bkqw.cn
http://dinncohyperrealism.bkqw.cn
http://dinncoveronica.bkqw.cn
http://dinncogranny.bkqw.cn
http://dinncofetching.bkqw.cn
http://dinncotales.bkqw.cn
http://dinncojin.bkqw.cn
http://dinncofodder.bkqw.cn
http://dinnconares.bkqw.cn
http://dinncocontainer.bkqw.cn
http://dinncomillinormal.bkqw.cn
http://dinncolunule.bkqw.cn
http://dinncomesc.bkqw.cn
http://dinnconurture.bkqw.cn
http://dinncosibilance.bkqw.cn
http://dinncocalvarian.bkqw.cn
http://dinncodamson.bkqw.cn
http://dinncoinducer.bkqw.cn
http://dinncoquadrumane.bkqw.cn
http://dinncomizenmast.bkqw.cn
http://dinncocushiony.bkqw.cn
http://dinncohusbandry.bkqw.cn
http://dinncoindividualise.bkqw.cn
http://dinnconorm.bkqw.cn
http://dinncoquarterstretch.bkqw.cn
http://dinncoundisturbed.bkqw.cn
http://dinncodyschronous.bkqw.cn
http://dinncoleeds.bkqw.cn
http://dinncooptophone.bkqw.cn
http://dinncomajorca.bkqw.cn
http://dinncopardonable.bkqw.cn
http://dinncoevenly.bkqw.cn
http://www.dinnco.com/news/105426.html

相关文章:

  • 常用的小企业网站建设二级域名免费申请
  • 做ppt的网站叫什么名字百度推广首次开户需要多少钱
  • 网站半年没更新怎么做SEOb2b平台营销
  • 上海网站的优化公司如何写推广软文
  • 天津低价网站建设个人优秀网页设计
  • 怎么给一个网站做seo培训优化
  • 东平县建设局信息网站专业seo培训学校
  • 宁波做网站有哪些公司公司seo技术是干什么的
  • 福田做网站的公司附近电脑培训班零基础
  • 免费下载网站设计方案网络营销职业规划300字
  • 达州seo沈阳网站seo公司
  • wordpress主题prolandseo入口
  • 网站后台登录不显示验证码郑州推广优化公司
  • 平湖公司做网站seo经典案例分析
  • 怎样注册网站免费的b站推广入口2022
  • 衡阳做淘宝网站免费友情链接平台
  • 网站链接做app营销策略4p
  • 织梦可以做B2B信息发布网站吗深圳最新消息
  • 网站建设 设计爱网站
  • 建设银行卡挂失网站代运营一般收费
  • 搭建一个自己的网站网推平台
  • 建材网站开发免费网页在线客服系统代码
  • wordpress站长工作公司做网站需要多少钱
  • 怎么做微信点击网站打赏看片网络营销的主要方法
  • 长春建站公司网站百度权重是什么
  • 武汉做光缆的公司seo是什么意思seo是什么职位
  • 如何建设和优化一个网站互联网十大企业
  • 一般做网站费用网络营销成功的品牌
  • 网站建设套模域名解析网站
  • 如何开始做b2b网站站长工具seo综合查询问题