跳到主要内容

AI 驱动文档

您想了解什么?

裁剪后的 ROI 端点(仅分类)

OV10i 说明

OV10i 仅支持 分类 模型。本页提及的分割功能可在 OV20iOV80i 摄像头上使用。

概览

The cropped_roi endpoint provides access to cropped Regions of Interest (ROIs) generated from classification results in Haystack running on the device.

重要: 此端点仅适用于 分类类型结果。 通过此端点进行 ROI 裁剪不支持分割类型。

基础 URL 格式为:

http://{device-ip}/edge/haystack/cropped_roi/{classification_result_id}

How It Works

当相机完成一个 分类捕获 时,The Node-RED flow 动态通过将设备 IP 与分类结果 ID 配对,构造裁剪后的 ROI 图像的 URL:

const imageUrl = `http://${baseUrl}/edge/haystack/cropped_roi/${result.id}`;

每个 URL 提供一个对应于单个分类 ROI 的裁剪图像,通常表示一次检测。


Node-RED Flow Summary

The ROI_Crop flow performs the following:

  1. Extracts the Device IP

    • Parses the image_url 字段以查找 IP(如 192.168.0.101
    • 全局存储以便重复使用
  2. Queries Latest Capture Data

    • 向设备的 PostgREST API 发送 GET 请求:

      http://{device-ip}/postgrest/captures?select=...
      &order=id.desc&limit=1
    • 检索最近一次捕获以及所有 classification_result 条目

  3. Filters for Classification Results Only

    • 跳过分割或对齐结果

    • 遍历每个分类结果:

      classificationResults.forEach(result => {
      const roiName = result.roi_result?.inspection_region?.name || `ROI_${result.id}`;
      const imageUrl = `http://${baseUrl}/edge/haystack/cropped_roi/${result.id}`;
      imageMap[roiName] = imageUrl;
      });
  4. Outputs the Cropped ROI URLs

    • 将所有 ROI 图像链接保存到全局 imageMap
    • 返回最近裁剪的 ROI 图像 URL 列表

image1.png

image2.png


Example Usage

Fetch a Cropped ROI Image

curl http://192.168.0.101/edge/haystack/cropped_roi/42 -o roi_42.jpg

Use in a Web Interface

<img src="http://192.168.0.101/edge/haystack/cropped_roi/42" alt="Cropped ROI 42">

Output Example

{
"ROI_1": "http://192.168.0.101/edge/haystack/cropped_roi/1",
"ROI_2": "http://192.168.0.101/edge/haystack/cropped_roi/2"
}

Parameters

参数类型描述
device-ipstring相机 IP 地址(如 192.168.0.101

Integration Flow

  1. 通过 /postgrest/captures 获取最新捕获元数据。
  2. 确定可用的 classification_result ID。
  3. 为每个结果构建裁剪后的 ROI URL。
  4. 显示或下载这些图像以用于分析、训练数据或 QA 质检。

Download Node-RED Flow

  • ROI Crop Flow (JSON) - 用于提取裁剪后的 ROI 图像的完整 Node-RED 流
    • 可直接将此流导入 Node-RED 以访问裁剪后的分类 ROI
    • 适用于 OV10i 与 OV80i 系统