Spaces:
Running
on
Zero
Running
on
Zero
Martin Tomov
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -151,11 +151,8 @@ def extract_and_paste_insect(original_image: np.ndarray, detection: DetectionRes
|
|
151 |
background[y_offset:y_end, x_offset:x_end] = insect
|
152 |
|
153 |
def create_yellow_background_with_insects(image: np.ndarray, detections: List[DetectionResult]) -> np.ndarray:
|
154 |
-
#
|
155 |
-
yellow_background =
|
156 |
-
# Convert the yellow background from RGB to BGR for OpenCV
|
157 |
-
yellow_background = cv2.cvtColor(yellow_background, cv2.COLOR_RGB2BGR)
|
158 |
-
|
159 |
for detection in detections:
|
160 |
if detection.mask is not None:
|
161 |
extract_and_paste_insect(image, detection, yellow_background)
|
|
|
151 |
background[y_offset:y_end, x_offset:x_end] = insect
|
152 |
|
153 |
def create_yellow_background_with_insects(image: np.ndarray, detections: List[DetectionResult]) -> np.ndarray:
|
154 |
+
yellow_background = np.full((image.shape[0], image.shape[1], 3), (0, 255, 255), dtype=np.uint8) # BGR for yellow in OpenCV
|
155 |
+
yellow_background[:] = (0, 255, 255) # Ensuring it's yellow
|
|
|
|
|
|
|
156 |
for detection in detections:
|
157 |
if detection.mask is not None:
|
158 |
extract_and_paste_insect(image, detection, yellow_background)
|