Spaces:
Runtime error
Runtime error
Commit
•
5049919
1
Parent(s):
1785d30
changed output image to rgb to see the contours
Browse files- detector.py +2 -2
detector.py
CHANGED
@@ -70,7 +70,7 @@ def find_bats(allImgs):
|
|
70 |
|
71 |
for img in allImgs:
|
72 |
blobs = cv.findContours(img[1], cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)[-2]
|
73 |
-
after = img[0].copy()
|
74 |
# Process the blobs
|
75 |
for blob in blobs:
|
76 |
if batDepthMin < cv.contourArea(blob) < batDepthMax: # Only process blobs with a min / max size
|
@@ -83,7 +83,7 @@ def find_bats(allImgs):
|
|
83 |
p_not_bat=f"{probs[0]:.4f}"
|
84 |
p_bat=f"{probs[1]:.4f}"
|
85 |
if p_not_bat < '0.9' and p_bat > '0.5':
|
86 |
-
cv.drawContours(after, [box], 0, (0,0
|
87 |
total_bats += 1
|
88 |
allImgAfter.append(after)
|
89 |
|
|
|
70 |
|
71 |
for img in allImgs:
|
72 |
blobs = cv.findContours(img[1], cv.RETR_LIST, cv.CHAIN_APPROX_SIMPLE)[-2]
|
73 |
+
after = cv.cvtColor(img[0].copy(), cv.COLOR_GRAY2RGB)
|
74 |
# Process the blobs
|
75 |
for blob in blobs:
|
76 |
if batDepthMin < cv.contourArea(blob) < batDepthMax: # Only process blobs with a min / max size
|
|
|
83 |
p_not_bat=f"{probs[0]:.4f}"
|
84 |
p_bat=f"{probs[1]:.4f}"
|
85 |
if p_not_bat < '0.9' and p_bat > '0.5':
|
86 |
+
cv.drawContours(after, [box], 0, (255,0,0),1)
|
87 |
total_bats += 1
|
88 |
allImgAfter.append(after)
|
89 |
|