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

@@ -6,7 +6,13 @@ from .clipboard_image import CLASSES as CLIPBOARD_CLASSES
from .runtime import runtime
from .operators import CLASSES as OPERATOR_CLASSES
from .operators.balloon import BalloonTool
from .operators.image_extract import ImageBoxTool, ImageLassoTool, ImagePerspectiveTool
from .operators.image_edit import (
ImageBoxTool,
ImageLassoTool,
ImageLineTool,
ImagePerspectiveTool,
ImagePolylineTool,
)
from .preferences import AnyImagePreferences
from .properties import AnyImageSettings
from .menu import AnyImageImageMenu, draw_image_context_menu
@@ -15,6 +21,7 @@ from .panel import (
Da3OutputDebugPanel,
DebugPanel,
Moge2ApiDebugPanel,
RealesrganGeneralX4v3DebugPanel,
ServerPanel,
)
@@ -30,6 +37,7 @@ CLASSES = (
Moge2ApiDebugPanel,
Da3OutputDebugPanel,
Ben2RemovalDebugPanel,
RealesrganGeneralX4v3DebugPanel,
)
@@ -47,10 +55,19 @@ def register():
separator=False,
)
bpy.utils.register_tool(
ImagePerspectiveTool,
ImageLineTool,
after={ImageLassoTool.bl_idname},
separator=False,
)
bpy.utils.register_tool(
ImagePolylineTool,
after={ImageLineTool.bl_idname},
separator=False,
)
bpy.utils.register_tool(
ImagePerspectiveTool,
separator=False,
)
bpy.utils.register_tool(BalloonTool, separator=False)
bpy.types.Scene.anyimage_settings = bpy.props.PointerProperty(
type=AnyImageSettings,
@@ -66,6 +83,8 @@ def unregister():
clipboard_image.unregister_keymaps()
bpy.utils.unregister_tool(BalloonTool)
bpy.utils.unregister_tool(ImagePerspectiveTool)
bpy.utils.unregister_tool(ImagePolylineTool)
bpy.utils.unregister_tool(ImageLineTool)
bpy.utils.unregister_tool(ImageLassoTool)
bpy.utils.unregister_tool(ImageBoxTool)
bpy.types.VIEW3D_MT_object_context_menu.remove(draw_image_context_menu)