Return bounding box of this object, i.e. (min x, min y, max x, max y)
Parameters: | vertices – List [[x1, y1], [x2, y2]] or string "x1,y1,x2,y2,...,xn,yn" |
---|
Returns the area of a complex polygon.
Parameters: |
|
---|---|
Returns: | area as float |
Return a centered image sample of the shape, or None if a centered box intersects the shape edge
Returns the dominant image color that isn’t pure white or black. Uses kmeans on the colors. Returns the result as RGB hex strings in the format [‘#rrggbb’, ‘#rrggbb’, ...].
Parameters: | image – PIL image or path |
---|
Find k similar shapes to the given bsdf. The color must be within dE and the gloss contrast must be within dc.
Parameters: |
|
---|---|
Returns: | list of shape.models.MaterialShape instances. |
Crops out a complex polygon from an image. The returned image is cropped to the bounding box of the vertices and expanded with transparent pixels to a square.
Parameters: |
|
---|---|
Returns: | a tuple (masked PIL image, bbox crop PIL image), or None if the bbox is invalid |
Crops out a polygon from an image
Parameters: |
|
---|---|
Returns: | a PIL.Image, or None if the bbox is invalid |
Parse segments stored as a string.
Parameters: |
|
---|
Parse a list of vertices.
Parameters: | vertices – “v1,v2,v3,...” |
---|---|
Returns: | [(v1,v2,v3), (v4, v5, v6), ... ] |
Parse vertices stored as a string.
Parameters: |
|
---|
Group segments into nested polylines. Points are int indices into a vertex list. Segments can either be a flattened string, or a list of int tuples.
Returns a black-and-white PIL image (mode 1) of size width x height. The image is not cropped to the bounding box of the vertices. Pixels inside the polygon are 1 and pixels outside are 0 (unless inverted=True).
Parameters: |
|
---|---|
Returns: | PIL image of size (width, height) |
Update shape dominant_delta
Updates the dominant_* fields in a shape instance
Update the cropped image for a shape
Update the pbox image for a shape