- Introduced a new design for selection rasterization that decouples the selection geometry from the image content, ensuring that the SelectionMask is independent of the source image's alpha and color. - Updated the `rasterize_selection_path` function to only accept selection paths and image dimensions, removing parameters related to source alpha and alpha thresholds. - Implemented a new approach for handling selection paths using non-zero winding fill, ensuring overlapping areas are preserved. - Enhanced performance by utilizing a scanline algorithm for rasterization, significantly reducing processing time for high-resolution images. - Updated internal documentation and added comprehensive tests to validate the new behavior and performance improvements. - Ensured backward compatibility by maintaining existing interfaces where necessary while introducing breaking changes in the selection processing logic.
24 lines
885 B
Python
24 lines
885 B
Python
"""Generate model-space Z Depth and preserve color for one complete image."""
|
|
|
|
from ..geometry.prediction_artifacts import generate_moge2_artifacts
|
|
from ..media import copy_color_images, input_frames
|
|
|
|
|
|
def run(context, parameters):
|
|
context.progress(0.05, "Preparing Depth Plane")
|
|
context.directory.mkdir(parents=True, exist_ok=True)
|
|
with input_frames(context, parameters) as images:
|
|
if len(images) != 1:
|
|
raise ValueError("Depth Plane currently supports one image")
|
|
copy_color_images(images, context.directory)
|
|
artifacts = generate_moge2_artifacts(
|
|
context,
|
|
parameters,
|
|
images[0],
|
|
depth_mode="Z",
|
|
normal_mode="TANGENT",
|
|
)
|
|
context.check_cancelled()
|
|
context.progress(1.0, "Depth Plane data is ready")
|
|
return {key: path.name for key, path in artifacts.items()}
|