如何检测一个点是否包含在一个边界矩形内

编程入门 行业动态 更新时间:2024-10-24 16:26:27
本文介绍了如何检测一个点是否包含在一个边界矩形内 - opecv &Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一组点 [(x0,y0), (x1,y1), .. ]

I have a set of points [(x0,y0), (x1,y1), .. ]

以及使用 cv2.boundingRect(someContour) 函数生成的一组边界矩形.其中每个边界框都是一个具有四个坐标 (a,b,c,d) 的可迭代对象.我的问题是:

And a set of bounding rectangles produced using the cv2.boundingRect(someContour) function. Where each bounding box is an iterable object with four coordinates (a,b,c,d). My questions are:

  • 这四个数字是什么意思?

  • what is the meaning of these four numbers?.

    如何检查每个给定点是否包含在边界矩形内?

    how to check if each given point is contained within the bounding rect?

    我知道 C++ 的 opencv 有 'contains' 方法,但它不存在于 python.

    I know that opencv for C++ has the 'contains' method but it doesnt exist for python.

    推荐答案

  • a,b 是矩形的左上角坐标,(c,d) 是它的宽度和高度.OpenCV 轮廓特征立>
  • 判断一个点(x0,y0)是否在矩形内,只要检查a <x0<a+c 和 b
  • 更多推荐

    如何检测一个点是否包含在一个边界矩形内

    本文发布于:2023-11-09 10:23:10,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1572125.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:矩形   边界

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!