Add image perspective editing and related tools

- Implemented the Image Perspective tool for editing image corners in Blender.
- Created a new operator `EditImagePerspective` to handle the perspective transformation.
- Added a preview feature for the perspective adjustment.
- Introduced the `ImagePolylineTool` for editing image masks with polylines.
- Developed backend support for Real-ESRGAN model inference, including ONNX integration.
- Added functionality for image masking and background removal.
- Created unit tests for the Real-ESRGAN ONNX model to ensure correct preprocessing and inference.
This commit is contained in:
2026-08-22 22:17:10 +08:00
parent f42cba1932
commit 1613bd3194
45 changed files with 1802 additions and 1133 deletions

View File

@@ -11,6 +11,7 @@ from . import model_catalog as shared_model_catalog
BEN2_MODEL_KEY = "BEN2_BASE"
REALESRGAN_MODEL_KEY = "REALESRGAN_GENERAL_X4V3"
DEFAULT_DA3_MODEL_KEY = "BASE"
DEFAULT_MOGE2_MODEL_KEY = "MOGE2_VITS_NORMAL"
REQUIRED_MODEL_KEYS = (DEFAULT_MOGE2_MODEL_KEY, BEN2_MODEL_KEY)
@@ -280,37 +281,14 @@ def balloon_contour_analysis_property():
)
def image_extract_remove_background_property():
def image_edit_refine_selection_property():
return bpy.props.BoolProperty(
name="Remove Background",
description=(
"Use BEN2 to remove the background inside the selected image region"
),
name="Refine Selection",
description="Use BEN2 to fit the gesture mask to foreground content",
default=False,
)
def image_extract_continuous_property():
return bpy.props.BoolProperty(
name="Continuous",
description=(
"Keep the source Image Empty active and continuously create extracted copies"
),
default=False,
)
def image_extract_padding_property():
return bpy.props.IntProperty(
name="Padding",
description="Transparent padding in pixels around the visible Alpha bounds",
default=0,
min=0,
soft_max=256,
subtype="PIXEL",
)
def balloon_depth_analysis_property():
return bpy.props.BoolProperty(
name="Depth",
@@ -337,9 +315,7 @@ def balloon_radial_zoom_property(scale):
class AnyImageSettings(bpy.types.PropertyGroup):
image_extract_remove_background: image_extract_remove_background_property()
image_extract_continuous: image_extract_continuous_property()
image_extract_padding: image_extract_padding_property()
image_edit_refine_selection: image_edit_refine_selection_property()
balloon_mode: balloon_mode_property()
balloon_thickness: balloon_thickness_property()
balloon_resolution: balloon_resolution_property()