LPR Data Classes
Last updated
Was this helpful?
Was this helpful?
# Analyze video to extract license plates
plates = tracker.find_plates_in_file("parking_lot.mp4")
# plates is Dict[int, PlateOCRResult] - maps track_id to plate data
for track_id, plate in plates.items():
print(f"Track {track_id}:")
print(f" Plate: {plate.plate_number}")
print(f" OCR Score: {plate.ocr_score:.3f}")result = recognizer.predict("car.jpg")
for plate in result.license_plates:
if plate.plate_number:
print(f"Plate: {plate.plate_number} (OCR: {plate.ocr_score:.2f})")
else:
print(f"Unreadable plate (detection: {plate.detection_score:.2f})")
# Access bounding box
x1, y1, x2, y2 = plate.bbox
print(f"Plate location: ({x1}, {y1}) to ({x2}, {y2})")for result in tracker.predict_batch(video_source):
# result.license_plates and result.results correspond at the same index
for i in range(len(result.license_plates)):
track_id = result.results[i].get("track_id")
plate = result.license_plates[i]
print(f"Track {track_id}: {plate.plate_number} (OCR: {plate.ocr_score:.2f})")for result in lpr.predict_batch(["car1.jpg", "car2.jpg"]):
for plate in result.license_plates:
# Pretty print using __str__
print(plate)Plate Number : ABC1234
OCR Score : 0.987
Detection Score : 0.952
Bounding box : [123, 456, 789, 234]