Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I suppose that you are playing with this, so

  1. contourArea is returning the area inside a contour (ofcourse, it should be closed, otherwise, it will consider it closed, so if it is a line it will consider the area inside the contour defined by the line if the first point and the last point are linked).
  2. As mentioned in the docs, the unit is pixel. If you want to get more deeper in the theory, then see Green's theorem; but for a better understanding, if the contour is a triangle, then ofcourse its area is very probably not an integer number.
  3. arcLength is measuring the length of a contour in pixels, ofcourse. Think that the contour is composed of points, so between each 2 points, there is a line, so that segment's length can be computed if the coordinates of the 2 points are known; and the coordinates are in pixels (with (0, 0) in top left corner of the image).

I suppose that you are playing with this, so

  1. contourArea is returning the area inside a contour (ofcourse, it should be closed, otherwise, it will consider it closed, so if it is a line it will consider the area inside the contour defined by the line if the first point and the last point are linked).
  2. As mentioned in the docs, the unit is pixel. If you want to get more deeper in the theory, then see Green's theorem; but for a better understanding, if the contour is a triangle, then ofcourse its area is very probably not an integer number.
  3. arcLength is measuring the length of a contour in pixels, ofcourse. Think that the contour is composed of points, so between each 2 points, there is a line, so that segment's length can be computed if the coordinates of the 2 points are known; and the coordinates are in pixels (with (0, 0) in top left corner of the image).

responding to your comment questions:

Q1. the function arcLength has a parameter closed that let you choose the case (read the docs...)

Q2. Well, that I cannot prove, because I have not the image you have. Hint: display the thresholded image to see the area. You can also draw the contour on another image to see exact what contour is it using.

Q3. About this, I am afraid I cannot tell you much, but you can search on google, too. ;)