Files
Geniusia_v2/rpa_vision_v3/examples/example_ui_detection.py
2026-03-05 00:20:25 +01:00

99 lines
3.1 KiB
Python

()
main
n__": == "__maiif __name__")
70}\n(f"{'='*
print")vec succèsnée armi te Détectionint("")
pr"{'='*70}int(fpr
n")
_path}\é: {outputuvegard"✓ Sa print(f_path)
ions, outputge, detectctions(imaize_dete.visualor
detection...")isualisaton de la vnt(f"Créati
pried.png"stem}_detectge_path)."{Path(imant / fre).pah(image_path= Patput_path out
serali # Visu()
print ]}")
r'{det['centee: f" Centrint(
pr")['bbox']}on: {detPositi(f" print}")
dence']:.3f['confie: {detnfianct(f" Co prin)
'label']}"}. {det[{iint(f" pr1):
detections, te(ra enume in for i, det)
:\n" élémentsons)}cti(deteé {len\n✓ Trouv print(f"e)
lements(imagui_ect_tor.detens = detectioec detUI...")
nts des élémetionecDét"rint(
pnts UIélémecter les # Déte
êt\n")-v2 pr OWLint(")
prold=0.05threshdence_r(confitectowlDetor = Oetec")
d2...ion d'OWL-vInitialisat print("
tecteurle # Créer
e}\n")image.sizargée: { Image ch print(f"
age_path)open(ime.ag image = Im}")
{image_path: t de l'imagef"Chargemen print(
ger l'imagehar # C
n")='*70}\"{' print(f -v2")
UI avec OWLion ect" Détprint(f")
n{'='*70}int(f"\
prgv[1]
= sys.are_path imag else:
th
= test_path image_pa}")
_pathest créée: {tge de testint(f"✓ Ima pr
path)st_(teave img.sg"
reenshot.pn"test_ui_sc/ e__).parent th(__fil = Pa_pathst
te t)
5), font=fon255, 255, 25l=( text, fil), tyxt((tx,draw.te h) // 2
(y2 - y1 - ty = y1 + t - tw) // 2
(x2 - x1 x = x1 + t1]
3] - bbox[ = bbox[ th ]
[2] - bbox[0ox tw = bb
font=font) 0), text, bbox((0,w.textox = dra bb )
=2 width),50=(50, 50, tline=color, ou2, y2], fille([x1, y1, xglrectandraw. tons:
olor in butxt, cy2, te, x2, r x1, y1 fo
default()
nt.load_= ImageFo font :
ept exc, 20)
f"aVuSans.tte/dejavu/Dejruetyp/t/share/fonts("/usrtypeont.true ImageFont = f
y:tr
]
100)),100, 200, OK", ("00, 200, , 2, 15050 (),
100, 100), ", (255Cancel0, 100, "0, 40 (250, 5,
50, 255)), (100, 1t""Submi 200, 100,, 50, 50 (
uttons = [ bons
es boutiner quelqu # Dess
aw(img)
eDraw.Drraw = Imag)
d40, 240)240, 2r=(0), colo', (600, 40new('RGBImage. img =
geFontgeDraw, ImamaL import I from PItest
ne image de r u # Crée
)
st..."image de tetion d'une éarint("\nCr pe_path>")
magon.py <i_detectiexample_uithon3 sage: pynt("U pri) < 2:
gvsys.ar if len(ain():
r
def mwlDetectoimport Otector n.owl_deore.detectiofrom ct Image
L impor
from PIent))nt.parare_).pPath(__file_t(0, str(path.inserath
sys. parent au piree réperto
# Ajouter l
mport Pathhlib i
from patimport sys"""
shot.png
entest_screes/mpl.py exaectionet_ui_dpleam/exxamplesthon3 eple:
py
Exemth>paage_.py <imctionle_ui_detes/exampplethon3 exam
pye:
Usagvec OWL-v2
a'Éléments UIion détectoncret: D
Exemple C
"""python3/env #!/usr/bin