def plates_hl_processing(raw_image, processed_image, image_details,
                         detection_results):
    """High-level function for russian number plates processing"""
    _, detected_plates = detection_results[0]

    for x, y, width, height in detected_plates:
        cv2.rectangle(raw_image, (x, y), (x + width, y + height), (0, 0, 255),
                      2)
    save_to_output_directory(raw_image)
Ejemplo n.º 2
0
def lumbers_hl_processing(raw_image, processed_image, image_details,
                          detection_results):
    """High-level function for lumbers volume processing"""
    _, lumbers_area = image_details[0]
    lumbers_length = 20
    lumbers_volume = lumbers_length * lumbers_area
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(raw_image, f"Lumbers volume: {lumbers_volume} m2", (10, 30),
                font, 1, (255, 255, 255), 2, cv2.LINE_AA)
    save_to_output_directory(raw_image)
Ejemplo n.º 3
0
def faces_hl_processing(raw_image, processed_image, image_details, detection_results):
    """High-level function for human faces processing"""
    _, detected_faces = detection_results[0]

    for face, eyes in detected_faces:
        x, y, width, height = face
        cv2.rectangle(raw_image, (x, y), (x + width, y + height), (0, 0, 255), 2)

        if eyes is not None:
            face_area = raw_image[y:y + height, x:x + width]
            for eye_x, eye_y, eye_width, eye_height in eyes:
                cv2.rectangle(face_area, (eye_x, eye_y), (eye_x + eye_width, eye_y + eye_height), (255, 255, 255), 2)
    save_to_output_directory(raw_image)
Ejemplo n.º 4
0
def barcodes_hl_processing(raw_image, processed_image, image_details, detection_results):
    """High-level function for barcodes processing"""
    _, barcode_box = image_details[0]
    cv2.drawContours(raw_image, [barcode_box], -1, (0, 255, 0), 3)
    save_to_output_directory(raw_image)
def sample_hl_processing(raw_image, processed_image, image_details,
                         detected_elements_descriptions):
    """Sample of high-level processing function"""
    save_to_output_directory(processed_image)