Hi,
I confirm the bug to be really in qhull.
I  substituted the computation of the convex hull in scipy (qhull) with another library (vigranumpy) and thins fix the problem.

If useful I might consider working on a cython implementation of the 2D convex hull algorithm and flash a pull request.
Best
Luca



Il giorno martedì 21 agosto 2012 12:40:39 UTC+2, Luca Fiaschi ha scritto:
Hi all,
I get a strange bug trying to uses regionprops on some images.
Computing the hull of some objects result a internal error in the qhull library:
Below you can find the error and and the set of points which triggers it:

Does anybody know how to fix it?


[[  5.   12.5]
 [  6.    6.5]
 [  7.    4.5]
 [  8.    4.5]
 [  9.    4.5]
 [ 10.    5.5]
 [  7.    4.5]
 [  7.    5.5]
 [  6.    6.5]
 [  6.    7.5]
 [  6.    8.5]
 [  6.    9.5]
 [  6.   10.5]
 [  6.   11.5]
 [  5.   12.5]
 [  5.   13.5]
 [  5.   14.5]
 [  5.   15.5]
 [  5.   16.5]
 [  5.   17.5]
 [  5.   18.5]
 [  5.   19.5]
 [  5.   20.5]
 [  5.   21.5]
 [  5.   22.5]
 [  5.   23.5]
 [  5.   24.5]
 [  6.   25.5]
 [  5.   24.5]
 [  6.   25.5]
 [  7.   25.5]
 [  8.   23.5]
 [  9.   20.5]
 [ 10.   16.5]
 [  9.    4.5]
 [ 10.    5.5]
 [ 10.    6.5]
 [ 10.    7.5]
 [ 10.    8.5]
 [ 10.    9.5]
 [ 10.   10.5]
 [ 10.   11.5]
 [ 10.   12.5]
 [ 10.   13.5]
 [ 10.   14.5]
 [ 10.   15.5]
 [ 10.   16.5]
 [  9.   17.5]
 [  9.   18.5]
 [  9.   19.5]
 [  9.   20.5]
 [  8.   21.5]
 [  8.   22.5]
 [  8.   23.5]
 [  7.   24.5]
 [  7.   25.5]
 [  5.   13.5]
 [  6.    7.5]
 [  7.    5.5]
 [  8.    5.5]
 [  9.    5.5]
 [ 10.    6.5]
 [  7.    5.5]
 [  7.    6.5]
 [  6.    7.5]
 [  6.    8.5]
 [  6.    9.5]
 [  6.   10.5]
 [  6.   11.5]
 [  6.   12.5]
 [  5.   13.5]
 [  5.   14.5]
 [  5.   15.5]
 [  5.   16.5]
 [  5.   17.5]
 [  5.   18.5]
 [  5.   19.5]
 [  5.   20.5]
 [  5.   21.5]
 [  5.   22.5]
 [  5.   23.5]
 [  5.   24.5]
 [  5.   25.5]
 [  6.   26.5]
 [  5.   25.5]
 [  6.   26.5]
 [  7.   26.5]
 [  8.   24.5]
 [  9.   21.5]
 [ 10.   17.5]
 [  9.    5.5]
 [ 10.    6.5]
 [ 10.    7.5]
 [ 10.    8.5]
 [ 10.    9.5]
 [ 10.   10.5]
 [ 10.   11.5]
 [ 10.   12.5]
 [ 10.   13.5]
 [ 10.   14.5]
 [ 10.   15.5]
 [ 10.   16.5]
 [ 10.   17.5]
 [  9.   18.5]
 [  9.   19.5]
 [  9.   20.5]
 [  9.   21.5]
 [  8.   22.5]
 [  8.   23.5]
 [  8.   24.5]
 [  7.   25.5]
 [  7.   26.5]
 [  4.5  13. ]
 [  5.5   7. ]
 [  6.5   5. ]
 [  7.5   5. ]
 [  8.5   5. ]
 [  9.5   6. ]
 [  6.5   5. ]
 [  6.5   6. ]
 [  5.5   7. ]
 [  5.5   8. ]
 [  5.5   9. ]
 [  5.5  10. ]
 [  5.5  11. ]
 [  5.5  12. ]
 [  4.5  13. ]
 [  4.5  14. ]
 [  4.5  15. ]
 [  4.5  16. ]
 [  4.5  17. ]
 [  4.5  18. ]
 [  4.5  19. ]
 [  4.5  20. ]
 [  4.5  21. ]
 [  4.5  22. ]
 [  4.5  23. ]
 [  4.5  24. ]
 [  4.5  25. ]
 [  5.5  26. ]
 [  4.5  25. ]
 [  5.5  26. ]
 [  6.5  26. ]
 [  7.5  24. ]
 [  8.5  21. ]
 [  9.5  17. ]
 [  8.5   5. ]
 [  9.5   6. ]
 [  9.5   7. ]
 [  9.5   8. ]
 [  9.5   9. ]
 [  9.5  10. ]
 [  9.5  11. ]
 [  9.5  12. ]
 [  9.5  13. ]
 [  9.5  14. ]
 [  9.5  15. ]
 [  9.5  16. ]
 [  9.5  17. ]
 [  8.5  18. ]
 [  8.5  19. ]
 [  8.5  20. ]
 [  8.5  21. ]
 [  7.5  22. ]
 [  7.5  23. ]
 [  7.5  24. ]
 [  6.5  25. ]
 [  6.5  26. ]
 [  5.5  13. ]
 [  6.5   7. ]
 [  7.5   5. ]
 [  8.5   5. ]
 [  9.5   5. ]
 [ 10.5   6. ]
 [  7.5   5. ]
 [  7.5   6. ]
 [  6.5   7. ]
 [  6.5   8. ]
 [  6.5   9. ]
 [  6.5  10. ]
 [  6.5  11. ]
 [  6.5  12. ]
 [  5.5  13. ]
 [  5.5  14. ]
 [  5.5  15. ]
 [  5.5  16. ]
 [  5.5  17. ]
 [  5.5  18. ]
 [  5.5  19. ]
 [  5.5  20. ]
 [  5.5  21. ]
 [  5.5  22. ]
 [  5.5  23. ]
 [  5.5  24. ]
 [  5.5  25. ]
 [  6.5  26. ]
 [  5.5  25. ]
 [  6.5  26. ]
 [  7.5  26. ]
 [  8.5  24. ]
 [  9.5  21. ]
 [ 10.5  17. ]
 [  9.5   5. ]
 [ 10.5   6. ]
 [ 10.5   7. ]
 [ 10.5   8. ]
 [ 10.5   9. ]
 [ 10.5  10. ]
 [ 10.5  11. ]
 [ 10.5  12. ]
 [ 10.5  13. ]
 [ 10.5  14. ]
 [ 10.5  15. ]
 [ 10.5  16. ]
 [ 10.5  17. ]
 [  9.5  18. ]
 [  9.5  19. ]
 [  9.5  20. ]
 [  9.5  21. ]
 [  8.5  22. ]
 [  8.5  23. ]
 [  8.5  24. ]
 [  7.5  25. ]
 [  7.5  26. ]]
QH6228
Qhull internal error (qh_findbestlower): all neighbors of facet 12 are flipped or upper Delaunay.
Please report this error to qhull_bug@qhull.org with the input and all of the output.
ERRONEOUS FACET:
- f12
    - flags: top simplicial upperDelaunay
    - normal:    -0.965  -0.1942   0.1764
    - offset:   6.243641
    - vertices: p138(v7) p224(v3) p112(v0)
    - neighboring facets: f6 f28 f13

While executing:  | qhull d Qz Qbb Qt
Options selected for Qhull 2010.1 2010/01/14:
  run-id 1565793501  delaunay  Qz-infinity-point  Qbbound-last  Qtriangulate
  _pre-merge  _zero-centrum  Pgood  _max-width 22  Error-roundoff 3.7e-14
  _one-merge 2.6e-13  _near-inside 1.3e-12  Visible-distance 7.4e-14
  U-coplanar-distance 7.4e-14  Width-outside 1.5e-13  _wide-facet 4.4e-13
Last point added to hull was p132.

At error exit:

Delaunay triangulation by the convex hull of 225 points in 3-d:

  Number of input sites and at-infinity: 11
  Number of nearly incident points: 9
  Number of Delaunay regions: 0

Statistics for:  | qhull d Qz Qbb Qt

  Number of points processed: 11
  Number of hyperplanes created: 31
  Number of facets in hull: 18
  Number of distance tests for qhull: 1324


precision problems (corrected unless 'Q0' or an error)
      8 coplanar points during partitioning