Open enmengyi opened 6 years ago
Hello, thanks for your code so much. In icdar.py, I found the function polygon_area(poly) you defined to compute the area of a polygon:
def polygon_area(poly): edge = [ (poly[1][0] - poly[0][0]) * (poly[1][1] + poly[0][1]), (poly[2][0] - poly[1][0]) * (poly[2][1] + poly[1][1]), (poly[3][0] - poly[2][0]) * (poly[3][1] + poly[2][1]), (poly[0][0] - poly[3][0]) * (poly[0][1] + poly[3][1]) ] return np.sum(edge)/2.
It means that
area = [(x2-x1)*(y2+y1) + (x3-x2)*(y3+y2) + (x4-x3)*(y4+y3) + (x1-x4)*(y1+y4)] / 2
But I can't understand why. Would you like to give some explanation of this? Thanks~
I just search and find this magic works..
I also confused about it. Do you understand it? @enmengyi @argman Thanks~ And I found the result is negative number or will adjust the position of points.
I found some information about this problem. you can see zhihu or math
Hello, thanks for your code so much. In icdar.py, I found the function polygon_area(poly) you defined to compute the area of a polygon:
It means that
But I can't understand why. Would you like to give some explanation of this? Thanks~