New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in convex_hull_image: QH6228 Qhull internal error (qh_findbestlower) #871
Comments
This works for me with SciPy 0.12.0. Which version are you using? |
Also 0.12.0. The issue is being caused by the call to qhull, perhaps my version has a bug that has since been fixed... I have qhull version (2009.1-3) (from ubuntu 13.04 repos). |
I just upgraded to scipy 0.13.2, and also found that scipy 0.12.0 was also using qhull 2012.1 2012/02/18 (as is 0.13.2) - so it's not an old qhull bug... The full qhull error message is:
|
I've found a workaround; as the full error implies this is a precision issue, so I tried subtracting the mean as follows and it works (NB as well as subtracting the mean a full fix should probably scale the set of points into [-1,1]). My temporary fix is essentially: # skimage/morphology/convex_hull.py line 53
# Find the convex hull
offset = coords.mean(axis=0)
coords -= offset
chull = Delaunay(coords).convex_hull
v = coords[np.unique(chull)]
# Sort vertices clock-wise
v_centred = v - v.mean(axis=0)
angles = np.arctan2(v_centred[:, 0], v_centred[:, 1])
v = v[np.argsort(angles)]
# Add back here
v += offset As I hinted, as well as subtracting the offset, a full fix would possibly also scale ( ~ I'm going to wait and see if anyone else confirms this bug before submitting the patch... |
Is this a bug in QHull, or is that expected behavior? |
I don't know enough to be sure; but I also submitted a query to qhull_bug@qhull.org . |
This has also been reported here: https://gist.github.com/automata/5447635, so I'm going to put in a pull request with my workaround. |
QH6228 Bug fix - remove offset from coords Fixes issue #871.
I came across the following bug when calling
convex_hull_objects
, which I found was caused by a call toconvex_hull_image
on one of the labelled objects.Below is a minimal(ish) snippet to reproduce the error.
I get
The text was updated successfully, but these errors were encountered: