docs: 添加项目 README,说明愿景与目标
大石头 authored at 2026-12-02 00:23:01
20.38 KiB
NewLife.Vision
# NewLife.Vision - Biblioteca de comprensión visual para .NET ![GitHub top language](https://img.shields.io/github/languages/top/newlifex/NewLife.Vision?logo=github) ![GitHub License](https://img.shields.io/github/license/NewLifeX/NewLife.Vision?logo=github) ![NuGet Downloads](https://img.shields.io/nuget/dt/NewLife.Vision?logo=nuget) ![NuGet](https://img.shields.io/nuget/v/NewLife.Vision?logo=nuget) ![NuGet prerelease](https://img.shields.io/nuget/vpre/NewLife.Vision?label=dev%20nuget&logo=nuget) [![test](https://github.com/NewLifeX/NewLife.Vision/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/NewLifeX/NewLife.Vision/actions/workflows/test.yml) ![locales](https://img.shields.io/badge/locales-11-2ea44f?logo=dotnet) ![platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-blue) ![arch](https://img.shields.io/badge/arch-x64%20%7C%20arm64-orange) [![contributors](https://img.shields.io/github/contributors/NewLifeX/NewLife.Vision?logo=github)](https://github.com/NewLifeX/NewLife.Vision/graphs/contributors) <!-- lang:start --> 🌐 [English](/NewLife/NewLife.Vision/Blob/master/README.md) | [简体中文](/NewLife/NewLife.Vision/Blob/master/README.zh-CN.md) | [繁體中文](/NewLife/NewLife.Vision/Blob/master/README.zh-TW.md) | [Deutsch](/NewLife/NewLife.Vision/Blob/master/README.de.md) | [日本語](/NewLife/NewLife.Vision/Blob/master/README.ja.md) | [Français](/NewLife/NewLife.Vision/Blob/master/README.fr.md) | [Português](/NewLife/NewLife.Vision/Blob/master/README.pt.md) | [Русский](/NewLife/NewLife.Vision/Blob/master/README.ru.md) | [한국어](/NewLife/NewLife.Vision/Blob/master/README.ko.md) | [العربية](/NewLife/NewLife.Vision/Blob/master/README.ar.md) <!-- lang:end --> Convierte píxeles en datos estructurados y procesables: texto, códigos de barras, objetos y rostros, con motores intercambiables. Código fuente: https://github.com/NewLifeX/NewLife.Vision NuGet: `NewLife.Vision` ## Inicio rápido Decodificación de códigos de barras con el lector integrado totalmente administrado: ```bash dotnet add package NewLife.Vision ``` ```csharp using NewLife.Imaging.Codecs; using NewLife.Vision; using NewLife.Vision.Barcode; var image = ImageCodecs.Decode(File.ReadAllBytes("qr.png")).ToVisionImage(); var results = new BarcodePipeline(new ManagedBarcodeReader()).Read(image); Console.WriteLine(results[0].Text); ``` Reconocimiento de texto con el reconocedor de plantillas integrado y totalmente administrado: ```bash dotnet add package NewLife.Vision ``` ```csharp using NewLife.Imaging.Codecs; using NewLife.Vision; using NewLife.Vision.Ocr; var recognizer = new TemplateOcrRecognizer(); var pipeline = new OcrPipeline(recognizer); var image = ImageCodecs.Decode(File.ReadAllBytes("label.png")).ToVisionImage(); var result = await pipeline.RecognizeAsync(image); Console.WriteLine(result.Text); ``` Compatible con `netstandard2.0`, `netstandard2.1`, `net461`, `net8.0`, `net10.0` y `net11.0`. ## Funcionalidades <details> <summary><b>Preprocesamiento y geometría</b> (6 elementos)</summary> | Capability | What it gives you | | --- | --- | | Contrato de pasos | `IImagePreprocessor` compone pasos sin estado, ejecutables en paralelo | | Pasos básicos | Escala de grises, binarización Otsu, estiramiento de contraste, escalado y recorte ROI sobre NewLife.Imaging | | Corrección de inclinación | Estimación por perfil de proyección y rotación; devuelve el ángulo | | Corrección de perspectiva | Homografía de cuatro puntos con muestreo bilineal, tamaño de salida opcional | | Ajustes predefinidos | Cadenas listas con `PreprocessPipeline.CreateOcr()` y `CreateBarcode()` | | Calibración | `CameraCalibrator` obtiene intrínsecos y distorsión radial desde blancos planos; `ImageUndistorter` rectifica la imagen | </details> <details> <summary><b>Reconocimiento de texto</b> (5 elementos)</summary> | Capacidad | Qué ofrece | | --- | --- | | Contrato del motor | `ITextRecognizer` with a single async entry point y cancellation support | | OCR de plantillas integrado | Coincidencia de plantillas totalmente administrada, sin archivos de modelo | | Flujo OCR | Score filtering, region sorting y line-aware text merging on top of any engine | | Modelo de región | Text, confidence, bounding box y tilt angle for every detected line | | Degradación elegante | Si no se reconoce texto devuelve un resultado vacío con puntuación en lugar de lanzar una excepción | </details> <details> <summary><b>Código de barras</b> (4 elementos)</summary> | Capacidad | Qué ofrece | | --- | --- | | Contrato del motor | `IBarcodeReader` returns text, format y bounding box per result | | Lector integrado | Decodificación totalmente administrada de QR, Code128, Code39, Code93, EAN-13, EAN-8 y UPC-A sin paquete de terceros | | Código de barras pipeline | Duplicate removal by content y format, plus `MaxResults` truncation | | Selección de formato | Restrict decoding to the codes you expect to cut latency on busy images | </details> <details> <summary><b>Detección y rostros</b> (4 elementos)</summary> | Capacidad | Qué ofrece | | --- | --- | | Contrato de detección | `IObjectDetector` devuelve cajas, clases y puntuaciones; `DetectionPipeline` filtra por puntuación/clase y aplica NMS por clase | | Modelos por sesión | `IModelSession` acepta cualquier backend; la decodificación YOLO/rostros, el posproceso de segmentación y pose, la comparación 1:1 de rostros y un ejecutor ONNX puro gestionado integrado están incluidos | | OCR en la nube | `ChatVisionRecognizer` llama a cualquier endpoint compatible con OpenAI, sin dependencias de cliente adicionales | </details> <details> <summary><b>Frame y modelo de píxeles</b> (3 elementos)</summary> | Capacidad | Qué ofrece | | --- | --- | | Imagen visual | `VisionImage` wraps any buffer with offset, stride y five packed pixel formats | | Interoperabilidad de imágenes | `ImageFrame` y `VisionImage` se convierten en ambos sentidos dentro del paquete principal | | Vistas sin copia | Row y pixel spans expose the underlying buffer without copies | </details> ## Mapa del ecosistema NewLife es un ecosistema por capas de proyectos de código abierto con versionado independiente. El mapa siguiente se comparte literalmente en todos los repositorios de NewLife; cada proyecto enlaza a su repositorio y a su paquete principal de NuGet. | Proyecto | Qué hace | Descargas | | --- | --- | --- | | **Fundación** | | | | [NewLife.Core](https://github.com/NewLifeX/X) | Registro de logs, configuración, caché, red, serialización, programación de tareas y seguimiento APM. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Core?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Core) | | [NewLife.XCode](https://github.com/NewLifeX/NewLife.XCode) | Middleware de datos: tablas únicas a escala de decenas de miles de millones, particionado automático, separación lectura/escritura y más de 10 bases de datos. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.XCode?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.XCode) | | [NewLife.Net](https://github.com/NewLifeX/NewLife.Net) | Biblioteca de red de alto rendimiento: 1,77 M pps / 14,5 Gbps en una máquina (TCP 1KB, 2026-10), 4 M conexiones TCP persistentes. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Net?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Net) | | [NewLife.Remoting](https://github.com/NewLifeX/NewLife.Remoting) | Framework de comunicación por protocolo y RPC para aplicaciones cliente/servidor y dispositivos IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Remoting?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Remoting) | | [NewLife.Agent](https://github.com/NewLifeX/NewLife.Agent) | Instala aplicaciones .NET como demonios del sistema operativo: servicios de Windows y systemd de Linux. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Agent?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Agent) | | [NewLife.Templates](https://github.com/NewLifeX/NewLife.Zero) | Plantillas de proyecto `dotnet new` para consola, web, API, servicio, datos e IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Templates?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Templates) | | **Datos y mensajería** | | | | [NewLife.Redis](https://github.com/NewLifeX/NewLife.Redis) | Cliente Redis con latencia de microsegundos, millones de operaciones por segundo y colas de mensajes integradas. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Redis?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Redis) | | [NewLife.RocketMQ](https://github.com/NewLifeX/NewLife.RocketMQ) | Cliente RocketMQ totalmente administrado para Apache RocketMQ y Alibaba Cloud Message Queue. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.RocketMQ?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.RocketMQ) | | [NewLife.MQTT](https://github.com/NewLifeX/NewLife.MQTT) | Cliente y servidor MQTT, incluida la conectividad con Alibaba Cloud IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.MQTT?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.MQTT) | | [NewLife.NovaDb](https://github.com/NewLifeX/NewLife.NovaDb) | Base de datos híbrida en C#: embebida o en red, relacional, series temporales, cola de mensajes y KV en una sola. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.NovaDb?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.NovaDb) | | [NewLife.MySql](https://github.com/NewLifeX/NewLife.MySql) | Controlador y capa de ayuda de MySql construidos sobre la pila de datos de NewLife. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.MySql?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.MySql) | | [NewLife.TDengine](https://github.com/NewLifeX/NewLife.TDengine) | Controlador ADO.NET de TDengine totalmente administrado, con transportes REST, WebSocket y RPC nativo, sin dependencias nativas. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.TDengine?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.TDengine) | | [NewLife.Presto](https://github.com/NewLifeX/NewLife.Presto) | Controlador ADO.NET Presto/Trino en C# puro, sin dependencias de terceros e integración con XCode ORM. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Presto?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Presto) | | **Web y distribuido** | | | | [NewLife.Cube](https://github.com/NewLifeX/NewLife.Cube) | Framework rápido para plataformas de administración: permisos, SSO, servidor OAuth y andamiaje CRUD. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Cube?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Cube) | | [NewLife.Cube.React](https://github.com/NewLifeX/NewLife.Cube.React) | Ejemplo desacoplado para Cube: backend WebAPI con Swagger y clientes React, Vue y Blazor. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Cube.React?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Cube.React) | | [Stardust](https://github.com/NewLifeX/Stardust) | Plataforma distribuida de servicios: gestión de nodos, APM, centro de configuración, registro y centro de despliegues. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Stardust?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Stardust) | | [AntJob](https://github.com/NewLifeX/AntJob) | Plataforma de tareas distribuidas y programación de datos en tiempo real con particionado, reintentos y relleno histórico. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.AntJob?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.AntJob) | | **IA y visión** | | | | [NewLife.AI](https://github.com/NewLifeX/NewLife.AI) | Cliente unificado para 46 proveedores de LLM más ChatAI, una aplicación web de chat lista para usar. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.AI?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.AI) | | [NewLife.Imaging](https://github.com/NewLifeX/NewLife.Imaging) | Base de imágenes totalmente administrada: modelo de píxeles, contratos de códec, dibujo y metadatos sin dependencias nativas. | — | | [NewLife.Vision](https://github.com/NewLifeX/NewLife.Vision) | Algoritmos de visión: OCR, códigos de barras, detección de objetos y reconocimiento facial sobre NewLife.Imaging. | — | | [NewLife.ML](https://github.com/NewLifeX/NewLife.ML) | Aprendizaje automático tabular para .NET: convierte tablas de base de datos y hojas de Excel en modelos de predicción y clasificación desplegables. | — | | **Industrial e IoT** | | | | [NewLife.IoT](https://github.com/NewLifeX/NewLife.IoT) | Biblioteca estándar de IoT que define contratos de protocolo y abstracciones de dispositivos. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.IoT?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.IoT) | | [NewLife.Modbus](https://github.com/NewLifeX/NewLife.Modbus) | Implementación de Modbus TCP/RTU/ASCII sobre NewLife.IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Modbus?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Modbus) | | [NewLife.Siemens](https://github.com/NewLifeX/NewLife.Siemens) | Protocolo para PLC Siemens sobre NewLife.IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Siemens?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Siemens) | | [NewLife.Omron](https://github.com/NewLifeX/NewLife.Omron) | Protocolo para PLC Omron sobre NewLife.IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Omron?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Omron) | | [NewLife.Melsec](https://github.com/NewLifeX/NewLife.Melsec) | Protocolo para PLC Mitsubishi Melsec sobre NewLife.IoT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Melsec?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Melsec) | | [NewLife.Schneider](https://github.com/NewLifeX/NewLife.Schneider) | Controlador de comunicación para PLC Schneider basado en Modbus TCP. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Schneider?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Schneider) | | [NewLife.OPC](https://github.com/NewLifeX/NewLife.OPC) | Cliente OPC para el acceso a datos industriales. | — | | [NewLife.BACnet](https://github.com/NewLifeX/NewLife.BACnet) | Pila de protocolo BACnet para la automatización de edificios. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.BACnet?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.BACnet) | | [NewLife.LoRa](https://github.com/NewLifeX/NewLife.LoRa) | Protocolo LoRaWAN de bajo consumo para conectividad IoT de largo alcance. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.LoRa?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.LoRa) | | [ZeroIoT](https://github.com/NewLifeX/ZeroIoT) | Plataforma IoT de código abierto y ligera con gestión de pasarelas y dispositivos. | — | | **Telemática vehicular** | | | | [NewLife.JT808](https://github.com/NewLifeX/NewLife.JT808) | Protocolo de posicionamiento vehicular JT/T 808: más de 70 cuerpos de mensaje, 2011/2013/2019. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.JT808?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.JT808) | | [NewLife.JT809](https://github.com/NewLifeX/NewLife.JT809) | Protocolo plataforma a plataforma JT/T 809 para autoridades de transporte. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.JT809?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.JT809) | | [NewLife.JT1078](https://github.com/NewLifeX/NewLife.JT1078) | Vídeo a bordo JT/T 1078: análisis RTP, remultiplexado FLV/fMP4 y transmisión en directo. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.JT1078?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.JT1078) | | **Componentes de dominio** | | | | [NewLife.Office](https://github.com/NewLifeX/NewLife.Office) | Un solo paquete para Excel, Word, PPT, PDF y más de 15 formatos de documento. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Office?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Office) | | [NewLife.Audio](https://github.com/NewLifeX/NewLife.Audio) | Audio multiplataforma: códecs, E/S de dispositivos, DSP, contenedores y streaming. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Audio?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Audio) | | [NewLife.Video](https://github.com/NewLifeX/NewLife.Video) | Códecs de vídeo, formatos de contenedor, procesamiento de fotogramas y streaming. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Video?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Video) | | [NewLife.Map](https://github.com/NewLifeX/NewLife.Map) | Interfaz unificada sobre Baidu, AMap, Tencent y Tianditu con geocodificación y conversión de coordenadas. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Map?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Map) | | [NewLife.IP](https://github.com/NewLifeX/NewLife.IP) | Geolocalización IPv4 con una base de datos offline mapeada en memoria y una API en línea de respaldo. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.IP?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.IP) | | [NewLife.Holiday](https://github.com/NewLifeX/NewLife.Holiday) | Biblioteca de identificación de festivos chinos y días de ajuste laboral, con datos anuales integrados y soporte de fiestas lunares, totalmente sin conexión. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.Holiday?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.Holiday) | | **Herramientas y productos** | | | | [CrazyCoder](https://github.com/NewLifeX/XCoder) | Caja de herramientas del desarrollador: red, puerto serie, criptografía, expresiones regulares, Modbus y MQTT. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.XCoder?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.XCoder) | | [NewLife.UnitTest](https://github.com/NewLifeX/NewLife.UnitTest) | Extensiones para pruebas unitarias: clases base, pruebas basadas en datos y ayuda para inyección de dependencias. | [![NuGet](https://img.shields.io/nuget/dt/NewLife.UnitTest?style=flat-square&logo=nuget&label=downloads)](https://www.nuget.org/packages/NewLife.UnitTest) | | [GitCandy](https://github.com/NewLifeX/GitCandy) | Sistema de gestión de código fuente Git autoalojado. | — | | [LuckyClover](https://github.com/NewLifeX/LuckyClover) | Instala automáticamente el runtime de .NET correspondiente cuando se ejecuta desde un host más antiguo. | — | > Las insignias muestran el paquete principal de cada proyecto; los paquetes de temas, extensiones y satélites figuran en sus páginas de NuGet. Los más de 30 paquetes no listados aquí (FTP, extensiones de Office, controladores de protocolo, etc.) están disponibles en la [organización NewLifeX](https://github.com/NewLifeX) y en [newlifex.com](https://newlifex.com). ## Documentación | Documento | Descripción | | --- | --- | | [Requisitos](/NewLife/NewLife.Vision/Blob/master/Doc/需求文档.md) | Vision, goals, module scope y non-goals | | [Lista de funciones](/NewLife/NewLife.Vision/Blob/master/Doc/功能清单.md) | Feature status across implementation, testing y comments | | [Arquitectura](/NewLife/NewLife.Vision/Blob/master/Doc/架构设计.md) | Layers, contracts, pipelines y adapter boundaries | | [Análisis competitivo](/NewLife/NewLife.Vision/Blob/master/Doc/竞品分析.md) | Engine comparison y positioning | | [Línea base de rendimiento](/NewLife/NewLife.Vision/Blob/master/Doc/性能测试.md) | Latencia y asignaciones medidas de las canalizaciones principales | | [Historial de cambios](/NewLife/NewLife.Vision/Blob/master/Doc/ChangeLog.md) | Historial de versiones generado en cada publicación | ## Contribuir ```bash dotnet build -c Release dotnet test -c Release ``` Issues y pull requests are welcome. Please keep public API free of third-party engine types y add a focused test for every new behavior. ## Licencia MIT License ## Equipo <img src="https://newlifex.com/logo.png" width="48" align="right" alt="NewLife" /> Founded in 2002, the NewLife team has spent more than two decades on the .NET y IoT ecosystem y maintains nearly 100 open-source projects. Open-source components have been downloaded <!--nuget-total:start-->6.48M<!--nuget-total:end--> times from NuGet (ecosystem-wide, as of 2026-10). Sitio web: https://newlifex.com · Organización de código abierto: https://github.com/NewLifeX