Hayk Arutyunyan commited on
Commit ·
c3db5ed
1
Parent(s): b80f680
Add print of sensors
Browse files- src/pipeline_hf.py +4 -2
src/pipeline_hf.py
CHANGED
|
@@ -31,18 +31,20 @@ def process_single_image(img: np.ndarray, color_ranges: dict):
|
|
| 31 |
mask = cur if mask is None else cv2.bitwise_or(mask, cur)
|
| 32 |
|
| 33 |
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
|
|
|
| 34 |
|
| 35 |
rois, positions = [], []
|
| 36 |
for cnt in contours:
|
| 37 |
x, y, ww, hh = cv2.boundingRect(cnt)
|
|
|
|
| 38 |
if ww < 90 or hh < 17:
|
| 39 |
continue
|
| 40 |
-
|
| 41 |
hh_clamped = min(hh, 17)
|
| 42 |
roi = img[y:y + hh_clamped, x:x + ww]
|
| 43 |
rois.append(roi)
|
| 44 |
positions.append((x, y, ww, hh))
|
| 45 |
-
print(rois) # для отладки
|
| 46 |
|
| 47 |
# ---------- 3. OCR сенсоров ----------
|
| 48 |
sensors = []
|
|
|
|
| 31 |
mask = cur if mask is None else cv2.bitwise_or(mask, cur)
|
| 32 |
|
| 33 |
contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 34 |
+
print("Contours found:", len(contours)) # для отладки
|
| 35 |
|
| 36 |
rois, positions = [], []
|
| 37 |
for cnt in contours:
|
| 38 |
x, y, ww, hh = cv2.boundingRect(cnt)
|
| 39 |
+
print("Contour bbox:", x, y, ww, hh) # для отладки
|
| 40 |
if ww < 90 or hh < 17:
|
| 41 |
continue
|
| 42 |
+
print("ROI accepted:", ww, hh) # для отладки
|
| 43 |
hh_clamped = min(hh, 17)
|
| 44 |
roi = img[y:y + hh_clamped, x:x + ww]
|
| 45 |
rois.append(roi)
|
| 46 |
positions.append((x, y, ww, hh))
|
| 47 |
+
print("ROIs after filtering:", len(rois)) # для отладки
|
| 48 |
|
| 49 |
# ---------- 3. OCR сенсоров ----------
|
| 50 |
sensors = []
|