Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2324 Rigo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
niklaus.eggenber
2324 Rigo
Commits
02633056
Commit
02633056
authored
8 months ago
by
ivan.rigo
Browse files
Options
Downloads
Patches
Plain Diff
Working Writing
parent
a54f6b4b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
Tmp/box/1.txt
+28
-1
28 additions, 1 deletion
Tmp/box/1.txt
Tmp/box/2.txt
+29
-1
29 additions, 1 deletion
Tmp/box/2.txt
Tmp/box/3.txt
+43
-1
43 additions, 1 deletion
Tmp/box/3.txt
Tmp/box/4.txt
+11
-1
11 additions, 1 deletion
Tmp/box/4.txt
Tmp/fileConverter.py
+55
-34
55 additions, 34 deletions
Tmp/fileConverter.py
with
166 additions
and
38 deletions
Tmp/box/1.txt
+
28
−
1
View file @
02633056
Tmp
\ No newline at end of file
187,90,460,90,460,139,187,139 MIGROS
188,163,444,163,444,179,188,179 SOCIETE COOPERATIVE MIGROS GENDVE
260,182,375,182,375,199,260,199 N CORNAVIN GARE
253,203,391,203,391,219,253,219 TEL. 058 573 43 20
246,225,391,225,391,239,246,239 WWW. NIGROSGENEVE. CH
101,255,237,255,237,269,101,269 DÉSIGNATIOA C
118,254,535,254,535,270,118,270 SIGNATION ARTICLE QUANT. PRIX RABAIS TOTAL #
101,287,230,287,230,303,101,303 \IRAP POULET PANE
296,284,498,284,498,301,296,301 1 5 55
102,280,507,280,507,329,102,329 PON BAR ORIGINAL 1009 1 16S 2 ‘3
102,306,510,306,510,342,102,342 DOCE-COLA 501 IEEE (50 1150
104,353,529,353,529,396,104,396 TOTAL CHE ES £5
105,392,521,392,521,425,105,425 TWIN) QR AE
106,427,556,427,556,445,106,445 TOTAL EN EUR SE
107,446,450,446,450,477,107,477 OC! OO UN
210,462,256,462,256,518,210,518 NMIN
211,487,453,487,453,517,211,517 75.04 17:52
213,498,454,498,454,537,213,537 2 OY E00568176/308156/0000
425,548,457,548,457,564,425,564 9.65
379,576,535,576,535,620,379,620 CHE-105. 842. 900 “
380,612,417,612,417,628,380,628 TOTAL
199,673,486,673,486,700,199,700 H-CUNULUS VOTRE FIDÉLITE RÉCONPENSÉE
256,721,368,721,368,736,256,736 MERCI DE VOTRE
235,734,455,734,455,754,235,754 ET AU PLAISIR DE VOUS REVOIR
303,766,372,766,372,786,303,786 $65
225,855,459,855,459,907,225,907 ANOOOKANZZZS¥Z4SST0000
154,877,493,877,493,922,154,922 JLIALE UTILIS. ENP TICK. HEURE
154,891,519,891,519,943,154,943 PIED 0537999 282 0537 B. M. 2024 17:51:59
This diff is collapsed.
Click to expand it.
Tmp/box/2.txt
+
29
−
1
View file @
02633056
Tmp
\ No newline at end of file
216,104,426,104,426,138,216,138 TANIGAMI
217,145,263,145,263,156,217,156 RUE RO
235,147,427,147,427,175,235,175 : I SEAU 14. 1201 GENEVE
132,167,396,167,396,187,132,187 AE EL: 441 22 741 03 33
128,176,517,176,517,207,128,207 CHE-115.261.972 “OWT
445,187,486,187,486,199,445,199 NN 60
211,210,216,210,216,220,211,220 L
218,211,443,211,443,225,218,225 @ MERCREDI, 05 JUIN 2024 & 17:28:21
223,241,436,241,436,258,223,258 VOTRE TOTAL DE POINTS EST DE : 5936
133,280,207,280,207,293,133,293 QT ARTICLE
165,308,379,308,379,320,165,320 POKEMON - TERRARIUM - SÉRIE 13
166,326,432,326,432,342,166,342 ONE PIECE - TCG CARD - DRESSROSA (30)
167,346,442,346,442,364,167,364 ONE PIECE - TCG CARD - CAKE ISLAND (18)
168,367,448,367,448,386,168,386 ONE PIECE - TCG CARD - FISHERMAN'S ISLAN
140,388,426,388,426,408,140,408 1 ONE PIECE - TCG CARD - SKYPEA (36)
141,434,273,434,273,448,141,448 MONTANT TOTAL CHF
143,460,229,460,229,473,143,473 MONTANT T/A
143,504,178,504,178,516,143,516 TWINT
145,521,543,521,543,556,145,556 REMBOURSEMENT EN BON CADEAU, SOUS UN DÉLAI DE 7 JOURS
313,549,382,549,382,562,313,562 OUVRABLES.
309,555,531,555,531,580,309,580 CTION SONT NI REPRIS NI ECHANGES:
312,576,516,576,516,598,312,598 RUNE COMMANDE, NE SONT PAS
390,593,495,593,495,610,390,610 LATION DU CLIENT.
161,573,307,573,307,591,161,591 LES ARTICLES EN PROM
179,590,310,590,310,608,179,608 LES ACOMPTES POU
204,601,389,601,389,624,204,624 REMBOURSÉS EN CAS D'ANNUL
299,638,409,638,409,657,299,657 EMPLOYÉ : JOHANN
225,658,486,658,486,690,225,690 NOUS VOUS REMERCIONS DE VOTRE VISITE
264,696,449,696,449,722,264,722 ‘VANTAGES CARTE DE FIDELITÉ
This diff is collapsed.
Click to expand it.
Tmp/box/3.txt
+
43
−
1
View file @
02633056
Tmp
\ No newline at end of file
257,7,476,7,476,50,257,50 MANOR*
227,77,303,77,303,89,227,89 WIT. TRANOR CH
227,92,347,92,347,106,227,106 RUE SAINT-LAURENT 7
228,109,308,109,308,123,228,123 1002 LAUSANNE
227,126,308,126,308,139,227,139 021 321 36 99
458,163,464,163,464,170,458,170 I
457,171,469,171,469,182,457,182 FA
223,213,478,213,478,229,223,229 YOUS ÉTES SERVI LE: 28.05.2024 14:46
220,230,382,230,382,243,220,243 ‘A. ALBUQUERQUE DE OLIVEIRA
219,255,476,255,476,274,219,274 FIL A TRICOTER 2.55 A
232,276,292,276,292,287,232,287 40556080512
221,290,475,290,475,306,221,306 FAT DE TRAVAUX MANUELS 1.95 4
234,309,294,309,294,319,234,319 SB 581658
223,323,474,323,474,338,223,338 FIL DE TRAVAUX MANUELS 1,95 &
235,341,295,341,295,351,235,351 405081551885
224,355,474,355,474,369,224,369 FIL A TRICOTER 7.95 8
237,372,295,372,295,381,237,381 DOOSETSA00
225,387,473,387,473,399,225,399 FIL A TRICOTER 7.95 8
237,403,296,403,296,412,237,412 ‘OSSIGSAI6
225,418,472,418,472,430,225,430 CROCHET BOUCLE D'OREILLES 2.50 8
237,434,297,434,297,442,237,442 OSR771092836
225,449,472,449,472,460,225,460 FIL D'OREILLE 2.95
237,464,297,464,297,472,237,472 DOSRCRIOSEER2
213,504,459,504,459,531,213,531 TOTAL ARTICLE: 7 27.80
214,528,459,528,459,559,214,559 TWINT 21.80
222,566,458,566,458,578,222,578 TOTAL MOYENS DE PAIEMENT 27.80
225,603,465,603,465,624,225,624 SOLDE DE POINTS AVANT ACHAT ON
225,618,364,618,364,629,225,629 NOUVEAU SOLDE DE POINTS:
227,639,467,639,467,653,227,653 TWINT. XIXIOOG GORA] 183496 31503669
287,665,413,665,413,677,287,677 HERC! POUR VOTRE ACHAT
230,688,312,688,312,696,230,696 -16.261.650 TUR
230,699,401,699,401,708,230,708 ADE MONTANE TAU 8
219,709,400,709,400,719,219,719 JA 7780 WW
232,720,400,720,400,730,232,730 ANOR A SAS) IS
291,785,405,785,405,800,291,800 RETOUR AVEC EABAL LAGE
275,799,420,799,420,814,275,814 ORIGINE ET PREWE D-ACHAT
299,813,396,813,396,827,299,827 DNS TES 90 JOURS.
251,824,417,824,417,841,251,841 XCLUS DES PRETATION DOS ART
235,837,433,837,433,857,235,857 MH SERVI OT TH CAR TAS FEATTRUTS AC
254,851,462,851,462,870,254,870 ME VOUS DRE GTOLOF OK
259,864,463,864,463,885,259,885 = OH RABATS SUR VOTRE PROCHAIN AN
323,877,454,877,454,891,323,891 EN TOW, A
278,890,417,890,417,908,278,908 SEANNEZ OT ISTRIVER-VOUS;
This diff is collapsed.
Click to expand it.
Tmp/box/4.txt
+
11
−
1
View file @
02633056
Tmp
\ No newline at end of file
305,98,416,98,416,124,305,124 PRONTO
150,356,221,356,221,368,150,368 ‘SOUS-TOTAL
208,377,373,377,373,389,208,389 HT TVA, TE.
147,389,389,389,389,405,147,405 2,60 % 10,04 0,26 10,30
143,419,161,419,161,431,143,431 COA
144,433,289,433,289,446,144,446 CHE 060 TVA
314,449,382,449,382,460,314,460 GARE GMBH
237,449,266,449,266,461,237,461 HO MI
245,488,450,488,450,517,245,517 CHF 10,30
383,527,467,527,467,541,383,541 CHF 10,30
293,544,311,544,311,552,293,552 HE
This diff is collapsed.
Click to expand it.
Tmp/fileConverter.py
+
55
−
34
View file @
02633056
from
PIL
import
Image
import
pytesseract
from
pytesseract
import
Output
import
cv2
import
numpy
as
np
import
os
from
pathlib
import
Path
# Transforming image to string and printing it!
#img = cv2.imread("X00016469670.jpg")
img
=
cv2
.
imread
(
"
img/3.jpg
"
)
# get grayscale image
def
get_grayscale
(
image
):
...
...
@@ -39,35 +37,58 @@ def canny(image):
return
cv2
.
Canny
(
image
,
100
,
200
)
gray
=
get_grayscale
(
img
)
thresh
=
thresholding
(
gray
)
opend
=
opening
(
gray
)
end
=
closing
(
opend
)
def
write_box
(
filename
)
->
str
:
img
=
cv2
.
imread
(
filename
)
d
=
pytesseract
.
image_to_data
(
img
,
output_type
=
Output
.
DICT
)
n_boxes
=
len
(
d
[
'
level
'
])
res
=
""
z
=
""
(
x
,
y
,
w
,
h
)
=
(
0
,
0
,
0
,
0
)
for
i
in
range
(
n_boxes
):
if
d
[
'
conf
'
][
i
]
==
-
1
:
if
d
[
'
line_num
'
][
i
]
>
0
:
if
not
z
==
""
:
res
+=
z
+
"
\n
"
z
=
""
(
x
,
y
,
w
,
h
)
=
(
d
[
'
left
'
][
i
],
d
[
'
top
'
][
i
],
d
[
'
width
'
][
i
],
d
[
'
height
'
][
i
])
z
+=
str
(
x
)
+
"
,
"
+
str
(
y
)
+
"
,
"
+
str
(
x
+
w
)
+
"
,
"
+
str
(
y
)
+
"
,
"
+
str
(
x
+
w
)
+
"
,
"
+
str
(
y
+
h
)
\
+
"
,
"
+
str
(
x
)
+
"
,
"
+
str
(
y
+
h
)
cv2
.
rectangle
(
img
,
(
x
,
y
),
(
x
+
w
,
y
+
h
),
(
0
,
255
,
0
),
2
)
elif
d
[
'
conf
'
][
i
]
!=
-
1
:
if
not
str
(
d
[
'
text
'
][
i
]).
isspace
():
z
+=
"
"
+
str
(
d
[
"
text
"
][
i
]).
upper
()
else
:
z
=
""
return
res
#gray = get_grayscale(img)
#thresh = thresholding(gray)
#opend = opening(gray)
#end = closing(opend)
#faire closing
canny
=
canny
(
gray
)
#canny = canny(gray)
# Nom du dossier à ouvrir
dossier
=
'
img
'
# Obtenir le chemin absolu du dossier
chemin_dossier
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
dossier
)
# Vérifier si le dossier existe
if
os
.
path
.
exists
(
chemin_dossier
):
# Lire les noms de tous les fichiers dans le dossier
fichiers
=
os
.
listdir
(
chemin_dossier
)
# Afficher les noms des fichiers
for
fichier
in
fichiers
:
if
os
.
path
.
isfile
(
os
.
path
.
join
(
chemin_dossier
,
fichier
)):
fileName
=
os
.
path
.
splitext
(
fichier
)[
0
]
filePath
=
dossier
+
"
/
"
+
fichier
with
open
(
Path
(
"
entities
"
)
/
f
"
{
fileName
}
.txt
"
,
"
w+
"
,
encoding
=
"
utf8
"
)
as
file_entities
,
\
open
(
Path
(
"
box
"
)
/
f
"
{
fileName
}
.txt
"
,
"
w+
"
,
encoding
=
"
utf8
"
)
as
file_box
:
file_entities
.
write
(
'
{
\n\t
"
company
"
:
""
,
\n\t
"
date
"
:
""
,
\n\t
"
address
"
:
""
,
\n\t
"
total
"
:
""
\n
}
'
)
file_box
.
write
(
write_box
(
filePath
))
else
:
print
(
f
"
Le dossier
'
{
dossier
}
'
n
'
existe pas.
"
)
#expected_keys = ['level', 'page_num', 'block_num', 'par_num', 'line_num', 'word_num', 'left', 'top', 'width', 'height', 'conf', 'text']
d
=
pytesseract
.
image_to_data
(
img
,
output_type
=
Output
.
DICT
)
n_boxes
=
len
(
d
[
'
level
'
])
z
=
""
for
i
in
range
(
n_boxes
):
(
x
,
y
,
w
,
h
)
=
(
d
[
'
left
'
][
i
],
d
[
'
top
'
][
i
],
d
[
'
width
'
][
i
],
d
[
'
height
'
][
i
])
if
d
[
'
word_num
'
][
i
]
!=
0
:
z
+=
d
[
'
text
'
][
i
]
+
"
(
"
+
str
(
d
[
"
conf
"
][
i
])
+
"
)
"
cv2
.
rectangle
(
img
,
(
x
,
y
),
(
x
+
w
,
y
+
h
),
(
0
,
255
,
0
),
2
)
else
:
if
z
!=
""
:
print
(
z
)
z
=
""
#cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2
.
imshow
(
'
img
'
,
img
)
cv2
.
waitKey
(
0
)
#img2 = Image.open('X00016469670.jpg').convert('L')
#img2.show()
#print(pytesseract.image_to_data(img))
#print(pytesseract.image_to_string(img2))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment