Convex-hull.cpp Example

asked 2016-10-20 06:01:49 -0600

Wensh gravatar image

I have the same issue described on this stackexchange item: http://stackoverflow.com/questions/24....

Due to a memory corruption with convexHull(Mat(points), hull, true); The fix on stackexchange resizes the hull before convexing it. Is this a bug or a specific error caused by my setup.

Setup: Windows 7 64-bit Microsoft Visual Studio 2013

edit retag flag offensive close merge delete

Comments

1

please try to explain it without the SO link

berak gravatar imageberak ( 2016-10-20 06:57:31 -0600 )edit
1

the issue is simple, you are doing convexHull(Mat(points), hull, true); while a convexHull is calculated on a set of points, so a vector<Points>. Why are you forcing it inside a Mat?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-20 07:50:23 -0600 )edit
1

I think Mat(points) is allowed. The problem should be that hull is also a vector<Point> not vector<int>.

matman gravatar imagematman ( 2016-10-21 10:49:55 -0600 )edit

@matman, ow I completely missed that, but indeed, it cannot be a vector int to store locations ...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-24 02:37:47 -0600 )edit