waspinator / pycococreator

Helper functions to create COCO datasets
Apache License 2.0
772 stars 179 forks source link

Why substracting 1 is needed for contours? #11

Closed wangg12 closed 5 years ago

wangg12 commented 5 years ago

I can not understand why substracting in this line is needed. @waspinator Could you explain it?

waspinator commented 5 years ago

Because measure.find_contours will not create closed contours if the mask touches the edges of the image, I first expand the borders by 1 pixel all the way around the image. Then when I run measure.find_contours, the contours are displaced by 1 pixel, so I need to subtract them to get their original positions.

wangg12 commented 5 years ago

OK, thanks @waspinator .