From 73a6625aab1310508358185eba448911428cebf4 Mon Sep 17 00:00:00 2001 From: Conner Vieira Date: Mon, 28 Oct 2024 15:48:43 -0400 Subject: [PATCH] Fixed an error when using OpenALPR --- alpr.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alpr.py b/alpr.py index 12b7efe..b8c9abf 100755 --- a/alpr.py +++ b/alpr.py @@ -169,14 +169,14 @@ def load_alpr_log(): def run_alpr(image_filepath): global config if (config["general"]["alpr"]["engine"] == "phantom"): # Check to see if the configuration indicates that the Phantom ALPR engine should be used. - analysis_command = "alpr -n " + str(config["general"]["alpr"]["validation"]["guesses"]) + " '" + image_filepath + "'" + analysis_command = "alpr -n " + str(config["general"]["alpr"]["validation"]["guesses"]) + " \"" + image_filepath + "\"" reading_output = str(os.popen(analysis_command).read()) # Run the command, and record the raw output string. reading_output = json.loads(reading_output) # Convert the JSON string from the command output to actual JSON data that Python can manipulate. if ("error" in reading_output): # Check to see if there were errors. print("Phantom ALPR encountered an error: " + reading_output["error"]) # Display the ALPR error. reading_output["results"] = [] # Set the results of the reading output to a blank placeholder list. elif (config["general"]["alpr"]["engine"] == "openalpr"): # Check to see if the configuration indicates that the OpenALPR engine should be used. - analysis_command = "alpr -j -n " + str(config["general"]["alpr"]["validation"]["guesses"]) + " " + config["general"]["working_directory"] + "/frames/" + frame # Set up the OpenALPR command. + analysis_command = "alpr -j -n " + str(config["general"]["alpr"]["validation"]["guesses"]) + " \"" + image_filepath + "\"" # Set up the OpenALPR command. reading_output = str(os.popen(analysis_command).read()) # Run the command, and record the raw output string. reading_output = json.loads(reading_output) # Convert the JSON string from the command output to actual JSON data that Python can manipulate. else: # If the configured ALPR engine is unknown, then return an error.