jcmellado / js-aruco

JavaScript library for Augmented Reality applications
Other
600 stars 132 forks source link

sorting the contours #16

Closed iam-prakash closed 7 years ago

iam-prakash commented 7 years ago

Hi,

Thumbs Up..!! for the amazing scripts.

I would like to know if there is a method to sort the contours.

Thanks in advance.

jcmellado commented 7 years ago

Not sure what are you looking for.

Maybe the cv.perimeter function.

iam-prakash commented 7 years ago

sorry for not being clear, Actually I was looking to sort the contours based on

  1. left to right. (x co-ordinate) (or)
  2. based on number of pixels in that contour.
jcmellado commented 7 years ago
  1. The contour object has a list of pixel coordinates, iterate over it and find the minimum x
  2. Pixels on the perimeter of the contour? Then maybe the cv.perimeter function could do the trick. Pixels on the area delimited by the contour? Then maybe you should use some sort of flood filling algorithm