--- title: "Using Optical Character Recognition (OCR) Detector" slug: "using-optical-character-recognition-ocr-detector" updated: 2025-01-08T12:23:12Z published: 2025-01-08T12:23:12Z canonical: "support.tulip.co/using-optical-character-recognition-ocr-detector" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # 使用光学字符识别 (OCR) 检测器 Note With [Frontline Coplilot™](/r230/docs/extract-text), Text can be extracted directly from images and documents, significantly simplifying the process to do OCR against images in Tulip. Going forward this is the recommended approach. *使用 Vision 的 OCR 检测器检测相机视图中的文本并触发应用程序操作* ## OCR 检测器概述 光学字符识别[(OCR](https://en.wikipedia.org/wiki/Optical_character_recognition))是对图像进行解码以查找和读取其中文本的过程。数十年来,OCR 一直是计算机视觉技术长期而专注的追求,但它仍然是现存的识别难题之一。 通过使用 OCR 检测器,您可以监控摄像机数据流中的预定义区域,实时检测文本。然后,您可以使用文本检测事件在应用程序中构建逻辑。 NOTE The real-time OCR detector results are highly dependent on the quality of the input image. To be successful and get repeatable results, make every effort to have a consistent and very well lit reading environment. Get the camera as close as possible to the location where the text would appear. Consider using a Zoom or Document cameras, as suggested in the [hardware recommendation](https://support.tulip.co/docs/hardware-recommendations-for-vision) article. **在本文中,您将学习...** - 如何设置 OCR 检测器 - 使用 OCR 检测器事件应用内触发器 - 如何调整 OCR 检测器的设置 ## 前提条件 - 请阅读 "[Vision 入门"](https://support.tulip.co/docs/getting-started-with-vision),了解 Vision 的功能和要求,以及如何设置摄像头的说明。 - 此功能适用于彩色和深度摄像头。 - OCR 功能在 Tulip r210+ 和 Player 1.1.0+ 版本中可用。 ## 设置 OCR 检测器 完成摄像机配置设置后,您就可以看到视频流了。要设置 OCR 检测器,请选择要监控以检测文本的区域。您可能需要创建一个新区域,方法是在图片上单击并拖动来定义区域: ![Creating a region for OCR detection](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20Optical%20Character%20Recognition%20%28OCR%29%20Detector_354352240.png) 接下来,点击创建检测器链接,创建一个 OCR 检测器。为检测器命名并给出描述(可选),选择 OCR 作为检测器类型。使用切换键为该区域启用 OCR 检测器。 ![Creating an OCR detector](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20Optical%20Character%20Recognition%20%28OCR%29%20Detector_354353337.png) 如果区域内检测到文本,区域边界将变为绿色,否则将保持红色。如果检测阈值为 50%,那么在该区域检测到的文本就应该有 50%以上的把握被正确检测到。此时,使用此 "*摄像机配置 "*的应用程序将触发一个事件。 ## OCR 检测器区域设置 您可能需要调整区域的设置,以获得适合您的使用情况的结果。要编辑区域设置,请单击 "摄像机配置 "并选择要调整的区域。 可使用以下设置: ![OCR detector confidence threshold](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20Optical%20Character%20Recognition%20%28OCR%29%20Detector_354219891.png) ### **OCR 置信度检测阈值** 这是触发 "检测到文本 "事件所需的置信度百分比。如果需要在恶劣条件下检测到文本,可以将此阈值设置为较低的值,如 40-50%。如果该区域之前没有检测到文本,则任何高于该阈值的值都会触发 "检测到文本 "事件。 ## 在应用程序中使用 OCR 检测器 切换到应用程序编辑器,创建一个新的**设备输出触发器**。 所有*摄像机配置*都将出现在 "**特定设备**"子列表下。请从下拉菜单中选择您的*相机配置*。 请注意,**特定** **设备**部分允许您在同一个应用程序中使用多个摄像机。运行此应用程序的任何工作站都必须有您为摄像机选择的特定*摄像机配置*。否则,应用程序运行时将显示警告。 现在,您将看到各种事件的下拉菜单,可以根据这些事件运行触发器: 在本例中,请从事件列表中选择 "**检测到文本**"。 ![Creating a text detection trigger](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20Optical%20Character%20Recognition%20%28OCR%29%20Detector_354354871.png) 如果你的步骤中有视频预览 Widget,请注意 "显示叠加 "选项允许你禁用在视频顶部显示区域。启用 "OCR DETECTOR "叠加显示 OCR 检测信息。 在分配了*摄像头配置*的台站运行应用程序。 在播放器中使用**Vision 摄像头小工具**打开步骤时,您将看到摄像头的视频流。当您在区域内移动与设置中指定的颜色相似的物体时,区域边界将变为绿色,触发操作也将发生。 ![OCR detector running in an App](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20Optical%20Character%20Recognition%20%28OCR%29%20Detector_354359852.png) 现在,您已经成功完成了在摄像机配置中设置 OCR 检测器,并准备好将此功能构建到生产应用程序中。 ## 更多阅读 - [使用夹具检测器](https://support.tulip.co/docs/using-the-jig-detector) - [在应用程序中使用视觉相机小工具](https://support.tulip.co/docs/using-the-vision-camera-widget-in-apps) - [在应用程序中使用快照功能](https://support.tulip.co/docs/using-visions-snapshot-feature) - [美景的硬件建议](https://support.tulip.co/docs/hardware-recommendations-for-vision)