trivector.trivector module¶
Image conversion functionality for trivector
-
class
trivector.trivector.
DiagonalStyle
[source]¶ Bases:
enum.Enum
Styling options noting the diagonal arrangement of the triangle sectors
-
alternating
= 'alternating'¶
-
left
= 'left'¶
-
right
= 'right'¶
-
-
trivector.trivector.
lower_tri_sum
(d3array)[source]¶ Get a 3D image array’s lower diagonal’s pixel color average
Parameters: d3array ( ndarray
) – 3D image array derived fromcv2.imread()
Treat the 3D array as 2d array. Having the innermost array (pixel BGR values) be considered base values to be averaged.
Note
If the lower diagonal cannot be computed (eg: flat/malformed 3D array) use the 3D image array’s upper diagonal’s pixel color average instead.
Return type: ndarray
Returns: BGR array of the average color of the lower diagonal of the 3D image array
-
trivector.trivector.
trivector
(image_path, cut_size, output_path, diagonal_style=<DiagonalStyle.alternating: 'alternating'>)[source]¶ Convert an image into a SVG vector image composed of triangular sectors
Parameters: - image_path (
str
) – path to the image to trivector - cut_size (
int
) – size in pixels for each triangle sector - diagonal_style (
DiagonalStyle
) – diagonal arrangement of the triangle sectors - output_path (
str
) – path to write the trivectored image
- image_path (
-
trivector.trivector.
upper_tri_sum
(d3array)[source]¶ Get a 3D image array’s upper diagonal’s pixel color average
Parameters: d3array ( ndarray
) – 3D image array derived fromcv2.imread()
Treat the 3D array as 2d array. Having the innermost array (pixel BGR values) be considered base values to be averaged.
Return type: ndarray
Returns: BGR array of the average color of the upper diagonal of the 3D image array