Update app.py
Browse files
app.py
CHANGED
@@ -157,7 +157,7 @@ def remove_bg(fl, s, l, v, h):
|
|
157 |
frame_c = (frame.astype(np.int16)-bg_diff).astype(np.uint8)
|
158 |
|
159 |
|
160 |
-
hsv = cv2.cvtColor(
|
161 |
hue_s = np.zeros_like(hsv)
|
162 |
edges = cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), cv2.CV_64F)
|
163 |
blur_s = np.zeros_like(edges)
|
@@ -172,7 +172,8 @@ def remove_bg(fl, s, l, v, h):
|
|
172 |
print(np.max(hue_s))
|
173 |
print(np.min(hue_s))
|
174 |
#remove regions of low saturation and lightness (get scene without shadow)
|
175 |
-
|
|
|
176 |
m_ = cv2.inRange(hue_s, 0, h)
|
177 |
mask = cv2.inRange(blur_s, 0, v)
|
178 |
masks = np.bitwise_and(m, mask)
|
|
|
157 |
frame_c = (frame.astype(np.int16)-bg_diff).astype(np.uint8)
|
158 |
|
159 |
|
160 |
+
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
|
161 |
hue_s = np.zeros_like(hsv)
|
162 |
edges = cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY), cv2.CV_64F)
|
163 |
blur_s = np.zeros_like(edges)
|
|
|
172 |
print(np.max(hue_s))
|
173 |
print(np.min(hue_s))
|
174 |
#remove regions of low saturation and lightness (get scene without shadow)
|
175 |
+
hsv_ = cv2.cvtColor(frame_c, cv2.COLOR_BGR2HSV)
|
176 |
+
m = cv2.inRange(hsv_, np.array([0,0,0]), np.array([180,s,l]))
|
177 |
m_ = cv2.inRange(hue_s, 0, h)
|
178 |
mask = cv2.inRange(blur_s, 0, v)
|
179 |
masks = np.bitwise_and(m, mask)
|