You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
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.
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 incv2.fillPoly
. I'll investigate the problem, but any help here is welcome.I really appreciate any help you can provide.
The text was updated successfully, but these errors were encountered: