1

I'm trying to find arc length of a vessel by choosing two points on it.

The function cv.ArcLength() raises the following exception:

TypeError: All elements of sequence 'curve' must be same size

Here is my code:

contours,hierarchy = cv2.findContours(edges,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
adist=cv.ArcLength(contours,(x1,x2), isClosed=-1)

The values of the variables x1 and x2 were obtained from a mouse event.

Does anyone know the solution? Is it possible to find the arc length by integration on an irregular curve?

Cairnarvon
  • 25,981
  • 9
  • 51
  • 65
  • what do you need the (x,y) point for ? it will get interpreted as a slice(no idea what that is for..) you could try `cv2.ArcLength(contours,isClosed=-1)` also, it seems to me, that mixing cv and cv2 (old vs new api ) is never a good idea – berak Mar 13 '13 at 10:07
  • contours is a list of contours, right ? i think arclength works on a single contour only. so something like contours[0] – berak Mar 13 '13 at 10:19
  • Arc length calculation is part of another parameter calculation.And I want to calculate arc length of particular portion vessel which can be selected by a mouse event. To specify the end points I gave the variables x1 and x2. @berak Thank you for your quick response. – user2156408 Mar 15 '13 at 08:48

0 Answers0