Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -473,6 +473,7 @@ def apply_mask(d, b):
|
|
473 |
|
474 |
edge = []
|
475 |
mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
|
|
|
476 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
477 |
mask = cv2.dilate(mask, dilation)
|
478 |
b = b*2+1
|
@@ -556,7 +557,6 @@ def draw_mask(l, t, v, d, evt: gr.EventData):
|
|
556 |
mask = mask[1:mask.shape[0]-1, 1:mask.shape[1]-1]
|
557 |
|
558 |
d["layers"][0][mask>0] = (255,255,255,255)
|
559 |
-
d["layers"][0][mask==0] = (0,0,0,0)
|
560 |
#d["background"][mask>0] = (255,255,255,255)
|
561 |
|
562 |
return gr.ImageEditor(value=d)
|
@@ -640,6 +640,7 @@ async(c, o, b, p, d, n, m)=>{
|
|
640 |
let mesh = q[i];
|
641 |
mesh.dispose(false, true);
|
642 |
}
|
|
|
643 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = o_.length-j;
|
644 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
|
645 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|
|
|
473 |
|
474 |
edge = []
|
475 |
mask = cv2.cvtColor(d["layers"][0], cv2.COLOR_RGBA2GRAY)
|
476 |
+
mask[mask<255] = 0
|
477 |
dilation = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (2 * b + 1, 2 * b + 1), (b, b))
|
478 |
mask = cv2.dilate(mask, dilation)
|
479 |
b = b*2+1
|
|
|
557 |
mask = mask[1:mask.shape[0]-1, 1:mask.shape[1]-1]
|
558 |
|
559 |
d["layers"][0][mask>0] = (255,255,255,255)
|
|
|
560 |
#d["background"][mask>0] = (255,255,255,255)
|
561 |
|
562 |
return gr.ImageEditor(value=d)
|
|
|
640 |
let mesh = q[i];
|
641 |
mesh.dispose(false, true);
|
642 |
}
|
643 |
+
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].material.needDepthPrePass = true;
|
644 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].alphaIndex = o_.length-j;
|
645 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].scaling.z = -1;
|
646 |
BABYLON.Engine.LastCreatedScene.meshes[BABYLON.Engine.LastCreatedScene.meshes.length-1].applyDisplacementMap(m[o_[j]].url, 0, 255, function(m){try{alert(BABYLON.Engine.Version);}catch(e){alert(e);}}, null, null, true, function(e){alert(e);});
|