Skip to content

Commit

Permalink
fixocr
Browse files Browse the repository at this point in the history
  • Loading branch information
jeonghoonkang committed Nov 10, 2024
1 parent 805197d commit 46d6543
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions apps/camera/ocr_name_card/run_ocr_name_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import time
import argparse
import easyocr
import pytesseract
import pytesseract # check out language pack for tesseract
# tesseract --list-langs # dir: /usr/local/share/tessdata
# https://cjsal95.tistory.com/25
import inspect

def recursive_search_dir(_nowDir, _filelist): # 재귀적으로 디렉토리 탐색

Expand Down Expand Up @@ -123,10 +126,12 @@ def ocr():


def test_func(file):
print(inspect.getfile(pytesseract))

oem = 3
psm = 11
#custom_config = '--oem' + str(oem) + '--psm' + str(psm)
custom_config = '--oem' + str(oem) + '--psm' + str(psm) + '--preserve_interword_spaces 1'
psm = 4
custom_config = ' --oem ' + str(oem) + ' --psm ' + str(psm)
#custom_config = ' --oem ' + str(oem) + ' --psm ' + str(psm) + ' -c --preserve_interword_spaces=1 '
namecard_img = cv2.imread(file)
gray = cv2.cvtColor(namecard_img, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 3)
Expand Down

0 comments on commit 46d6543

Please sign in to comment.