Update app.py
Browse files
app.py
CHANGED
|
@@ -159,12 +159,15 @@ def remove_bg(fl):
|
|
| 159 |
|
| 160 |
edges = cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), cv2.CV_64F)
|
| 161 |
blur_s = np.zeros_like(edges)
|
|
|
|
| 162 |
for i in range(2, frame.shape[0]-2):
|
| 163 |
for j in range(2, frame.shape[1]-2):
|
| 164 |
d = edges[i-2:i+2,j-2:j+2].var()
|
| 165 |
blur_s[i,j] = d.astype(np.uint8)
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
| 168 |
#remove regions of low saturation and lightness (get scene without shadow)
|
| 169 |
m = cv2.inRange(cv2.cvtColor(frame_c, cv2.COLOR_RGB2HSV), np.array([0,0,0]), np.array([180,32,64]))
|
| 170 |
mask = cv2.inRange(blur_s, 0, 127)
|
|
|
|
| 159 |
|
| 160 |
edges = cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), cv2.CV_64F)
|
| 161 |
blur_s = np.zeros_like(edges)
|
| 162 |
+
blur_ = np.zeros_like(edges)
|
| 163 |
for i in range(2, frame.shape[0]-2):
|
| 164 |
for j in range(2, frame.shape[1]-2):
|
| 165 |
d = edges[i-2:i+2,j-2:j+2].var()
|
| 166 |
blur_s[i,j] = d.astype(np.uint8)
|
| 167 |
+
blur_[i,j] = d
|
| 168 |
+
|
| 169 |
+
print(np.max(blur_))
|
| 170 |
+
print(np.min(blur_))
|
| 171 |
#remove regions of low saturation and lightness (get scene without shadow)
|
| 172 |
m = cv2.inRange(cv2.cvtColor(frame_c, cv2.COLOR_RGB2HSV), np.array([0,0,0]), np.array([180,32,64]))
|
| 173 |
mask = cv2.inRange(blur_s, 0, 127)
|