Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 2088

How to get the number of centroids in a rectangle?

$
0
0
Current if statements checks if centroid coordinates (x, y) are inside the red rectangle and outputs the coordinates. Instead of getting coordinates of each centroid inside the red rectangle how can I get the the total number of centroids inside the red rectangle? If statement: if ((x > box_one.top[0]) and (x < box.bottom[0]) and (y > box.top[1]) and (y < box.bottom[1])): print(x, y) Output picture: ![image description](/upfiles/15802156662009048.jpg) Current output: 111 237 532 247 307 249 Desired output: 3

Viewing all articles
Browse latest Browse all 2088

Trending Articles