image-processing - 如何仅在整个对象完全位于感兴趣区域内后才放置边界框?

标签 image-processing computer-vision object-detection yolo bounding-box

This is the image i get..

我已将红线的左侧垂直设置为感兴趣区域。训练一个模型来检测车牌,其中框包含 ROI 内检测到的对象坐标。甚至在整个对象进入感兴趣区域之前,边界框就会出现。我希望边界框仅在整个对象位于 ROI 内后才出现。这是我的边界框代码。

            x, y, w, h = boxes1[i]
            label = ""
            color = (0, 0, 255)
            cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)

最佳答案

仅当x + w位于红线左侧时才绘制矩形。

red_line_x = 200    # for example
x, y, w, h = boxes1[i]
if (x + w) < red_line_x:
    color = (0, 0, 255)
    cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)

关于image-processing - 如何仅在整个对象完全位于感兴趣区域内后才放置边界框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68641966/

相关文章:

tensorflow - 并集的交集用作度量或损失

c# - C#黑白图像处理

android - Android:使用hu moments opencv函数获取功能值

image-processing - 如何使用 OpenCV 检测纸上的配准标记?

OpenCV:为整个图像计算单个 HOG 向量并获取 block 位置

tensorflow - 如何获得车牌上每个符号的边界框

有关物体检测的算法

python - OpenCV 中的方向检测出现问题

java - 使用 OpenCV/JavaCV 的透视图像

scala - 在 Java servlet 上使用 Processing.org 呈现图像