feat: refine boundary mapping to improve alignment of inner and outer source coordinates
This commit is contained in:
@@ -51,6 +51,7 @@ def build_boundary_mapping(content_values, threshold, padding, target_shape=None
|
||||
)
|
||||
distance = padding * scale
|
||||
signed = ndimage.distance_transform_edt(mask) - ndimage.distance_transform_edt(~mask)
|
||||
signed = np.where(signed != 0.0, signed - 0.5 * np.sign(signed), 0.0)
|
||||
inward_y = ndimage.sobel(signed, axis=0, mode="nearest")
|
||||
inward_x = ndimage.sobel(signed, axis=1, mode="nearest")
|
||||
length = np.hypot(inward_y, inward_x)
|
||||
|
||||
Reference in New Issue
Block a user