Upload livro.py
Browse files
livro.py
CHANGED
@@ -20,8 +20,13 @@ def detectar_pontos(imagem_array, mascara_array=None, idade=6):
|
|
20 |
gray = cv2.cvtColor(imagem_array, cv2.COLOR_BGR2GRAY)
|
21 |
_, thresh = cv2.threshold(gray, 200, 255, cv2.THRESH_BINARY_INV)
|
22 |
|
23 |
-
if mascara_array is not None:
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
_, mask_thresh = cv2.threshold(mask, 10, 255, cv2.THRESH_BINARY)
|
26 |
thresh = cv2.bitwise_and(thresh, mask_thresh)
|
27 |
|
|
|
20 |
gray = cv2.cvtColor(imagem_array, cv2.COLOR_BGR2GRAY)
|
21 |
_, thresh = cv2.threshold(gray, 200, 255, cv2.THRESH_BINARY_INV)
|
22 |
|
23 |
+
if mascara_array is not None and isinstance(mascara_array, np.ndarray):
|
24 |
+
try:
|
25 |
+
mask = cv2.cvtColor(mascara_array, cv2.COLOR_BGR2GRAY)
|
26 |
+
_, mask_thresh = cv2.threshold(mask, 10, 255, cv2.THRESH_BINARY)
|
27 |
+
thresh = cv2.bitwise_and(thresh, mask_thresh)
|
28 |
+
except Exception as e:
|
29 |
+
print("Erro ao processar máscara:", e)
|
30 |
_, mask_thresh = cv2.threshold(mask, 10, 255, cv2.THRESH_BINARY)
|
31 |
thresh = cv2.bitwise_and(thresh, mask_thresh)
|
32 |
|