Ask Your Question
0

How to compute the center of a bounding box?

asked 2020-03-26 01:32:38 -0600

Pigeon gravatar image

updated 2020-03-26 01:33:21 -0600

I'm using the QRCodeDetector class to get a position on a SR Code. So I use the detectAndDecode() method to search for a QR code and it returns a bounding box with the QR code region.

I know how to calculate the center of a square or rectangle. But I don't understand how the bounding box data is set.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-03-26 03:56:03 -0600

berak gravatar image

since it returrns a vector<Point>, you could try:

vector<Point> pts;
Rect r = getBoundingRect(pts);
Point center(r.x+r.width/2, r.y+r.height/2);
edit flag offensive delete link more

Comments

I can't find any getBoundingRect() function.

Pigeon gravatar imagePigeon ( 2020-04-16 17:33:26 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-26 01:32:38 -0600

Seen: 4,844 times

Last updated: Mar 26 '20