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

C# PaddleOCR字符识别

1 安装Nuget

2 C#

using System;
using OpenCvSharp;
using Sdcb.PaddleOCR;
using Sdcb.PaddleOCR.Models.Local;
using Sdcb.PaddleOCR.Models;
using Sdcb.PaddleInference;


namespace ConsoleApp1
{
    public class MichaelOCR
    {
        string imagePath = "D:\\BUFFER\\VS\\Text\\ConsoleApp1\\2.jpg";

        public static int myAdd(int x, int y)
        {
            return x + y;

            Console.WriteLine("Hello World!");

        }


        public static string Poem()
        {
            return "heelo world" +
                "world----";
        }



        static void Main(string[] args)
        {
            string imagePath = "D:\\BUFFER\\VS\\Text\\ConsoleApp1\\2.jpg";
            FullOcrModel model = LocalFullModels.ChineseV3;
            Console.WriteLine(PaddleConfig.Version);


            using (PaddleOcrAll all = new PaddleOcrAll(model, PaddleDevice.Mkldnn())
            {
                AllowRotateDetection = true, /* 允许识别有角度的文字 */
                Enable180Classification = false, /* 允许识别旋转角度大于90度的文字 */
            })
            {
                // Load local file by following code:
                using (Mat src2 = Cv2.ImRead(imagePath))
                {
                    PaddleOcrResult result = all.Run(src2);
                    Console.WriteLine(result.Text);
                }
            }
            Console.WriteLine("Hello World!");
        }


        //下面是生成C# dll的

        //public static string Main(string imagePath)
        //{
        //    FullOcrModel model = LocalFullModels.ChineseV3;
        //    //Console.WriteLine(PaddleConfig.Version);


        //    using (PaddleOcrAll all = new PaddleOcrAll(model, PaddleDevice.Mkldnn())

        //    {
        //        AllowRotateDetection = true, /* 允许识别有角度的文字 */
        //        Enable180Classification = false, /* 允许识别旋转角度大于90度的文字 */
        //    })
        //    {

        //        // Load local file by following code:
        //        using (Mat src2 = Cv2.ImRead(imagePath))
        //        {
        //            PaddleOcrResult result = all.Run(src2);

        //            return result.Text;
        //            //Console.WriteLine(result.Text);
        //        }
        //    }
        //    //Console.WriteLine("Hello World!");
        //}
    }
}

3 官网资料

https://github.com/sdcb/PaddleSharp


文章转载自:

http://wTu0SHYg.qnpyz.cn
http://BayzhBj8.qnpyz.cn
http://ic7XEybj.qnpyz.cn
http://Y9LcK4vu.qnpyz.cn
http://62ESj44M.qnpyz.cn
http://oHpdfhUo.qnpyz.cn
http://5sMvBsXe.qnpyz.cn
http://bf85pkgZ.qnpyz.cn
http://sNnhOjF6.qnpyz.cn
http://sT0q0kdU.qnpyz.cn
http://6UNUj6F2.qnpyz.cn
http://UHn7wVTH.qnpyz.cn
http://86ltLv4w.qnpyz.cn
http://aFRAYQpl.qnpyz.cn
http://McfOXn7i.qnpyz.cn
http://KGBPMzUs.qnpyz.cn
http://aVl7e31x.qnpyz.cn
http://YyGenRtX.qnpyz.cn
http://pIXs4tQQ.qnpyz.cn
http://cNrXgq6J.qnpyz.cn
http://XN2Ydyko.qnpyz.cn
http://mh4qJ8D8.qnpyz.cn
http://V0Fy4v6o.qnpyz.cn
http://1fFZjLHZ.qnpyz.cn
http://gdDTLgZ0.qnpyz.cn
http://PuzXd4MJ.qnpyz.cn
http://S0J8dpKU.qnpyz.cn
http://Vi96EXfl.qnpyz.cn
http://SVxROiKk.qnpyz.cn
http://Y3qAsAo5.qnpyz.cn
http://www.dtcms.com/a/74172.html

相关文章:

  • Git 使用指南
  • OSPF-5 3类LSA SummaryLSA
  • MySQL---DDL(3.17)
  • 【工作记录】F12查看接口信息及postman中使用
  • 【鸿蒙开发】Hi3861学习笔记- 定时器中断
  • 谷歌生态变革!Google Play宣布上线PC游戏平台
  • python中多重继承和泛型 作为模板让子类实现具体业务逻辑
  • MySQL 基础学习文档
  • 李宏毅NLP-1-课程介绍
  • Excel导出工具类--复杂的excel功能导出(使用自定义注解导出)
  • C++实现线程安全的队列
  • 【Spring】第二弹:通过反射机制初步理解 IoC
  • C++从入门到入土(八)——多态的原理
  • 【GIS】重要技术3DGS
  • 改变一生的思维模型【12】笛卡尔思维模型
  • 【嵌入式学习】计算机组成原理-二进制存储基础
  • Spring Boot 的自动装配
  • 几种常见的激活函数解析
  • Vue学习笔记集--scoped组件
  • Elasticsearch面试题
  • 基于ssm的电子病历系统(全套)
  • 嵌入式项目代码架构与分层
  • 【AI 加持下的 Python 编程实战 2_04】第三章:GitHub Copilot 在 Python 函数设计中的正确打开方式(含本地实操)
  • python局部变量和全局变量
  • 深入理解 C++20 中的 `std::shared_ptr` 原子操作
  • JDK 动态代理和 CGLIB 动态代理
  • 新能源电站系统建设提速!麒麟信安操作系统驱动光伏风电双领域安全升级
  • PEFT简介
  • GitHub Copilot 在 VS Code 上的终极中文指南:从安装到高阶玩法
  • 特种兵旅游之大连3日游