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

黄山找人做网站下载百度到桌面上

黄山找人做网站,下载百度到桌面上,银川做网站推广,太平洋网站建设百度OCR身份证识别C离线SDKV3.0 C#对接 目录 说明 效果 问题 项目 代码 下载 说明 自己根据SDK封装了动态库,然后C#调用。 SDK 简介 本 SDK 适应于于 Windows 平台下的⾝份证识别系统,⽀持 C接⼜开发的 SDK,开发者可在VS2015 下⾯进⾏开发(推荐…

 百度OCR身份证识别C++离线SDKV3.0 C#对接

目录

说明

效果

问题 

项目

代码

下载


说明

自己根据SDK封装了动态库,然后C#调用。

SDK 简介

        本 SDK 适应于于 Windows 平台下的⾝份证识别系统,⽀持 C++接⼜开发的 SDK,开发者可在VS2015 下⾯进⾏开发(推荐使⽤,不保证其他版本 VS 都兼容)。SDK 采⽤ C++的动态库 DLL 的⽅式,另外随 SDK 附带⼀个鉴权激活⼯具(LicenseTool.exe,在license_tool ⽬录),通过该激活⼯具可⽣成正常接 ⼊SDK 的激活 license ⽂件 license.zip(解压后可⽣成两个⽂件 license.ini 和license.key)达到通过鉴权, 正常使⽤SDK 的⽬的。

激活工具授权

        鉴权采⽤ SDK 附带的鉴权⼯具 LicenseTool.exe、双击打开 exe 后,输⼊申请获取到的授权序列号,执⾏按钮激活后会⽣成⼀个 license.zip ⽂件,把这个⽂件解压后会⽣成 license.ini 和 license.key两个⽂件,把这 2 个⽂件放置到 SDK 的 license ⽂件夹,即可通过授权激活。另外⽀持鉴权⽂件路径定制化及模型⽂件路径定制化,可参考 SDK 示例(鉴权⽂件 license.key 和 license.ini 的路径可参考SDK 代码示例,也可以⽤ SDK 现成的默认路径)。鉴权⼯具 LicenseTool.exe 如下所示,在⼯具中输⼊申请得到的 license 系列号即可⽣成鉴权 zip ⽂件。解压 zip 后可⽣成 license.ini 和 license.key 两个⽂件。

SDK包结构

效果

问题 

返回的坐标位置有问题,猜测可能是内部缩放了图片导致,后续等官方修复。

项目

代码

using Newtonsoft.Json;
using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using WinFormTest.Common;namespace WinFormTest
{public partial class Form1 : Form{public Form1(){InitializeComponent();}IntPtr IDCard;int res = -1;private void Form1_Load(object sender, EventArgs e){IDCard = Native.create();string key = "";string licenseKeyPath = Application.StartupPath + "\\license\\license.key";string licenseFile = Application.StartupPath + "\\license\\license.ini";key = File.ReadAllText(licenseKeyPath);res = Native.auth_from_file(IDCard, key, licenseFile, false);string model_folder = Application.StartupPath + "\\resource";res = Native.sdk_init(IDCard, model_folder);image_path = Application.StartupPath + "\\idcard_.jpg";pictureBox1.Image = new Bitmap(image_path);}private void button1_Click(object sender, EventArgs e){if (image_path == ""){return;}textBox1.Text = "";Application.DoEvents();Mat image = new Mat(image_path);StringBuilder ocr_result1 = new StringBuilder(1024);StringBuilder ocr_result2 = new StringBuilder(2048);Stopwatch stopwatch = new Stopwatch();stopwatch.Start();res = Native.ocr2(IDCard, image.CvPtr, ocr_result1, ocr_result2);string s = ocr_result1.ToString();string s2 = ocr_result2.ToString();stopwatch.Stop();double totalTime = stopwatch.Elapsed.TotalSeconds;textBox1.Text += $"耗时: {totalTime:F2}s";textBox1.Text += "\r\n-------------------\r\n";if (res == 0){Object jsonObject = JsonConvert.DeserializeObject(ocr_result1.ToString());textBox1.Text += JsonConvert.SerializeObject(jsonObject, Newtonsoft.Json.Formatting.Indented);textBox1.Text += "\r\n-------------------\r\n";Object jsonObject2 = JsonConvert.DeserializeObject(ocr_result2.ToString());textBox1.Text += JsonConvert.SerializeObject(jsonObject2, Newtonsoft.Json.Formatting.Indented);IDCardRes iDCardResponse = JsonConvert.DeserializeObject<IDCardRes>(ocr_result1.ToString());IDCardCoordRes iDCardCoordResponse = JsonConvert.DeserializeObject<IDCardCoordRes>(ocr_result2.ToString());//if (iDCardResponse.name == "") iDCardCoordResponse.name_coord = "";//if (iDCardResponse.gender == "") iDCardCoordResponse.gender_coord = "";//if (iDCardResponse.ethnicity == "") iDCardCoordResponse.ethnicity_coord = "";//if (iDCardResponse.birth == "") iDCardCoordResponse.birth_coord = "";//if (iDCardResponse.address == "") iDCardCoordResponse.address_coord = "";//if (iDCardResponse.id_number == "") iDCardCoordResponse.id_number_coord = "";//if (iDCardResponse.authority == "") iDCardCoordResponse.authority_coord = "";//if (iDCardResponse.issuing_date == "") iDCardCoordResponse.issuing_date_coord = "";//if (iDCardResponse.expiry_date == "") iDCardCoordResponse.expiry_date_coord = "";if (iDCardResponse.name != ""){DrawRes(image, iDCardCoordResponse.name_coord);}if (iDCardResponse.gender != ""){DrawRes(image, iDCardCoordResponse.gender_coord);}if (iDCardResponse.ethnicity != ""){DrawRes(image, iDCardCoordResponse.ethnicity_coord);}if (iDCardResponse.birth != ""){DrawRes(image, iDCardCoordResponse.birth_coord);}if (iDCardResponse.address != ""){DrawRes(image, iDCardCoordResponse.address_coord);}if (iDCardResponse.id_number != ""){DrawRes(image, iDCardCoordResponse.id_number_coord);}if (iDCardResponse.authority != ""){DrawRes(image, iDCardCoordResponse.authority_coord);}if (iDCardResponse.issuing_date != ""){DrawRes(image, iDCardCoordResponse.issuing_date_coord);}if (iDCardResponse.expiry_date != ""){DrawRes(image, iDCardCoordResponse.expiry_date_coord);}if (pictureBox1.Image != null){pictureBox1.Image.Dispose();pictureBox1.Image = null;}pictureBox1.Image = new Bitmap(image.ToMemoryStream());image.Dispose();}else{textBox1.Text = "识别失败";}}void DrawRes(Mat res_image, string ptsStr){string[] pts = ptsStr.Split(' ');//多边形的顶点OpenCvSharp.Point[] points = new OpenCvSharp.Point[]{new OpenCvSharp.Point(Convert.ToDouble( pts[0]), Convert.ToDouble( pts[1])),new OpenCvSharp.Point(Convert.ToDouble( pts[2]), Convert.ToDouble( pts[3])),new OpenCvSharp.Point(Convert.ToDouble( pts[4]), Convert.ToDouble( pts[5])),new OpenCvSharp.Point(Convert.ToDouble( pts[6]), Convert.ToDouble( pts[7])),};// 绘制多边形Cv2.Polylines(res_image, new OpenCvSharp.Point[][] { points }, isClosed: true, color: new Scalar(0, 255, 0), thickness: 3);}void DrawRes2(Mat res_image, float[] pts){//多边形的顶点OpenCvSharp.Point[] points = new OpenCvSharp.Point[]{new OpenCvSharp.Point(pts[0], pts[1]),new OpenCvSharp.Point(pts[2], pts[3]),new OpenCvSharp.Point(pts[4], pts[5]),new OpenCvSharp.Point(pts[6], pts[7]),};// 绘制多边形Cv2.Polylines(res_image, new OpenCvSharp.Point[][] { points }, isClosed: true, color: new Scalar(0, 255, 0), thickness: 3);}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";private void button2_Click(object sender, EventArgs e){OpenFileDialog ofd = new OpenFileDialog();ofd.Filter = fileFilter;if (ofd.ShowDialog() != DialogResult.OK) return;pictureBox1.Image = null;image_path = ofd.FileName;pictureBox1.Image = new Bitmap(image_path);textBox1.Text = "";}private void button3_Click(object sender, EventArgs e){if (image_path == ""){return;}textBox1.Text = "";Application.DoEvents();Mat image = new Mat(image_path);IDCardResponse final_result = new IDCardResponse();Stopwatch stopwatch = new Stopwatch();stopwatch.Start();res = Native.ocr(IDCard, image.CvPtr, ref final_result);stopwatch.Stop();double totalTime = stopwatch.Elapsed.TotalSeconds;textBox1.Text += $"耗时: {totalTime:F2}s";textBox1.Text += "\r\n-------------------\r\n";IDCardRes iDCardResponse = new IDCardRes();iDCardResponse.name = Encoding.UTF8.GetString(final_result.name).Replace("\u0000", "");iDCardResponse.gender = Encoding.UTF8.GetString(final_result.gender).Replace("\u0000", "");iDCardResponse.ethnicity = Encoding.UTF8.GetString(final_result.ethnicity).Replace("\u0000", "");iDCardResponse.birth = Encoding.UTF8.GetString(final_result.birth).Replace("\u0000", "");iDCardResponse.address = Encoding.UTF8.GetString(final_result.address).Replace("\u0000", "");iDCardResponse.id_number = Encoding.UTF8.GetString(final_result.id_number).Replace("\u0000", "");iDCardResponse.authority = Encoding.UTF8.GetString(final_result.authority).Replace("\u0000", "");iDCardResponse.issuing_date = Encoding.UTF8.GetString(final_result.issuing_date).Replace("\u0000", "");iDCardResponse.expiry_date = Encoding.UTF8.GetString(final_result.expiry_date).Replace("\u0000", "");textBox1.Text += JsonConvert.SerializeObject(iDCardResponse, Newtonsoft.Json.Formatting.Indented);textBox1.Text += "\r\n-------------------\r\n";IDCardCoordRes2 iDCardCoordRes2 = new IDCardCoordRes2();iDCardCoordRes2.name_coord = final_result.name_coord;iDCardCoordRes2.gender_coord = final_result.gender_coord;iDCardCoordRes2.birth_coord = final_result.birth_coord;iDCardCoordRes2.address_coord = final_result.address_coord;iDCardCoordRes2.id_number_coord = final_result.id_number_coord;iDCardCoordRes2.ethnicity_coord = final_result.ethnicity_coord;iDCardCoordRes2.authority_coord = final_result.authority_coord;iDCardCoordRes2.issuing_date_coord = final_result.issuing_date_coord;iDCardCoordRes2.expiry_date_coord = final_result.expiry_date_coord;textBox1.Text += JsonConvert.SerializeObject(iDCardCoordRes2, Newtonsoft.Json.Formatting.Indented);DrawRes2(image, iDCardCoordRes2.name_coord);DrawRes2(image, iDCardCoordRes2.gender_coord);DrawRes2(image, iDCardCoordRes2.birth_coord);DrawRes2(image, iDCardCoordRes2.address_coord);DrawRes2(image, iDCardCoordRes2.id_number_coord);DrawRes2(image, iDCardCoordRes2.ethnicity_coord);DrawRes2(image, iDCardCoordRes2.authority_coord);DrawRes2(image, iDCardCoordRes2.issuing_date_coord);DrawRes2(image, iDCardCoordRes2.expiry_date_coord);if (pictureBox1.Image != null){pictureBox1.Image.Dispose();pictureBox1.Image = null;}pictureBox1.Image = new Bitmap(image.ToMemoryStream());image.Dispose();}}
}

下载

C++封装源码下载

C#调用源码下载

SDK下载

http://www.dt0577.cn/news/51580.html

相关文章:

  • 深圳特区专业网站建设公司磁力搜索神器
  • 上传产品网站怎么做要看网的域名是多少
  • 电商网站有哪些官网网站长尾关键词排名软件
  • 图片瀑布流网站专业做app软件开发公司
  • 优化网站具体如何做网络事件营销案例
  • 自己做的网页怎么上传网站吗自建网站平台
  • 深圳 微网站建设ydgcm全网推广公司
  • 自己建网站怎么做seo免费推广的方式有哪些
  • 网站建设太原外链群发软件
  • 推广网站的方法有搜索引擎营销中国网新山东
  • 成都网站建设公司排行百度关键词排名查询接口
  • 扬州北京网站建设sem管理工具
  • 店面门头设计网站免费个人主页网站
  • 那里有帮做网站的手机营销推广方案
  • 免费杂志模板教程seo推广排名网站
  • 重庆网站空间主机评价迅雷bt磁力链 最好用的搜索引擎
  • 做网站帮京东卖东西怎么合作搜索引擎关键词seo优化公司
  • 成品网站 子目录打不开菏泽百度推广公司电话
  • 手机网站如何更改百度网络营销推广
  • 肥东房产网刷网站seo排名软件
  • 服装公司网站建设策划如何做网站推广优化
  • 保山网站建设服务seo描述快速排名
  • 青岛网站建设迅优淄博seo
  • 新域名优化快速排名优化推广价格
  • 做名宿比较好的网站排名前50名免费的网站
  • 色一把做最好网站电商网站对比
  • 教你如何建设一个模板网站重庆网站快速排名优化
  • 山东枣庄滕州网站建设搜索引擎优化seo多少钱
  • 开源小程序模板百度seo排名原理
  • 安阳公司做网站免费推广网站大全