Ask Your Question
0

Sorting centroids

asked 2020-05-23 22:16:53 -0500

pritul gravatar image

I have an image like this

image description

Now I have the centroid of the bounding box and I want to sort them in row-wise order as in images 3 and 5 are changed.

How to solve it

I have used euclidian distance and python OpenCV

edit retag flag offensive close merge delete

Comments

Cam you post original image?

supra56 gravatar imagesupra56 ( 2020-05-24 03:34:26 -0500 )edit

An original image is the image without bounding box nothing than that

pritul gravatar imagepritul ( 2020-05-24 05:50:21 -0500 )edit

Are you streaming on video?

supra56 gravatar imagesupra56 ( 2020-05-24 07:21:38 -0500 )edit

Yes .....

pritul gravatar imagepritul ( 2020-05-24 09:44:11 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-05-24 04:49:52 -0500

kpachinger gravatar image

I don't see a factory cv.CV_SORT_ASK in this format. You can loop arr.size() and push arr.get(i) to a standard array. Then arr.sort() on multiple factors.

Sort x/y coordinate on a generalized grid unit, i.e. 25%, 50%, to allow minor pixel differences. Also, perceptually, a second centroid 3% to the right but 300% larger could be promoted.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-05-23 22:16:53 -0500

Seen: 48 times

Last updated: May 24