python - How can I calculate the area of an object by using its contour (chain code)? -


say have rotated squared object chain code [1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7] using 8-connectedness. how can derive area, in number of pixels?

edit:

i derived chain code boundary pixels. if easier calculate area boundary pixels, how can done?

the algorithm should able find number of pixels enclosed boundary (including boundary pixels). shape of boundary can arbitrary, long closed , not intersect itself.

the area of polygon can calculated vertices using formula:

a = 1/2 sum(i = 1..n, x[i]*y[i+1] - x[i+1]*y[i]) 

source: wolfram mathworld


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -