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

C# PaddleOCR 单字识别效果

C# PaddleOCR  单字识别效果

效果

说明

        根据《百度办公文档识别C++离线SDKV1.2用户接入文档.pdf》,使用C++封装DLL,C#调用。

背景

        为使客户、第三方开发者等能够更快速、方便的接入使用百度办公文档识别 SDK、促进百度 OCR产品赋能更多客户,特设计支持 c++语言的 Windows 高精通用文字识别 SDK,该 SDK 提供 pdf 转图文的能力和通过 pdf 识别文字并可以转存成 word 的能力。

SDK 简介

        本 SDK 适应于 Windows 平台下的人脸识别系统, ,开发者可在 vs2015 下⾯进⾏开发(推荐使⽤,不保证其他版本 vs 都兼容)。SDK 采⽤ c++的动态库 dll 的⽅式。上层 UI 框架支持主流框架如QT,MFC 等。

自动批量授权

        鉴权采用自动激活的方式进行授权,可参考 SDK 示例中,把申请到的授权 key 串码(仅支持批量授权)填入到 license 文件夹的 license.key 文件中,运行 SDK,即可自动激活生成授权文件 license.ini 在license 文件夹中。SDK 授权是通过接口方法 auth_from_file 实现,该方法参数分别是传入授权 key 的串码和授权文件 license.ini 的绝对路径。确保参数正确后,在 SDK 中运行了该方法,就会生成授权license.ini 文件。若授权正确,该方法的返回值为 0,若非 0,则为授权失败,错误原因可根据错误码参考后续文档查看。

离线授权

        离线授权,采用从 sdk 附带的 license_tool 工具,bin 文件夹的 license_tool 下,双击 LicenseTool.exe,再点击拷贝,把设备指纹拷贝到剪贴板中,到百度 OCR 官网进行离线激活,填入得到的设备指纹后,从官网下载离线授权文件,解压,形成 license.key 和 license.ini 两个文件,替换到 SDK 中的 license 文件夹中,运行 SDK,若在 SDK 的授权方法 auth_from_file 中返回 0,则为通过了授权。(具体可参考SDK 中的授权代码示例)

项目

代码

using HightOCRTest.Common;
using Newtonsoft.Json;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;

namespace HightOCRTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        string image_path = "";
        bool isDraw = false;
        static IntPtr engine;

        private void button6_Click(object sender, EventArgs e)
        {
            //授权校验 初始化引擎
            string key = "";
            string licenseKeyPath = Application.StartupPath + "\\license\\license.key";
            string licenseFile = Application.StartupPath + "\\license\\license.ini";
            int res = -1;
            string ini_path = "";

            key = File.ReadAllText(licenseKeyPath);

            res = Native.init_license(key, licenseFile);
            if (res != 0)
            {
                MessageBox.Show(res.ToString());
                return;
            }

            engine = Native.create();
            if (engine == null)
            {
                MessageBox.Show("创建引擎失败!");
                return;
            }

            ini_path = Application.StartupPath + "\\resource";
            res = Native.init(engine, "", 6);
            if (res != 0)
            {
                MessageBox.Show(res.ToString());
                return;
            }

            MessageBox.Show("初始化成功!");

            button1.Enabled = true;
            button3.Enabled = true;
            button4.Enabled = true;
            

            button6.Enabled = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //image_path = Application.StartupPath + "\\images\\1.jpg";
            image_path = Application.StartupPath + "\\test2.jpg";
            pictureBox1.Image = new Bitmap(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 = "";
        }

        StringBuilder ocr_result_texts = new StringBuilder(1024 * 10);
        StringBuilder ocr_result_words = new StringBuilder(1024 * 100);

        private void button1_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "";
            Application.DoEvents();

            ocr_result_texts.Clear();
            ocr_result_words.Clear();
            Mat image = new Mat(image_path);
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            int res = Native.ocr(engine, image.CvPtr, ocr_result_texts, ocr_result_words);

            stopwatch.Stop();
            double totalTime = stopwatch.Elapsed.TotalSeconds;
            textBox1.Text += $"耗时: {totalTime:F2}s";
            textBox1.Text += "\r\n-------------------\r\n";

            if (res == 0)
            {
                textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_texts.ToString()), Newtonsoft.Json.Formatting.Indented);
                textBox1.Text += "\r\n-------------------\r\n";
                textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_words.ToString()), Newtonsoft.Json.Formatting.Indented);
            }
            else
            {

                textBox1.Text = "识别失败";
            }
        }

        //绘制文字区域
        private void button3_Click(object sender, EventArgs e)
        {
            if (ocr_result_texts.Length == 0)
            {
                return;
            }

            Mat image = new Mat(image_path);
            List<OcrResTexts> lt = JsonConvert.DeserializeObject<List<OcrResTexts>>(ocr_result_texts.ToString());

            foreach (OcrResTexts item in lt)
            {
                string[] pts = item.coordinator.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(image, new OpenCvSharp.Point[][] { points }, isClosed: true, color: new Scalar(0, 255, 0), thickness: 2);
            }

            if (pictureBox1.Image != null)
            {
                pictureBox1.Image.Dispose();
                pictureBox1.Image = null;
            }

            pictureBox1.Image = new Bitmap(image.ToMemoryStream());
            image.Dispose();

        }

        //绘制单字区域
        private void button4_Click(object sender, EventArgs e)
        {
            if (ocr_result_words.Length == 0)
            {
                return;
            }

            Mat image = new Mat(image_path);
            List<OcrResWords> lt = JsonConvert.DeserializeObject<List<OcrResWords>>(ocr_result_words.ToString());

            foreach (OcrResWords item in lt)
            {
                string[] pts = item.coordinator.Split(' ');

                //left top width height

                OpenCvSharp.Rect rect = new Rect((int)Convert.ToDouble(pts[0]), (int)Convert.ToDouble(pts[1]), (int)Convert.ToDouble(pts[2]), (int)Convert.ToDouble(pts[3]));

                Cv2.Rectangle(image, rect, color: new Scalar(255, 0, 0), thickness: 1);

            }
            if (pictureBox1.Image != null)
            {
                pictureBox1.Image.Dispose();
                pictureBox1.Image = null;
            }

            pictureBox1.Image = new Bitmap(image.ToMemoryStream());
            image.Dispose();

        }

        //识别小语种→
        private void button5_Click(object sender, EventArgs e)
        {
            //if (image_path == "")
            //{
            //    return;
            //}

            //textBox1.Text = "";
            //Application.DoEvents();

            //ocr_result_texts.Clear();
            //ocr_result_words.Clear();
            //Mat image = new Mat(image_path);
            //Stopwatch stopwatch = new Stopwatch();
            //stopwatch.Start();
            //int res = Native.ocr_other(engine, image.CvPtr, ocr_result_texts, ocr_result_words);

            //stopwatch.Stop();
            //double totalTime = stopwatch.Elapsed.TotalSeconds;
            //textBox1.Text += $"耗时: {totalTime:F2}s";
            //textBox1.Text += "\r\n-------------------\r\n";

            //if (res == 0)
            //{
            //    textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_texts.ToString()), Newtonsoft.Json.Formatting.Indented);
            //    textBox1.Text += "\r\n-------------------\r\n";
            //    textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_words.ToString()), Newtonsoft.Json.Formatting.Indented);
            //}
            //else
            //{

            //    textBox1.Text = "识别失败";
            //}
        }
    }
}

using HightOCRTest.Common;
using Newtonsoft.Json;
using OpenCvSharp;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;namespace HightOCRTest
{public partial class Form1 : Form{public Form1(){InitializeComponent();}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";bool isDraw = false;static IntPtr engine;private void button6_Click(object sender, EventArgs e){//授权校验 初始化引擎string key = "";string licenseKeyPath = Application.StartupPath + "\\license\\license.key";string licenseFile = Application.StartupPath + "\\license\\license.ini";int res = -1;string ini_path = "";key = File.ReadAllText(licenseKeyPath);res = Native.init_license(key, licenseFile);if (res != 0){MessageBox.Show(res.ToString());return;}engine = Native.create();if (engine == null){MessageBox.Show("创建引擎失败!");return;}ini_path = Application.StartupPath + "\\resource";res = Native.init(engine, "", 6);if (res != 0){MessageBox.Show(res.ToString());return;}MessageBox.Show("初始化成功!");button1.Enabled = true;button3.Enabled = true;button4.Enabled = true;button6.Enabled = false;}private void Form1_Load(object sender, EventArgs e){//image_path = Application.StartupPath + "\\images\\1.jpg";image_path = Application.StartupPath + "\\test2.jpg";pictureBox1.Image = new Bitmap(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 = "";}StringBuilder ocr_result_texts = new StringBuilder(1024 * 10);StringBuilder ocr_result_words = new StringBuilder(1024 * 100);private void button1_Click(object sender, EventArgs e){if (image_path == ""){return;}textBox1.Text = "";Application.DoEvents();ocr_result_texts.Clear();ocr_result_words.Clear();Mat image = new Mat(image_path);Stopwatch stopwatch = new Stopwatch();stopwatch.Start();int res = Native.ocr(engine, image.CvPtr, ocr_result_texts, ocr_result_words);stopwatch.Stop();double totalTime = stopwatch.Elapsed.TotalSeconds;textBox1.Text += $"耗时: {totalTime:F2}s";textBox1.Text += "\r\n-------------------\r\n";if (res == 0){textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_texts.ToString()), Newtonsoft.Json.Formatting.Indented);textBox1.Text += "\r\n-------------------\r\n";textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_words.ToString()), Newtonsoft.Json.Formatting.Indented);}else{textBox1.Text = "识别失败";}}//绘制文字区域private void button3_Click(object sender, EventArgs e){if (ocr_result_texts.Length == 0){return;}Mat image = new Mat(image_path);List<OcrResTexts> lt = JsonConvert.DeserializeObject<List<OcrResTexts>>(ocr_result_texts.ToString());foreach (OcrResTexts item in lt){string[] pts = item.coordinator.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(image, new OpenCvSharp.Point[][] { points }, isClosed: true, color: new Scalar(0, 255, 0), thickness: 2);}if (pictureBox1.Image != null){pictureBox1.Image.Dispose();pictureBox1.Image = null;}pictureBox1.Image = new Bitmap(image.ToMemoryStream());image.Dispose();}//绘制单字区域private void button4_Click(object sender, EventArgs e){if (ocr_result_words.Length == 0){return;}Mat image = new Mat(image_path);List<OcrResWords> lt = JsonConvert.DeserializeObject<List<OcrResWords>>(ocr_result_words.ToString());foreach (OcrResWords item in lt){string[] pts = item.coordinator.Split(' ');//left top width heightOpenCvSharp.Rect rect = new Rect((int)Convert.ToDouble(pts[0]), (int)Convert.ToDouble(pts[1]), (int)Convert.ToDouble(pts[2]), (int)Convert.ToDouble(pts[3]));Cv2.Rectangle(image, rect, color: new Scalar(255, 0, 0), thickness: 1);}if (pictureBox1.Image != null){pictureBox1.Image.Dispose();pictureBox1.Image = null;}pictureBox1.Image = new Bitmap(image.ToMemoryStream());image.Dispose();}//识别小语种→private void button5_Click(object sender, EventArgs e){//if (image_path == "")//{//    return;//}//textBox1.Text = "";//Application.DoEvents();//ocr_result_texts.Clear();//ocr_result_words.Clear();//Mat image = new Mat(image_path);//Stopwatch stopwatch = new Stopwatch();//stopwatch.Start();//int res = Native.ocr_other(engine, image.CvPtr, ocr_result_texts, ocr_result_words);//stopwatch.Stop();//double totalTime = stopwatch.Elapsed.TotalSeconds;//textBox1.Text += $"耗时: {totalTime:F2}s";//textBox1.Text += "\r\n-------------------\r\n";//if (res == 0)//{//    textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_texts.ToString()), Newtonsoft.Json.Formatting.Indented);//    textBox1.Text += "\r\n-------------------\r\n";//    textBox1.Text += JsonConvert.SerializeObject(JsonConvert.DeserializeObject(ocr_result_words.ToString()), Newtonsoft.Json.Formatting.Indented);//}//else//{//    textBox1.Text = "识别失败";//}}}
}

相关文章:

C# PaddleOCR 单字识别效果

C# PaddleOCR 单字识别效果 效果 说明 根据《百度办公文档识别C离线SDKV1.2用户接入文档.pdf》&#xff0c;使用C封装DLL&#xff0c;C#调用。 背景 为使客户、第三方开发者等能够更快速、方便的接入使用百度办公文档识别 SDK、促进百度 OCR产品赋能更多客户&#xff0c;特设…...

pyopengl 立方体 正投影,透视投影

目录 顶点和线的方式 划线的方式实现: 顶点和线的方式 import numpy as np from PyQt5 import QtWidgets from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton from OpenGL.GL import * from OpenGL.GLU import * import sys…...

人工智能任务5-高级算法工程师需要学习哪些课程与掌握哪些能力

大家好&#xff0c;我是微学AI&#xff0c;今天给大家介绍一下人工智能的任务5-高级算法工程师需要学习哪些课程&#xff0c;需要掌握哪些能力。高级算法工程师需要掌握的算法模型有&#xff1a;人脸检测模型MTCNN&#xff0c;人脸识别方法Siamese network、center loss、softm…...

服务器上创建搭建gitlab

一、下载与安装 在主目录操作~ 1.使用wget下载 wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.0.1-ce.0.el7.x86_64.rpm 可以在开源软件镜像站选择合适的版本&#xff0c;版本不同页面菜单会稍有差异&#xff0c;此次选…...

LangChain学习之prompt格式化与解析器使用

1. 学习背景 在LangChain for LLM应用程序开发中课程中&#xff0c;学习了LangChain框架扩展应用程序开发中语言模型的用例和功能的基本技能&#xff0c;遂做整理为后面的应用做准备。视频地址&#xff1a;基于LangChain的大语言模型应用开发构建和评估高 2. 先准备尝试调用O…...

基于EasyX的贪吃蛇小游戏 - C语言

游戏基本功能演示&#xff1a; 1.主菜单界面 2.自定难度界面 在这里可以自行设定游戏的难度&#xff0c;包括蛇的移动速度&#xff0c;初始节数&#xff0c;以及默认模式&#xff0c;参考线&#xff08;网格&#xff09;。这些设定的数据都会在右上角的游戏属性栏中实时显示。…...

使用Docker辅助图像识别程序开发:在Docker中显示GUI、访问GPU、USB相机以及网络

目录概览 引言安装和配置安装docker安装nvidia-docker在docker中显示GUI在Docker中访问usb相机在Docker镜像中开放端口开启更多的GPU功能支持创建本地镜像中心一些可选参数上传镜像回收空间清理所有的无用镜像清理指定的镜像GPU Docker with Anaconda第一种方式:构建DockerFile…...

Java中常见错误-泛型擦除及桥接方法问题及解决方案

Java中泛型擦除及桥接方法 泛型擦除无界擦除上界擦除下界擦除 桥接方法演示案例wrong1wrong2wrong3right 原理总结 泛型擦除 ​ 泛型擦除是Java泛型机制的一个特性&#xff0c;它意味着**在编译期间&#xff0c;所有的泛型信息都会被移除&#xff0c;而在运行时&#xff0c;所…...

Linux 程序守护脚本

引言 程序是由代码形成的&#xff0c;代码是由人写的。只要是人&#xff0c;都会有疏忽的时候&#xff0c;导致写出的程序有bug&#xff0c;当然最严重的bug就是程序闪退。 本文旨在提供一个程序守护脚本&#xff0c;当监测到程序闪退后&#xff0c;立马将程序再起启动&#…...

跨境电商|Facebook Marketplace怎么做?

2016 年&#xff0c;Facebook打造了同名平台 Facebook Marketplace。通过利用 Facebook 现有的庞大客户群&#xff0c;该平台取得了立竿见影的成功&#xff0c;每月访问量将超过 10 亿。对于个人卖家和小企业来说&#xff0c;Facebook Marketplace是一个不错的销货渠道&#xf…...

.gitignore 文件

一.什么是 .gitignore 文件 在任何当前工作的 Git 仓库中&#xff0c;每个文件都是这样的&#xff1a; 追踪的&#xff08;tracked&#xff09;- 这些是 Git 所知道的所有文件或目录。这些是新添加&#xff08;用 git add 添加&#xff09;和提交&#xff08;用 git commit 提…...

qt中实现多语言功能

qt中实现多语言功能 原理&#xff1a; 其本质就是生成ts文件&#xff0c;然后使用Linguist软件手工翻译&#xff0c;再生成qm文件&#xff0c;最后在主程序的开始加载不同的qm文件&#xff0c;实现多语言。 步骤&#xff1a; 修改程序文件 在pro文件中加入说明 TRANSLATI…...

数据结构与算法之 leetcode 513. 找树左下角的值 (BFS) 广度优先

513. 找树左下角的值 /*** Definition for a binary tree node.* function TreeNode(val, left, right) {* this.val (valundefined ? 0 : val)* this.left (leftundefined ? null : left)* this.right (rightundefined ? null : right)* }*/ /*** param {T…...

mysql中的函数

MySQL提供了丰富的内置函数&#xff0c;涵盖了字符串操作、数字计算、日期和时间处理、条件判断、聚合计算等多个方面。这些函数可以帮助开发者在查询和数据处理时更高效地完成任务。下面是对MySQL中常见的函数分类及其主要函数的介绍&#xff1a; 字符串函数 CONCAT()&#x…...

Shell正则表达式与文本处理器

一、grep 1. 正则表达式 是一种匹配字符串的方法&#xff0c;通过一些特殊符号&#xff0c;快速实现查找&#xff0c;删除&#xff0c;替换某特定字符串。 选项&#xff1a; -a 不要忽略二进制数据。 -A 显示该行之后的内容。 -b 显示该行之前的内容。 -c 计算符合范本样…...

双指针法 ( 三数之和 )

题目 &#xff1a;给你一个整数数组 nums &#xff0c;判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i ! j、i ! k 且 j ! k &#xff0c;同时还满足 nums[i] nums[j] nums[k] 0 。请 你返回所有和为 0 且不重复的三元组。 注意&#xff1a;答案中不可以包含重复…...

感染恶意代码之后怎么办?

隔离设备 立即将感染设备与网络隔离&#xff0c;断开与互联网和其他设备的连接。这可以防止恶意代码进一步传播到其他设备&#xff0c;并减少对网络安全的威胁。 确认感染 确认设备是否真的感染了恶意代码。这可能需要使用安全软件进行全面扫描&#xff0c;以检测和识别任何已…...

【计算机网络】P3 计算机网络协议、接口、服务的概念、区别以及计算机网络提供的三种服务方式

目录 协议什么是协议协议是水平存活的协议的组成 接口服务服务是什么服务原语 协议与服务的区别计算机网络提供的服务的三种方式面向连接服务与无连接服务可靠服务与不可靠服务有应答服务与无应答服务 协议 什么是协议 协议&#xff0c;就是规则的集合。 在计算机网络中&…...

多角度剖析事务和事件的区别

事务和事件这两个概念在不同的领域有着不同的含义&#xff0c;尤其是在计算机科学、数据库管理和软件工程中。下面从多个角度来剖析事务和事件的区别&#xff1a; 计算机科学与数据库管理中的事务 事务(Transaction)&#xff1a; 定义&#xff1a;在数据库管理中&#xff0c…...

模糊小波神经网络(MATLAB 2018)

模糊系统是一种基于知识或规则的控制系统&#xff0c;从属于智能控制&#xff0c;通过简化系统的复杂性&#xff0c;利用控制法来描述系统变量之间的关系&#xff0c;采用语言式的模糊变量来描述系统&#xff0c;不必对被控对象建立完整的数学模型。相比较传统控制策略&#xf…...

Android Wi-Fi 连接失败日志分析

1. Android wifi 关键日志总结 (1) Wi-Fi 断开 (CTRL-EVENT-DISCONNECTED reason3) 日志相关部分&#xff1a; 06-05 10:48:40.987 943 943 I wpa_supplicant: wlan0: CTRL-EVENT-DISCONNECTED bssid44:9b:c1:57:a8:90 reason3 locally_generated1解析&#xff1a; CTR…...

论文解读:交大港大上海AI Lab开源论文 | 宇树机器人多姿态起立控制强化学习框架(二)

HoST框架核心实现方法详解 - 论文深度解读(第二部分) 《Learning Humanoid Standing-up Control across Diverse Postures》 系列文章: 论文深度解读 + 算法与代码分析(二) 作者机构: 上海AI Lab, 上海交通大学, 香港大学, 浙江大学, 香港中文大学 论文主题: 人形机器人…...

工业安全零事故的智能守护者:一体化AI智能安防平台

前言&#xff1a; 通过AI视觉技术&#xff0c;为船厂提供全面的安全监控解决方案&#xff0c;涵盖交通违规检测、起重机轨道安全、非法入侵检测、盗窃防范、安全规范执行监控等多个方面&#xff0c;能够实现对应负责人反馈机制&#xff0c;并最终实现数据的统计报表。提升船厂…...

前端倒计时误差!

提示:记录工作中遇到的需求及解决办法 文章目录 前言一、误差从何而来?二、五大解决方案1. 动态校准法(基础版)2. Web Worker 计时3. 服务器时间同步4. Performance API 高精度计时5. 页面可见性API优化三、生产环境最佳实践四、终极解决方案架构前言 前几天听说公司某个项…...

Objective-C常用命名规范总结

【OC】常用命名规范总结 文章目录 【OC】常用命名规范总结1.类名&#xff08;Class Name)2.协议名&#xff08;Protocol Name)3.方法名&#xff08;Method Name)4.属性名&#xff08;Property Name&#xff09;5.局部变量/实例变量&#xff08;Local / Instance Variables&…...

现代密码学 | 椭圆曲线密码学—附py代码

Elliptic Curve Cryptography 椭圆曲线密码学&#xff08;ECC&#xff09;是一种基于有限域上椭圆曲线数学特性的公钥加密技术。其核心原理涉及椭圆曲线的代数性质、离散对数问题以及有限域上的运算。 椭圆曲线密码学是多种数字签名算法的基础&#xff0c;例如椭圆曲线数字签…...

Rust 异步编程

Rust 异步编程 引言 Rust 是一种系统编程语言,以其高性能、安全性以及零成本抽象而著称。在多核处理器成为主流的今天,异步编程成为了一种提高应用性能、优化资源利用的有效手段。本文将深入探讨 Rust 异步编程的核心概念、常用库以及最佳实践。 异步编程基础 什么是异步…...

前端开发面试题总结-JavaScript篇(一)

文章目录 JavaScript高频问答一、作用域与闭包1.什么是闭包&#xff08;Closure&#xff09;&#xff1f;闭包有什么应用场景和潜在问题&#xff1f;2.解释 JavaScript 的作用域链&#xff08;Scope Chain&#xff09; 二、原型与继承3.原型链是什么&#xff1f;如何实现继承&a…...

uniapp中使用aixos 报错

问题&#xff1a; 在uniapp中使用aixos&#xff0c;运行后报如下错误&#xff1a; AxiosError: There is no suitable adapter to dispatch the request since : - adapter xhr is not supported by the environment - adapter http is not available in the build 解决方案&…...

学习STC51单片机32(芯片为STC89C52RCRC)OLED显示屏2

每日一言 今天的每一份坚持&#xff0c;都是在为未来积攒底气。 案例&#xff1a;OLED显示一个A 这边观察到一个点&#xff0c;怎么雪花了就是都是乱七八糟的占满了屏幕。。 解释 &#xff1a; 如果代码里信号切换太快&#xff08;比如 SDA 刚变&#xff0c;SCL 立刻变&#…...