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

@@ -1,7 +1,11 @@
import bpy
from .runtime import runtime
from .properties import BEN2_MODEL_KEY, model_ready
from .properties import (
BEN2_MODEL_KEY,
REALESRGAN_MODEL_KEY,
model_ready,
)
class ServerPanel(bpy.types.Panel):
bl_label = "Job Server"
@@ -221,3 +225,45 @@ class Ben2RemovalDebugPanel(bpy.types.Panel):
text="Remove Background",
icon="IMAGE_ALPHA",
)
class RealesrganGeneralX4v3DebugPanel(bpy.types.Panel):
bl_label = "Real-ESRGAN General x4v3"
bl_idname = "ANYIMAGE_PT_debug_realesrgan_general_x4v3"
bl_parent_id = DebugPanel.bl_idname
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "AnyImage"
bl_options = {"DEFAULT_CLOSED"}
bl_order = 3
def draw(self, context):
layout = self.layout
settings = context.scene.anyimage_settings
layout.prop(settings, "input_path")
input_path = bpy.path.abspath(settings.input_path)
if input_path.lower().endswith(
(
".mp4",
".mov",
".avi",
".mkv",
".webm",
".m4v",
".mts",
".mpg",
".mpeg",
)
):
layout.prop(settings, "video_frames")
run_row = layout.row()
run_row.enabled = (
not runtime.server_busy()
and model_ready(REALESRGAN_MODEL_KEY)
)
run_row.operator(
"anyimage.debug_realesrgan_general_x4v3",
text="Run General x4v3 API",
icon="EXPORT",
)