horiken4 / ellipse-detection

52 stars 20 forks source link

Error when running tests #2

Open ivanursul opened 6 years ago

ivanursul commented 6 years ago

Hi, I am getting following error:

Traceback (most recent call last):
  File "/Users/ivanursul/git/ellipse-detection/test/test_ellipse_candidate_making.py", line 44, in <module>
    main()
  File "/Users/ivanursul/git/ellipse-detection/test/test_ellipse_candidate_making.py", line 32, in main
    ellipse_cands = ellipse_cand_maker.make(segments)
  File "/Users/ivanursul/git/ellipse-detection/ellipse_detection/ellipse_candidate_maker.py", line 77, in make
    seg_pair_ij = ellipse_ce.estimate(seg_i, seg_j)
  File "/Users/ivanursul/git/ellipse-detection/ellipse_detection/ellipse_center_estimator.py", line 36, in estimate
    midpoints, ra, ma = EllipseCenterEstimator._compute_chord_midpoints(seg_a, seg_b)
  File "/Users/ivanursul/git/ellipse-detection/ellipse_detection/ellipse_center_estimator.py", line 111, in _compute_chord_midpoints
    ha = seg_a.middle_point
  File "/Users/ivanursul/git/ellipse-detection/ellipse_detection/segment.py", line 47, in middle_point
    return self._points[self._points.shape[0] / 2]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Do you know what can be the problem?

cjekel commented 4 years ago

In Python 3

    return self._points[self._points.shape[0] / 2]

creates an error because the division of two integers is a float.

You'll need to change the line to something like

    return self._points[self._points.shape[0] // 2]

which will need to be done in a few places in this library.

VCasecnikovs commented 4 years ago

I did this, but now I have different errors, ellipse estimator. Does this library work on your machine?

cjekel commented 4 years ago

@VCasecnikovs I don't remember. I can't seem to find a local copy on my machine, and I don't have a fork on github...

Maybe check the network graph, there were a couple up commits from others https://github.com/horiken4/ellipse-detection/network that could fix issues.