Ask Your Question
0

arcLength vs ContourArea?

asked 2017-11-10 23:45:59 -0600

Santhosh1 gravatar image

updated 2018-01-22 21:53:17 -0600

I have detected these two objects after processing an image. as seen below

image description

    arcLength                      contourArea
 1000.08743619918                      128         
 883.317884206771                      128

I do understand the arc length function of the openCV, but what is this CONTOUR AREA? Why is this so less than the arc length?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2017-11-11 03:49:10 -0600

matman gravatar image

Your contours are not closed. In this case the contour area is calculated as a line. By the way: the arc length of a 1px wide line is around twice as long as it should be. This is because of the algorithm used in findContours.

edit flag offensive delete link more

Comments

@matman Yes I have used cv2.RETR_TREE in cv2.findContour. But still doesn't explain how the Contour Area is calculated I'm still confused 🤔

Santhosh1 gravatar imageSanthosh1 ( 2017-11-11 04:26:00 -0600 )edit

Area is calculated using green formula (contourArea doc).

LBerger gravatar imageLBerger ( 2017-11-11 04:36:37 -0600 )edit

@LBerger Yeah, green formula requires the contour to be a closed loop. My confusion arises when the loop is not close, then how is the contourArea calculated?

Santhosh1 gravatar imageSanthosh1 ( 2017-11-14 01:22:54 -0600 )edit

@matman How come the arc length is twice as long as it should be?

John M gravatar imageJohn M ( 2018-01-14 10:17:10 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-11-10 23:45:59 -0600

Seen: 5,915 times

Last updated: Nov 11 '17