文章 ID: 000092809 内容类型: 产品信息和文件 上次审核日期: 2023 年 02 月 16 日

无法为自定义对象检测应用程序在图像中生成物体周围的边框

BUILT IN - ARTICLE INTRO SECOND COMPONENT
总结

生成边框的示例代码。

说明

无法了解如何在图像中对象周围绘制边框以用于自定义对象检测应用程序。

解决方法

生成边框的示例代码:

For box in boxes:   
  #Pick a confidence factor from the last place in an array.    
   conf=box[-1]   
   If conf > threshold:  
     #Convert float to int and multiply corner position of each box by x and y ration.    
     #If the bounding box is found that the top of the image  
     #Position the upper box bar little lower to make it visible on the image    
    (x_min, y_min, x_max, y_max) = [
        int (max(corner_position*ratio_y, 10)) if idx%2
        else int (corner_position*ratio_x)
        for idx, corner_position in enumerate(box[:-1])  

    #Draw a box base on the position, parameters in rectangle function are: image,start_point, end_point, color, thickness.
   rgb_image = cv2.rectangle(rgb_image, (x_min,y_min), (x_max,y_max), 
       colors["green"], 3)
其他信息:

请参阅 Object Detection Python* 演示 源代码,了解OpenVINO™推断引擎 API 用于创建边框的用法以及该模型的处理方法。

相关产品

本文适用于 1 产品

全部显示

本页面上的内容是原始英文内容的人工翻译与计算机翻译的组合。我们提供此内容是为了您的便利并且仅供参考,未必完整或准确。如果本页面的英文版与翻译版之间存在任何冲突,应以英文版为准。 查看此页面的英语版本。