{"id":19219289,"url":"https://github.com/phpdevsr/ocr-ktp","last_synced_at":"2026-03-14T16:47:04.384Z","repository":{"id":239517695,"uuid":"797675856","full_name":"PHPDevsr/OCR-KTP","owner":"PHPDevsr","description":"OCR IDENTITY CARD (INDONESIAN ONLY)","archived":false,"fork":false,"pushed_at":"2024-05-14T07:31:12.000Z","size":23260,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-19T07:42:23.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPDevsr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-08T09:52:59.000Z","updated_at":"2024-05-15T05:14:55.000Z","dependencies_parsed_at":"2024-11-09T14:32:39.713Z","dependency_job_id":"e6858c49-3777-41e3-81f4-c2b53311b1ce","html_url":"https://github.com/PHPDevsr/OCR-KTP","commit_stats":null,"previous_names":["phpdevsr/ocr-ktp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPDevsr%2FOCR-KTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPDevsr%2FOCR-KTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPDevsr%2FOCR-KTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPDevsr%2FOCR-KTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPDevsr","download_url":"https://codeload.github.com/PHPDevsr/OCR-KTP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243234027,"owners_count":20258383,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T14:30:19.204Z","updated_at":"2025-12-26T16:54:35.704Z","avatar_url":"https://github.com/PHPDevsr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OCR-KTP\nThis project aims to create an API that can scan and convert important data (NIK, Name, Place and Date of Birth) from a KTP image into text using PyTesseract Optical Character Recognition (OCR). In addition there is also a deep learning (YOLO) based KTP detector that can automatically crop the KTP image to improve OCR's ability to read text on images (this feature is still very imperfect and requires further development). Thanks to the developers who have developed most of the contents of this system before.\n\n## Prerequisites\n* Flask\n```\npip install flask\n```\n* Numpy\n```\npip install numpy\n```\n* OpenCV\n```\npip install opencv-python\n```\n* Pandas\n```\npip install pandas\n```\n* PIL\n```\npip install pillow\n```\n* PyTesseract\n```\nsudo apt-get install tesseract-ocr\nsudo apt-get install tesseract-ocr-ind\npip install pytesseract\n```\n* TextDistance\n```\npip install textdistance\n```\n\n## Running the Program\nCreate virtual environment:\n\n```sh\npython -m venv env\n```\n\nRun virtual environment (for Windows user):\n\n```sh\nenv\\Scripts\\activate.bat\n```\n\nRun virtual environment (for Unix user):\n\n```sh\nsource ./env/bin/activate\n```\n\nTo run the program, use the command below:\n```\nexport FLASK_APP=app\nflask run\n```\nor alternatively using this command:\n```\npython app.py\n```\n\n### Request Parameter\nParameter | Data Type | Mandatory | Notes\n--- | --- | :---: | ---\nimage | Image Files | M | Foto KTP\n\n### Response Parameter\n\nParameter | Description\n--- | ---\nnik | NIK dari hasil OCR\nnama | Nama dari hasil OCR\ntempat_lahir | Nama tempat lahir dari hasil OCR\ntgl_lahir | Tanggal lahir dari hasil OCR (DD-MM-YYYY)\ntime_elapsed | Waktu yang pemrosesan yang dibutuhkan (detik)\n\n### Success Response Example\n```\n{\n    \"error\": false,\n    \"message\": \"Proses OCR Berhasil\",\n    \"result\": {\n        \"nik\": \"1234567890123456\",\n        \"nama\": \"DENNY SEPTIAN\",\n        \"tempat_lahir\": \"JAKARTA\",\n        \"tgl_lahir\": \"10-10-1999\",\n        \"jenis_kelamin\": \"LAKI-LAKI\",\n        \"agama\": \"ISLAM\",\n        \"status_perkawinan\": \"BELUM KAWIN\",\n        \"pekerjaan\": \"PELAJAR/MAHASISWA\",\n        \"kewarganegaraan\": \"WNI\",\n        \"alamat\": {\n            \"name\": \"DUSUN 1 OGAN 5\",\n            \"rt_rw\": \"001/002\",\n            \"kel_desa\": \"SUNGAI ARE\",\n            \"kecamatan\": \"ALANG-ALANG LEBAR\",\n            \"kabupaten\": \"OGAN ILIR\",\n            \"provinsi\": \"SUMATERA SELATAN\"\n        },\n        \"time_elapsed\": \"6.306\"\n    }\n}\n```\n\n### Notes for KTP Detection using CNN\n1. Create new folder, data/cnn\n2. Run the program\n\n## Acknowledgments\n* https://github.com/enningxie/KTP-OCR\n* https://github.com/jeffreyevan/OCR","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevsr%2Focr-ktp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpdevsr%2Focr-ktp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevsr%2Focr-ktp/lists"}