Find minimum distance between two convex hulls

asked 2018-04-16 05:04:17 -0500

Kenny Karnama gravatar image

Hi guys, i have already created convex hulls using cv::Hull. Now, i want to find the minimum distance between two adjacent convex hulls. Is there any method in the opencv to calculate this ? or should i implement myself ? because all i thought, if i want to calculate the minimum distance, i have to measure the distance between each points in convex hull number one and convex hull number 2. is it valid ? or may be there is an algorithm ? because i can't find any... Thanks.

edit retag flag offensive close merge delete


As far as I know your approach is right. The convex hull is a vector of points and you have to loop through every point in both contours/hulls and calculate the distance. Then you take the minimum distance.

Grillteller gravatar imageGrillteller ( 2018-04-17 02:57:20 -0500 )edit

It kind of depends what you mean with distance between shapes. If it is physical distance, then yes that will do it, but if you want to look at how similar 2 shapes are, then use the computeDistance function of the shape module.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-17 07:37:32 -0500 )edit