{"id":20178006,"url":"https://github.com/sefakcmn00/documentation-scanner-opencv","last_synced_at":"2026-05-13T04:08:54.933Z","repository":{"id":53119666,"uuid":"520921889","full_name":"sefakcmn00/Documentation-Scanner-Opencv","owner":"sefakcmn00","description":"It is the documentation scanner project of our Computer Vision work with Opencv. In this project, documents shown to the computer camera were scanned using Opencv artificial intelligence libraries. Below I tried to explain the details of the project step by step.","archived":false,"fork":false,"pushed_at":"2022-08-07T13:31:21.000Z","size":499,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T16:48:03.629Z","etag":null,"topics":["computervision","documantation","opencv","opencv-python","python3","scanner"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sefakcmn00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T14:48:54.000Z","updated_at":"2022-10-27T10:54:13.000Z","dependencies_parsed_at":"2022-09-11T10:40:16.719Z","dependency_job_id":null,"html_url":"https://github.com/sefakcmn00/Documentation-Scanner-Opencv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefakcmn00%2FDocumentation-Scanner-Opencv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefakcmn00%2FDocumentation-Scanner-Opencv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefakcmn00%2FDocumentation-Scanner-Opencv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sefakcmn00%2FDocumentation-Scanner-Opencv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sefakcmn00","download_url":"https://codeload.github.com/sefakcmn00/Documentation-Scanner-Opencv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241612847,"owners_count":19990897,"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":["computervision","documantation","opencv","opencv-python","python3","scanner"],"created_at":"2024-11-14T02:18:38.270Z","updated_at":"2026-05-13T04:08:54.904Z","avatar_url":"https://github.com/sefakcmn00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Documentation-Scanner-Opencv\n-----------------------------------------------\nIt is the documentation scanner project of our Computer Vision work with Opencv. In this project, documents shown to the computer camera were scanned using Opencv artificial intelligence libraries. Below I tried to explain the details of the project step by step.\n\n\n## Documantation-Sacnner-Opencv\n\nFirst, we will download the libraries we will use.\n```Python\nimport cv2\nimport numpy as np\nimport utlis\n\n```\n\n### Camera Options\n\n```Python\nwebCamFeed = True\ncap = cv2.VideoCapture(1)\ncap.set(10, 160)\nheightImg = 640\nwidthImg = 480\n```\nWe add the necessary lines of code to start our webcam in the operations here.\nIf you do not want to operate with the webcam, you can also scan any document image into the program. (pathImage = \"image name\".\nWe have defined #camera screen widths above.\n```Python\nutlis.initializeTrackbars()\ncount = 0\n```\n```Python\nwhile True:\n\n    if webCamFeed:\n        success, img = cap.read()\n    else:\n        img = cv2.imread(pathImage)\n    img = cv2.resize(img, (widthImg, heightImg))  #GÖRÜNTÜYÜ YENİDEN BOYUTLANDIRMA AMACIYLA EKLEDİĞİMİZ KOD.\n    imgBlank = np.zeros((heightImg, widthImg, 3), np.uint8)  # GEREKİRSE HATA AYIKLAMANIN TEST EDİLMESİ İÇİN BOŞ BİR GÖRÜNTÜ OLUŞTURMAK AMACIYLA EKLEDİĞİMİZ KOD.\n    imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)  # GÖRÜNTÜYÜ GRİ ÖLÇEKLE DÖNÜŞTÜRMEK AMACIYLA GİRİLEN KOD.\n    imgBlur = cv2.GaussianBlur(imgGray, (5, 5), 1)  # GAUSS BLUR EKLEMEK AMACIYLA GİRİLEN KOD.\n    thres = utlis.valTrackbars()  # EŞİKLER İÇİN İZLEME ÇUBUĞU DEĞERLERİNİ ALMAK AMACIYLA GİRİLEN KOD.\n    imgThreshold = cv2.Canny(imgBlur, thres[0], thres[1])  # CANNY BLUR UYGULAYIN\n    kernel = np.ones((5, 5))\n    imgDial = cv2.dilate(imgThreshold, kernel, iterations=2)  # GENİŞLETME UYGULAMASI.\n    imgThreshold = cv2.erode(imgDial, kernel, iterations=1)  # EROZYON UYGULAMASI.\n\n```\n```Python\n####################################  CONTOUR İŞLEMLERİ  #################################################################\n    ## TÜM CONTOUR'LARI BULMAK AMACIYLA AŞAĞIDAKİ KOD SATIRLARINI EKLİYORUZ.\n    ###\n    #CONTOUR Nedir? Konturlar, aynı renk veya yoğunluğa sahip tüm sürekli noktaları (sınır boyunca) birleştiren bir eğri olarak basitçe açıklanabilir.\n    #Konturlar, şekil analizi ve nesne algılama ve tanıma için kullanışlı bir araçtır.\n    ###\n    imgContours = img.copy()  # GÖRÜNTÜ AMAÇLI KOPYALAMA\n    imgBigContour = img.copy()  # GÖRÜNTÜ AMAÇLI KOPYALAMA\n    contours, hierarchy = cv2.findContours(imgThreshold, cv2.RETR_EXTERNAL,\n                                           cv2.CHAIN_APPROX_SIMPLE)  # TÜM KONTURLARI BUL\n    cv2.drawContours(imgContours, contours, -1, (0, 255, 0), 10)  # TESPİT EDİLEN TÜM KONTURLARI ÇİZİM\n```\n```Python\n # EN BÜYÜK COUNTOUR'U BULMA\n    biggest, maxArea = utlis.biggestContour(contours)\n    if biggest.size != 0:\n        biggest = utlis.reorder(biggest)\n        cv2.drawContours(imgBigContour, biggest, -1, (0, 255, 0), 20)  # EN BÜYÜK KONTUR\n        imgBigContour = utlis.drawRectangle(imgBigContour, biggest, 2)\n        pts1 = np.float32(biggest)  # ÇÖZGÜ İÇİN NOKTALARI HAZIRLA\n        pts2 = np.float32([[0, 0], [widthImg, 0], [0, heightImg], [widthImg, heightImg]])  # ÇÖZGÜ İÇİN NOKTALARI HAZIRLA\n        matrix = cv2.getPerspectiveTransform(pts1, pts2)\n        imgWarpColored = cv2.warpPerspective(img, matrix, (widthImg, heightImg)) #warp perspektif yani görünütü çarpıtma işlemleri\n\n        # HER TARAFTAN 20 PİKSEL FORMUNU KALDIR\n        imgWarpColored = imgWarpColored[20:imgWarpColored.shape[0] - 20, 20:imgWarpColored.shape[1] - 20]\n        imgWarpColored = cv2.resize(imgWarpColored, (widthImg, heightImg))\n\n        # UYARLANABİLİR EŞİK UYGULAMA\n        imgWarpGray = cv2.cvtColor(imgWarpColored, cv2.COLOR_BGR2GRAY)\n        imgAdaptiveThre = cv2.adaptiveThreshold(imgWarpGray, 255, 1, 1, 7, 2)\n        imgAdaptiveThre = cv2.bitwise_not(imgAdaptiveThre)\n        imgAdaptiveThre = cv2.medianBlur(imgAdaptiveThre, 3)\n\n        # Görüntüleme için Görüntü Dizisi\n        imageArray = ([img, imgGray, imgThreshold, imgContours],\n                      [imgBigContour, imgWarpColored, imgWarpGray, imgAdaptiveThre])\n\n    else:\n        imageArray = ([img, imgGray, imgThreshold, imgContours],\n                      [imgBlank, imgBlank, imgBlank, imgBlank])\n\n    # EKRAN ETİKETLERİ\n    lables = [[\"Orijinal\", \"Gri\", \"Esik\", \"Contours\"],\n              [\"En buyuk Contour\", \"Warp Perspektif\", \"Warp Gri\", \"Uyarlanabilir Esik\"]]\n\n    stackedImage = utlis.stackImages(imageArray, 0.75, lables)\n    cv2.imshow(\"Program\", stackedImage)\n```\n# Program Output\n\n![myimage0](https://user-images.githubusercontent.com/67556543/182640541-1ebc36e9-c126-4195-9740-50f52b355301.jpg)\n\n![myimage2](https://user-images.githubusercontent.com/67556543/182640564-73061e56-0853-407d-8981-de62a9e7f996.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsefakcmn00%2Fdocumentation-scanner-opencv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsefakcmn00%2Fdocumentation-scanner-opencv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsefakcmn00%2Fdocumentation-scanner-opencv/lists"}