Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible that imantics is missing the mask outermost pixels? #43

Open
bpmsilva opened this issue Jan 12, 2021 · 2 comments
Open

Comments

@bpmsilva
Copy link

Hello everyone,

I'm converting binary masks created from exported COCO Annotator JSON files. From a JSON file, I generate binary masks using cv2.fillPoly and process them. This results in more masks that are usually next to each other (their pixels touch each other). However, after I generate the annotation segmention (using [list(map(round, polygon)) for polygon in mask.polygons()]) and importing the generated JSON to COCO Annotator, I see that these masks do not touch each other. There is a thin space between them. That's why I wonder if in the imantics conversion some pixels are missed. Another possibility is a bug or a different convention in cv2.fillPoly. I'll investigate the problem, but any help here is welcome.

I really appreciate any help you can provide.

@Thormidable
Copy link

I think the polygon finds min and max, rather than min and stop.
this means that the 'topmost' pixels aren't inside the polygon, when they are interpreted as the latter format.

a two by two box of pixels (pixels [1,1],[2,1],[2,2],[1,2] labelled as ones) produces the polygon points [1,1],[2,1],[2,2],[1,2] which is interpreted as most systems as a 1 by 1 box

I think returning [1,1],[3,1],[3,3],[1,3] would give the results you expect.

@ZhouBay-TF
Copy link

ZhouBay-TF commented Feb 23, 2022

6
polygons_list = (Mask(mask).polygons()).points for points in polygons_list: # print(points) for point in points: cv2.circle(jpg, (point[0], point[1]), 5, (255, 0, 0), -1) cv2.imwrite("6.jpg", jpg)
Some position coordinates are missing
thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants