Python Forum
Compare several strings and output average
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compare several strings and output average
#1
Hello Forum :)

this is my first post in the forum and my first day with python.
Searched the internet for my problem but could not find a good solution so i thought i try my luck with you.

Situation:
I experimented a little bit with OCR in python3 and it works pretty well with pytesser.
Since the text in the image has multiple colors, I basically create 6 copies of the image with different color channel setups.
So three images have just one channel (red, green or blue) and three images have two channels (red/green, red/blue or blue/green). This results in 6 different strings extracted from the images with slight variations.

Question:
Is there a good way to compare these 6 strings not necessarily line by line but in a more dynamic way? Some images miss some wordwraps or whole lines.
Maybe even with a way to weigh certain results in certain situations more than others? I.e: The no-green-image captures text no other image does, but is still right, even if it is the outlier.

Thanks for your help
Reply
#2
See difflib

I've used it only once so I can't help you with an example. I forgot everything.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
found an image contrast and gamma setup that gave sufficient enough results so i have no more need for a string comparison. but thank you very much anyway :)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 757 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 1,757 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Can't compare two strings uriel 2 1,656 Dec-04-2021, 05:39 AM
Last Post: uriel
  print function output wrong with strings. mposwal 5 3,107 Feb-12-2021, 09:04 AM
Last Post: DPaul
  How to compare strings that have spaces hobbyist 2 1,732 Jan-14-2021, 12:44 PM
Last Post: perfringo
  compare output with dict anna 0 1,813 Aug-16-2019, 09:16 AM
Last Post: anna
  Finding multiple strings between the two same strings Slither 1 2,511 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  Trouble adding LONG strings to an array or CSV output hariskr 1 2,199 Aug-02-2018, 11:29 PM
Last Post: woooee
  lists, strings, and byte strings Skaperen 2 4,214 Mar-02-2018, 02:12 AM
Last Post: Skaperen
  Keyword compare in two files and output the results kotigasp 2 2,839 Jan-23-2018, 08:13 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020