Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
):
"""
Generate hatched pattern from an image.
The hatches generated are in the coordinate of the input image. For example, a 100x100px
image with generate hatches whose bounding box coordinates are (0, 0, 100, 100). The
`--scale` option, by resampling the input image, indirectly affects the generated bounding
box. The `--pitch` parameter sets the densest hatching frequency,
"""
logging.info(f"generating hatches from {filename}")
interp = cv2.INTER_LINEAR
if interpolation == "nearest":
interp = cv2.INTER_NEAREST
return LineCollection(
hatched.hatch(
file_path=filename,
levels=levels,
image_scale=scale,
interpolation=interp,
blur_radius=blur,
hatch_pitch=pitch,
invert=invert,
circular=circular,
show_plot=show_plot,
h_mirror=False, # this is best handled by vpype
save_svg=False, # this is best handled by vpype
)