title: opencv find perimeter of a connected component
body: <p>I'm using opencv 2.4.13</p>
  
  <p>I'm trying to find the perimeter of a connected component, I was thinking of using <a href="http://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gae57b028a2b2ca327227c2399a9d53241" rel="nofollow">ConnectedComponentWithStats</a> but it doesn't return the perimeter, only the area, width, etc...
  There is a method to find the area with the contour but not the opposite (with one component i mean, not the entire image).</p>
  
  <p>The method <a href="http://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#ga8d26483c636be6b35c3ec6335798a47c" rel="nofollow">arcLength</a> doesn't work as well beause i have all the points of the component, not only the contour.</p>
  
  <p>I know there is a BF way to find it by iterating through each pixel of the component and see if he has neighbors which aren't in the same component. But I'd like a function which costs less.
  Otherwise, if you know a way to link a component with the contours found by the method findContours, it suits me as well.</p>
  
  <p>Thanks</p>