Add image extraction functionality with background removal
- Implemented ExtractImageRegion operator for extracting image regions using box or lasso selection. - Added RemoveImageRegionBackground job for background removal from selected image regions. - Created utility functions for polygon bounds, selection canvas creation, and applying selection masks. - Integrated image processing using PIL and numpy for efficient pixel manipulation. - Enhanced user experience with modal drawing and status updates during extraction.
This commit is contained in:
@@ -280,25 +280,27 @@ def balloon_contour_analysis_property():
|
||||
)
|
||||
|
||||
|
||||
def image_lasso_contour_analysis_property():
|
||||
def image_extract_remove_background_property():
|
||||
return bpy.props.BoolProperty(
|
||||
name="Contour",
|
||||
name="Remove Background",
|
||||
description=(
|
||||
"Use BEN2 to refine the lasso Alpha while preserving the source colors"
|
||||
"Use BEN2 to remove the background inside the selected image region"
|
||||
),
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def image_lasso_keep_original_property():
|
||||
def image_extract_continuous_property():
|
||||
return bpy.props.BoolProperty(
|
||||
name="Keep Original",
|
||||
description="Keep the source Image Empty and create a cropped copy",
|
||||
name="Continuous",
|
||||
description=(
|
||||
"Keep the source Image Empty active and continuously create extracted copies"
|
||||
),
|
||||
default=False,
|
||||
)
|
||||
|
||||
|
||||
def image_lasso_padding_property():
|
||||
def image_extract_padding_property():
|
||||
return bpy.props.IntProperty(
|
||||
name="Padding",
|
||||
description="Transparent padding in pixels around the visible Alpha bounds",
|
||||
@@ -335,9 +337,9 @@ def balloon_radial_zoom_property(scale):
|
||||
|
||||
|
||||
class AnyImageSettings(bpy.types.PropertyGroup):
|
||||
image_lasso_contour_analysis: image_lasso_contour_analysis_property()
|
||||
image_lasso_keep_original: image_lasso_keep_original_property()
|
||||
image_lasso_padding: image_lasso_padding_property()
|
||||
image_extract_remove_background: image_extract_remove_background_property()
|
||||
image_extract_continuous: image_extract_continuous_property()
|
||||
image_extract_padding: image_extract_padding_property()
|
||||
balloon_mode: balloon_mode_property()
|
||||
balloon_thickness: balloon_thickness_property()
|
||||
balloon_resolution: balloon_resolution_property()
|
||||
|
||||
Reference in New Issue
Block a user