Source code for sketchkit.stylization.NeuralBrushstroke.forger.viz.bundled
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.## NVIDIA CORPORATION & AFFILIATES and its licensors retain all intellectual property# and proprietary rights in and to this software, related documentation# and any modifications thereto. Any use, reproduction, disclosure or# distribution of this software and related documentation without an express# license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.importosimporttorchfromskimage.ioimportimreadimporttorchvisionBUNDLED_IMAGES_PATH=os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)),os.path.pardir,'images'))BUNDLED_GEOMETRY_PATH=os.path.join(BUNDLED_IMAGES_PATH,'spline_patches_curated')BUNDLED_FONTS_PATH=os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)),os.path.pardir,'resources','fonts'))REPO_ROOT=os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)),os.path.pardir,os.path.pardir))
[docs]defload_bundled_geometry_image(basename,width=None):ifnotos.path.isdir(BUNDLED_GEOMETRY_PATH):raiseRuntimeError('Expected images at path {}'.format(BUNDLED_GEOMETRY_PATH))path=os.path.join(BUNDLED_GEOMETRY_PATH,basename)ifnotos.path.isfile(path):raiseRuntimeError('Expected image not found: {}'.format(path))returnload_geometry_image(path,width)