PaddleOCRSharp 2.0.0
See the version list below for details.
dotnet add package PaddleOCRSharp --version 2.0.0
NuGet\Install-Package PaddleOCRSharp -Version 2.0.0
<PackageReference Include="PaddleOCRSharp" Version="2.0.0" />
<PackageVersion Include="PaddleOCRSharp" Version="2.0.0" />
<PackageReference Include="PaddleOCRSharp" />
paket add PaddleOCRSharp --version 2.0.0
#r "nuget: PaddleOCRSharp, 2.0.0"
#addin nuget:?package=PaddleOCRSharp&version=2.0.0
#tool nuget:?package=PaddleOCRSharp&version=2.0.0
English | 简体中文|Version update record
1、Introduce
This project is a C + + code modification and encapsulation based on Baidu paddleocr Net tool class library. It includes the table recognition function of text recognition, text detection and statistical analysis based on text detection results. At the same time, it is optimized to improve the recognition accuracy in the case of inaccurate small image recognition. It contains ultra lightweight Chinese OCR with a total model of only 8.6M size. The single model supports Chinese and English digit combination recognition, vertical text recognition and long text recognition. Support multiple text detection at the same time.
The project encapsulation is extremely simplified, and the actual call is only a few lines of code, which greatly facilitates the use of middle and downstream developers and reduces the entry level of paddleocr. At the same time, different functions are provided Net framework to facilitate application development and deployment in various industries. Nuget package is a high-precision Chinese and English OCR that can be installed and used immediately, can be deployed offline, and can be recognized without network.
Paddleocr DLL file is a C + + dynamic library modified from the C + + code of the open source project paddleocr and compiled based on x64 of OpenCV.
This project can only be compiled and used on x64 CPU, so 32-bit is not supported.
Linux platform is not supported for the time being. If there are cross platform requirements, please refer to systen Drawing. dll、Systen. Drawing. Common. DLL reference is deleted and recompiled.
The project currently supports the following net frameworks:
net35;net40;net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;
netstandard2.0;netcoreapp3.1;
net5.0;net6.0;
PaddleOCR official project address (Gitee)
PaddleOCR official project address(GitHub)
OCR recognition model library supports both official models and self-trained models. Bridge completely according to the OCR interface.
The project deploys its own lightweight version of 8.6m model library and server version model library (more accurate and need to be downloaded). The model library can be changed to meet the actual needs.
PaddleOCR models download address
If it needs to be modified into a server version model library, the reference code is as follows: (assuming that the server version model library is under the folder inforenceserver of the running directory)
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
if (ofd.ShowDialog() != DialogResult.OK) return;
var imagebyte = File.ReadAllBytes(ofd.FileName);
Bitmap bitmap = new Bitmap(new MemoryStream(imagebyte));
//With lightweight Chinese and English model
// OCRModelConfig config = null;
//Server Chinese and English model
//OCRModelConfig config = new OCRModelConfig();
//string root = Environment.CurrentDirectory;
//string modelPathroot = root + @"\inferenceserver";
//config.det_infer = modelPathroot + @"\ch_ppocr_server_v2.0_det_infer";
//config.cls_infer = modelPathroot + @"\ch_ppocr_mobile_v2.0_cls_infer";
//config.rec_infer = modelPathroot + @"\ch_ppocr_server_v2.0_rec_infer";
//config.keys = modelPathroot + @"\ppocr_keys.txt";
//English and digital models
OCRModelConfig config = new OCRModelConfig();
string root = Environment.CurrentDirectory;
string modelPathroot = root + @"\en";
config.det_infer = modelPathroot + @"\ch_PP-OCRv2_det_infer";
config.cls_infer = modelPathroot + @"\ch_ppocr_mobile_v2.0_cls_infer";
config.rec_infer = modelPathroot + @"\en_number_mobile_v2.0_rec_infer";
config.keys = modelPathroot + @"\en_dict.txt";
OCRParameter oCRParameter = new OCRParameter ();
OCRResult ocrResult = new OCRResult();
//It is suggested that the program can be initialized once globally. It is not necessary to initialize every time of identification, which is easy to report errors.
PaddleOCREngine engine = new PaddleOCREngine(config, oCRParameter);
{
ocrResult = engine.DetectText(bitmap );
}
if (ocrResult != null)
{
MessageBox.Show(ocrResult.Text,"Recognition results");
}
//When OCR is no longer used, please release paddlecrengine
windows下C++Download address of prediction Library
[PaddleOCR official parameters]](https://gitee.com/paddlepaddle/PaddleOCR/tree/release/2.4/deploy/cpp_infer)
2、Folder structure
PaddleOCR //PaddleOCR.dll文件的源代码文件夹
|--cpp //PaddleOCR.dll的Cpp文件
|--include //PaddleOCR.dll的.h文件
PaddleOCRLib //OCR运行需要的文件
|--inference //OCR的轻量中文简体模型库
|--libiomp5md.dll //第三方引用库
|--mkldnn.dll //第三方引用库
|--mklml.dll //第三方引用库
|--opencv_world411.dll //第三方引用库
|--paddle_inference.dll //飞桨库
|--PaddleOCR.dll //基于开源项目PaddleOCR修改的C++动态库,源码见根目录下的PaddleOCR文件夹
PaddleOCRSharp //.NET封装库项目
PaddleOCRDemo //Demo文件夹
|--Cpp //C++项目需要引用的PaddleOCR.dll的头文件和库文件
|--PaddleOCRCppDemo //C++调用示例项目
|--PaddleOCRSharpDemo //.NET调用示例项目
|--WebAPIDemo //.NET的WebAPI示例项目
3、Source code compilation
As for the source code compilation, it is recommended to use vs2022 version. If you cannot compile, please switch to release and then switch back to debug。
If you cannot compile due to the problem of framework compilation, please modify paddleocrsharp \ paddleocrsharp Csproj file, delete the frame not available on the current computer, See Microsoft documentation for specific framework descriptionTarget framework in SDK style project
<TargetFrameworks>
net35;net40;net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;
netstandard2.0;netcoreapp3.1;
net5.0;net6.0;
</TargetFrameworks>
4、.NET example
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
if (ofd.ShowDialog() != DialogResult.OK) return;
var imagebyte = File.ReadAllBytes(ofd.FileName);
Bitmap bitmap = new Bitmap(new MemoryStream(imagebyte));
OCRModelConfig config = null;
OCRParameter oCRParameter = new OCRParameter ();
OCRResult ocrResult = new OCRResult();
//It is suggested that the program can be initialized once globally. It is not necessary to initialize every time of identification, which is easy to report errors。
PaddleOCREngine engine = new PaddleOCREngine(config, oCRParameter);
{
ocrResult = engine.DetectText(bitmap );
}
if (ocrResult != null)
{
MessageBox.Show(ocrResult.Text,"results");
}
5、Common problems and Solutions
if you like it,starred it.
QQ group:318860399
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- System.Drawing.Common (>= 6.0.0)
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- System.Drawing.Common (>= 6.0.0)
-
net5.0
- System.Drawing.Common (>= 6.0.0)
-
net6.0
- System.Drawing.Common (>= 6.0.0)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on PaddleOCRSharp:
Package | Downloads |
---|---|
Starxcjy.DataAccess.CodeReader
图像处理库 |
|
Docimax.OCR.Core
Package Description |
|
ObtSDK
AUTOMATION Android SDK By Ông Bán Tất |
|
RG3.PF.MklPaddleOCR
1、【RG3.PF.MklPaddleOCR】(数学计算函数和方法等) 5、使用请到github获取 RG3.PF.WebApp.Host 6、6.0.0.77开始,nodeserice迁移到RG3.PF.PinYinScriptEngineCliWrap 7、https://github.com/MKL-NET/MKL.NET 8、https://gitee.com/raoyutian/paddle-ocrsharp 9、https://gitee.com/paddlepaddle/PaddleOCR |
|
PaddleOcrCutPic
兼容4.7 |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on PaddleOCRSharp:
Repository | Stars |
---|---|
ZGGSONG/STranslate
A ready-to-go translation ocr tool developed with WPF/WPF 开发的一款即用即走的翻译、OCR工具
|
|
xksoft/OcrHelper
桌面图像实时转文字工具
|
|
laosanyuan/HuoHuan
互联网微信群聊二维码获取工具
|