diff --git a/hmi/scripts/qr_code_decoder b/hmi/scripts/qr_code_decoder index 94702da..8dbe421 100755 --- a/hmi/scripts/qr_code_decoder +++ b/hmi/scripts/qr_code_decoder @@ -24,13 +24,10 @@ def validate_image(qr_image: ndarray, qr_code_rect: tuple, threshold_percentage: x, y, w, h = qr_code_rect # Coordinates of the bounding box around the QR code # Calculate the area of the QR code - qr_code_area = w * h - - # Calculate the total area of the image - total_image_area = qr_image.shape[0] * qr_image.shape[1] + qr_code_area: int = w * h # Calculate the percentage of the screen occupied by the QR code - qr_code_percentage = (qr_code_area / total_image_area) * 100 + qr_code_percentage = (qr_code_area / qr_image.size) * 100 # Check if the QR code occupies at least threshold_percentage of the screen if qr_code_percentage >= threshold_percentage: