Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
O
OcrForArabicRecherche
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AYOUB ABOUNAMER
OcrForArabicRecherche
Commits
1b99323d
Commit
1b99323d
authored
Apr 13, 2022
by
AYOUB ABOUNAMER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
48958ebe
Pipeline
#195
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
188 additions
and
0 deletions
+188
-0
tesseractocr.ipynb
tesseractocr.ipynb
+188
-0
No files found.
tesseractocr.ipynb
0 → 100644
View file @
1b99323d
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "8fcc83e8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: pytesseract in c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages (0.3.9)\n",
"Requirement already satisfied: packaging>=21.3 in c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages (from pytesseract) (21.3)\n",
"Requirement already satisfied: Pillow>=8.0.0 in c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages (from pytesseract) (8.2.0)\n",
"Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages (from packaging>=21.3->pytesseract) (3.0.4)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution -illow (c:\\users\\pc\\anaconda3\\envs\\opencv\\lib\\site-packages)\n"
]
}
],
"source": [
"!pip install pytesseract"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "f267166e",
"metadata": {},
"outputs": [],
"source": [
"import pytesseract\n",
"import os\n",
"import cv2\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "16cba855",
"metadata": {},
"outputs": [],
"source": [
"#il faut installer tesseract apres entrer dans le dossier tessdata et chercher si il y a \n",
"#le fichier ara.traineddata pour l arabe s'il existe pas il faut l'installer puis configurer la variable d'environnement\n",
"pytesseract.pytesseract.tesseract_cmd = r\"C:\\Program Files\\Tesseract-OCR\\tesseract.exe\""
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c869837e",
"metadata": {},
"outputs": [],
"source": [
"image = cv2.imread(\"sa.png\")\n",
"#convertir to greyscale"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "74f0ac70",
"metadata": {},
"outputs": [],
"source": [
"gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "d4bd6d8a",
"metadata": {},
"outputs": [],
"source": [
"text=pytesseract.image_to_string(image,lang=\"ara\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "e82c3c53",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"منذ ظهور طبعة معجم بر وكلان الثانية في عام 1478 6 أصبح\n",
"مل ممتازة » مقتبسة من النصوص ذاتها وعلى نحو يكاد يكون تاماً في كل ما له صلة باللصوص\n",
"لغاية ذلك التاريخ . فضلاً عن ان صاحب المعجم يعتبر مرجماً وحجة في\n",
"\n",
"لدى دارسي اللغة السريانية اداة\n",
"المنشورة\n",
"جميع الأبواب الختصة بمصدر\n",
"\n",
"الكلبات واشتقاقها » كا ان سعة اطلاعه وحصافته معترف بهما في مجالي التحريك وضبط الكتاية (الاملاء).\n",
"\n",
"غير انه ليس من الميسور المبتدثين او لتلامذة الا كليريكيات أن يقفوا على أكنوز مصنف نم »\n",
"مكتوب باللاتينية ومعتمد على الاشارات الاصطلاحية وستند احياناً في تيبه الابجدي الى مصدر خفي .\n",
"فهذا ما حدانا على وضع معجم مختصر » من النوع المدرسي » آملين ان يجدوا فيه ما هم بحاجة اليه 6\n",
"\n",
"مم مراعاة الامانة قدر المستطاع .\n",
"\n",
"حلايب مع التوتر الآخر الذي تثيره\n",
"اتهامات مصر للسودان بدعم\n",
"الجماعات المتطرفة. وقد ذكرت الدوائر\n",
"الرسمية في القاهرة\n",
"\n",
"و ن سلطات الامن الصرية\n",
"\n",
"ارعابية أو متطرفة من الدول المجاورة\n",
"بعد ضبط شبكة تضم عناصر سودائية\n",
"وايرانية وا\n",
"\n",
"ومن المتوقع ان تعلن النيابة العامة\n",
"في مصر خلال ايام تفاصيل\n",
"التحقيقات التي تجريها مع اعضاء\n",
"الشبكة البالغ عددهم 17 متهما. وقد\n",
"اعتقلت اجهزة الامن الصرية مساء\n",
"امس الاول 14 من اعضاء الجماعات\n",
"المتطرفة في مد؛ بعد صدامهم مع\n",
"قوات الأمن بأرمنت يوم الاربعاء\n",
"\n",
"ورق معد إعدادا خاصا تطبع عليه الصور في غشاء\n",
"يمكن ثقله إلى سطح آخر 1 يكن ستطاعا إدالة و\n",
"ماكينات الطبم + مثل الخشب أو الزجاج أو الخرف\n",
"أو الآلات . لتحضيرة ؛ يغمس ورق ذو سام في محلول\n",
"من النشا والزلال والجلسرين ؛ وتطبع عليه الصور بعد\n",
"جفافه» ثم يطبع عدة مرات بالخبر الأبيض غير\n",
"الشفاف» ثم يطلى الوجه المطبوع بطبقة من الغراء\n",
"القايل للذوبان في الماء . وعنديا يبل الورق ويلصق\n",
"على السطح المطلوب النقل اليه » تنزع الورقة البللة\n",
"ويثبت الطبع على ذلك السطح . وتطبع الصور المنقوا\n",
"إلى الأوانى الخزفية بأحبار معدنية, ثم تدخل في\n",
"الأفران لى تصمد بعد ذلك للغسل بالماء الساخن\n",
"\n",
"\n"
]
}
],
"source": [
"print(text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fbb19039",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment