DOTA_devkit icon indicating copy to clipboard operation
DOTA_devkit copied to clipboard

Get Rectangle coordinates

Open jhagege opened this issue 6 years ago • 5 comments

Hi, Great stuff, thanks much.

I'm trying to convert the 4-coordinates polygon to a Rectangle in the format:

  • centerX
  • centerY
  • width
  • height
  • angle

Do you know of any tool that could help with this ? Thanks !

jhagege avatar Mar 12 '18 16:03 jhagege

Hi, We have add the "polygonToRotRectangle" function in "dota_utils.py". We hope that would be helpful.

dingjiansw101 avatar Mar 13 '18 05:03 dingjiansw101

Amazing, this is very helpful, thanks a lot !

jhagege avatar Mar 14 '18 10:03 jhagege

@jhagege @dingjiansw101 Are you sure that the conversion is correct? e.g. for a polygon in form [(x1,y1), (x2,y2), (x3,y3), (x4,y4)] i.e. [(667, 1665), (674, 1668) (666, 1659) (667, 1654)] the output of cx,cy,w,h,a that I am getting from polygonToRotRectangle is 1166.75, 1165.75, 309.166, 1381.23, 2.13. How can the center of the rotated rectangle be at 1166.75, 1165.75. This point is not anywhere near the polygon for the object in the image. Actually it's at the other end of the image. The image is the 'P0049' in training set. Any help on this would be appreciated.

karan-shr avatar Jul 15 '20 18:07 karan-shr

Hi, back at the time, it seemed to me the function did the job, but it's a bit far away, so not sure I can help much. Good luck !

jhagege avatar Jul 16 '20 06:07 jhagege

Thanks @jhagege. I was hoping the author @dingjiansw101 could be of help here.

@jhagege do you mind 'un-closing' the issue here. I think it is better to not create another issue to prevent replication.

Thanks karan

karan-shr avatar Jul 16 '20 10:07 karan-shr