Skip to content

Commit

Permalink
set OMP_THREAD_LIMIT to 1
Browse files Browse the repository at this point in the history
default OMP_THREAD_LIMIT for tesseract is 4, reduce to 1 to handle parallelization by image rather than multiple per image
  • Loading branch information
trentshapiro committed Feb 11, 2023
1 parent 4d02a35 commit f574c0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cardfinder_multithreaded.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import re
import subprocess
from multiprocessing import Process, Queue
Expand Down Expand Up @@ -26,7 +27,6 @@ def process_text(text, replacement, verbose = False):
def img_to_string(queue, img):
text = pytesseract.image_to_string(
image=img,
lang='eng',
config='--psm 7',
)
text = process_text(text,'')
Expand Down Expand Up @@ -151,6 +151,9 @@ def draw_card_names(img, names_and_corners):


if __name__ == '__main__':
# Turn off inherent multithreading
os.environ['OMP_THREAD_LIMIT'] = '1'

coords = subprocess.Popen(
['python','external/select_bounding_box.py'],
stdout=subprocess.PIPE).communicate()[0]
Expand Down

0 comments on commit f574c0a

Please sign in to comment.