Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

opencv - How to detect if a point is contained within a bounding rect - opecv & python

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

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:

  1. what is the meaning of these four numbers?.

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. a,b are the top-left coordinate of the rectangle and (c,d) be its width and height. OpenCV Contour Features
  2. to judge a point(x0,y0) is in the rectangle, just to check if a < x0 < a+c and b < y0 < b + d

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...