face_recognition.py

# هذا العمل مرخص بموجب ترخيص MIT.
# حقوق النشر (c) 2013-2023 OpenMV LLC. جميع الحقوق محفوظة.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# التعرف على الوجه باستخدام واصفات LBP.
# راجع ورقة Timo Ahonen بعنوان "Face Recognition with Local Binary Patterns".
#
# قبل تشغيل المثال:
# 1) قم بتنزيل قاعدة بيانات وجوه AT&T من http://www.cl.cam.ac.uk/Research/DTG/attarchive/pub/data/att_faces.zip
# 2) قم باستخراج مجلد orl_faces ونسخه إلى جذر بطاقة SD.
#
# ملاحظة: هذا مجرد تطبيق أولي (PoC) للورقة البحثية المذكورة أعلاه، ولا يعمل بشكل جيد في ظروف الحياة الواقعية.

import image

SUB = "s2"
NUM_SUBJECTS = 5
NUM_SUBJECTS_IMGS = 10

img = image.Image("orl_faces/%s/1.pgm" % (SUB)).mask_ellipse()
d0 = img.find_lbp(roi=(0, 0, img.width(), img.height()))
img = None

print("")
for s in range(1, NUM_SUBJECTS + 1):
    dist = 0
    for i in range(2, NUM_SUBJECTS_IMGS + 1):
        img = image.Image("orl_faces/s%d/%d.pgm" % (s, i)).mask_ellipse()
        d1 = img.find_lbp(roi=(0, 0, img.width(), img.height()))
        dist += image.match_descriptor(d0, d1)
    print("Average dist for subject %d: %d" % (s, dist / NUM_SUBJECTS_IMGS))

results matching ""

    No results matching ""