Spaces:
Paused
Paused
Update android.py
Browse files- android.py +6 -3
android.py
CHANGED
|
@@ -81,7 +81,10 @@ class AndroidEditor:
|
|
| 81 |
|
| 82 |
split_idx = self.find_text_position(text_list, "路", group_idx)
|
| 83 |
if split_idx is None:
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
| 85 |
split_position = self.get_position_data(extracted_data, split_idx)
|
| 86 |
|
| 87 |
member_idx = self.find_text_position(text_list, "anggota", group_idx)
|
|
@@ -119,7 +122,7 @@ class AndroidEditor:
|
|
| 119 |
for position in [group_position, split_position, member_position, member_count_position,
|
| 120 |
second_member_position, second_member_count_position]:
|
| 121 |
if position:
|
| 122 |
-
margin_horizontal =
|
| 123 |
cv2.rectangle(
|
| 124 |
image,
|
| 125 |
(position['left'] - margin_horizontal, position['top']),
|
|
@@ -216,7 +219,7 @@ class AndroidEditor:
|
|
| 216 |
|
| 217 |
draw.text((text_x, text_y), updated_second_member_count, font=font, fill=text_color)
|
| 218 |
image = cv2.cvtColor(np.array(image_pil), cv2.COLOR_RGB2BGR)
|
| 219 |
-
|
| 220 |
if show_preview:
|
| 221 |
cv2.imshow('Preview (Tekan q untuk keluar)', image)
|
| 222 |
while True:
|
|
|
|
| 81 |
|
| 82 |
split_idx = self.find_text_position(text_list, "路", group_idx)
|
| 83 |
if split_idx is None:
|
| 84 |
+
for i in range(group_idx, min(group_idx + 4, len(text_list))):
|
| 85 |
+
if "-" in text_list[i]:
|
| 86 |
+
split_idx = i
|
| 87 |
+
break
|
| 88 |
split_position = self.get_position_data(extracted_data, split_idx)
|
| 89 |
|
| 90 |
member_idx = self.find_text_position(text_list, "anggota", group_idx)
|
|
|
|
| 122 |
for position in [group_position, split_position, member_position, member_count_position,
|
| 123 |
second_member_position, second_member_count_position]:
|
| 124 |
if position:
|
| 125 |
+
margin_horizontal = 10
|
| 126 |
cv2.rectangle(
|
| 127 |
image,
|
| 128 |
(position['left'] - margin_horizontal, position['top']),
|
|
|
|
| 219 |
|
| 220 |
draw.text((text_x, text_y), updated_second_member_count, font=font, fill=text_color)
|
| 221 |
image = cv2.cvtColor(np.array(image_pil), cv2.COLOR_RGB2BGR)
|
| 222 |
+
cv2.imwrite('output.png', image)
|
| 223 |
if show_preview:
|
| 224 |
cv2.imshow('Preview (Tekan q untuk keluar)', image)
|
| 225 |
while True:
|