# Sumber: https://github.com/YukaLangbuana/KTP-OCR
# sudo apt install tesseract-ocr-ind
# ~/env/bin/pip install PyTesseract opencv-python
import sys
from cv2 import (
imread,
threshold,
THRESH_TRUNC,
)
from pytesseract import image_to_string
filename = sys.argv[1]
img = imread(filename)
th, threshed = threshold(img, 127, 255, THRESH_TRUNC)
s = image_to_string((threshed), lang='ind')
for line in s.splitlines():
print([line])