refs # Скрипт для вырезания VIN из СТС.
Some checks failed
Build/Publish Develop Docs / deploy (push) Has been cancelled

This commit is contained in:
2025-07-22 19:27:36 +03:00
parent 644c61e9fe
commit 671c5085e9

View File

@@ -41,13 +41,16 @@ def auto_rotate_image(image):
ocr = PaddleOCR(lang='en', use_textline_orientation=True)
# Загрузка изображения
image = cv2.imread("scripts/sts.jpg")
image = cv2.imread("scripts/image.jpg")
# Автоматическое выравнивание
aligned_image = auto_rotate_image(image)
# aligned_image = auto_rotate_image(image)
aligned_image = image
# Распознавание текста
result = ocr.predict(aligned_image)
result = ocr.predict(image)
output_image = result[0]["doc_preprocessor_res"]["output_img"]
cv2.imwrite('scripts/output_image.jpg', output_image)
# Поиск VIN
vin_pattern = re.compile(r'^[A-HJ-NPR-Z0-9]{17}$')
@@ -70,12 +73,12 @@ if found_vin:
x_max, y_max = bbox[2], bbox[3]
# Добавление запаса вокруг области
vin_region = aligned_image[
vin_region = output_image[
y_min:y_max,
x_min:x_max
]
cv2.imwrite('scripts/vin_rotated_corrected.jpg', vin_region)
cv2.imwrite('scripts/vin.jpg', vin_region)
print(f"VIN найден: {found_vin}")
else:
print("VIN не обнаружен после выравнивания")