In matplotlib I show an image using matplotlib.pyplot.imshow. I also know how to draw a filled Polygon. One of the required arguments is xy a numpy array of shape (N, 2) where each of the N rows represents the x-y co-ordinates of a polygon point.
Now, a filled polygon rendered onto an image can also be represented by a bitmask (with the same height and width as the image), with 1s for fill, and 0s otherwise.
My question is, if I have a bitmask rather than polygon points, is there a way to draw a filled Polygon in matplotlib directly from that? And I mean in the general case where the bitmask may have more than one contiguous blob, or it may have holes:
It doesn't have to be a Polygon, but it should still be an Artist of some sort.
Note: There is this similar question Create matplotlib polygon patch using image mask but it has not been satisfactorily answered. Finding contours is an idea, but I want to know if there is something more direct in matplotlib.

