Issue
I'm trying to compare some plate text with my DataFrame (my xlsx file) using Pandas. I've tried already to use image treatment and other precision improvement techniques, although there still some errors like switching I's with 1's or even l's.
What I'm trying to do is a similarity tester, like:
"If 6 of 7 letters are the same in the registered plate DataFrame, approve something."
[All the imported dependencies, like pandas, numpy, PyTesseract and etc.]
pos = 0 # Iloc pos in DataFrame
i = 0 # Char Position
ok_count = 0 # Counter
xlsx_path = "C\My Computer\Downloads\Python\Project.xlsx"
registered_plates = pd.read_excel(xlsx_path)
for plateR.iloc(pos) in registered_plates:
# if plate in dataframe == plate collected
if plateR[i] == plateC[i]
i += 1
ok_count += 1
# If count less than 6, iloc +1
if ok_count < 6:
pos += 1
i = 0
ok_count = 0
break
# The % formula
formula = (ok_count/((len(plateR.iloc(pos))*100)
value = f'{formula:5.2f}'
f_value = float(value)
# Normally, if 6 of 7, the value will become 85.28%
if f_value >= 80.00:
print("Minimum Value Acquired.", \n, "Sending Access Signal.")
# Send the similar plate in DataFrame
print("DataFrame Similar Plate: ", placasR.iloc(pos))
publish.single(...)
else:
print("Minimum Value Not Reached.", \n, "Try to read again.")
publish.single(...0)
Solution
I've reached an answer, hopefully this works most of the time. Use with wisdom.
pos = 0 # Plate or Text Position on DataFrame
digitpos = 0 # The digit position
counter = 0 # Same digit counter
plateC = plate_text # CollectedPlate/Text = Text in Code
while digitpos < 7: # While the digit position stay lower than 7
plateR = df.iloc[pos, 0] # RegisteredPlate or Text on DataFrame
lenghtDF = len(df["Column"].index)
if len(plateR) == len(plateC): # If they have the same lenght, runs the code, this works specifically for PlateRecog Systems
else:
break # or main() to run the code again
if plateR[digitpos] == plateC[digitpos]: #if they have the same digit in this position
digitpos += 1; counter += 1 +1 # Then go to the next digit and approve
else:
digitpos += 1 # Only go to the next
if (digitpos == 7) and (counter < 6): # Digit 7 and low approvals? Go to the next plate
pos += 1; counter = 0; digitpos = 0
if (digitpos == 7) and (counter >= 6): # Break the loop and approve
break
if pos > lenghtDF: # If the actual position on dataFrame is equal as the last position, then break.
break
Answered By - VicourtBitt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.