Proyectos
Ver en GitHub
ZGGSONG/WeChatOcr
Acerca de
For learning purposes only. Currently applied in https://github.com/ZGGSONG/STranslate
Aprendizaje y educaciónCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +7
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
OriginalWeChatOcr
Description
Nuget
Install-Package WeChatOcr
Usage
- WeChatOcr
- Example Code
//1. image file
var imgPath = @"C:\Users\admin\Desktop\test.png"; //Your image file path
//2. image bytes
var imgBytes = new Byte[] {}; //Your image binary data
using var ocr = new ImageOcr(); //You can use the built-in WeChat on your computer for OCR.
ocr.Run(imgPath, //imgPath or imgBytes
(path, result) =>
{
try
{
if (result == null) return;
var list = result?.OcrResult?.SingleResult;
if (list == null)
{
//避免重复触发
_tcs.SetResult("WeChatOCR get result is null");
return;
}
var sb = new StringBuilder();
for (var i = 0; i < list?.Count; i++)
{
if (list[i] is not { } item || string.IsNullOrEmpty(item.SingleStrUtf8))
continue;
sb.AppendLine(item.SingleStrUtf8);
}
_tcs.SetResult(sb.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
}
});
presentation
Study only, do not use for commercial purposes
Thanks
Explorar proyectos relacionados
Cargando…