Skip to main content

get the landmars,positions,features for reconition of the face in the image

Project description

Info

ldm.py 2018-05-25

Author: Zhao Mingming <471106585@qq.com>

Copyright: This module has been placed in the public domain.

version:0.1.0 - add compare2dir

version:0.1.1 - add face_rec_ms version:0.1.3 - add compare2imglist

Classes: - LDM: you can use a function to get landmarks and face feature with no other libs

Functions:

  • face_feature: the feature of face in the image for face recognition

  • landmarks: get the landmarks and face in the image

  • face_rec: return the face similarity of the face in two images

  • has_same_person: return a int(>0) if there have a same person in two images,otherwise 0

  • compare2dir: compare the face in the images of the two dirs,and return the rate ,score_avg,class_id1,class_id2

  • compare2imglist: compare the face in the imglist ,and return the rate ,score_avg,class_id1,class_id2

How To Use This Module

funny cat picture
  1. example code:

imagepath="closed_eye/9.jfif"
img=io.imread(imagepath)
img1=img
imagepath="closed_eye/14.jfif"
img2=io.imread(imagepath)

ldmer=ldm.LDM()
print img.shape[0]
ldl,facel,txt=ldmer.landmarks(img)
print txt

for ld in ldl:
    print 10*'-'
    print 'nose:'
    print ld['nose']
for face in facel:
    print 10*'-'
    print 'face:'
    print face.top()
    print face.left()
    print face.width()
    print face.height()
    print face.bottom()
    print face.right()
    x,y,w,h=[face.top(),face.left(),face.width(),face.height()]
    print x,y,w,h
print "feature:"
ffl=ldmer.face_feature(img,facel)
for ff in ffl:
    print help(ff)
    print 'ff='+str(ff)
    print 'len(ff)='+str(len(ff))
    print 'ff[0]='+str(ff[0])
    print 'ff[127]='+str(ff[127])

print "face compare:"
print ldmer.face_rec(img1,img2)
print ldmer.has_same_person(img1,img2)
print ldmer.has_same_person(img2,img2)

print "face number:"
print ldmer.face_number(img,facel)

Refresh

add a function : ldmer.imread(imgpath) modify the return value number to: has_flag,max_score=ldmer.has_same_person(img1,img2)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ldm-0.1.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distributions

ldm-0.1.3-py2.7.egg (11.9 kB view details)

Uploaded Source

ldm-0.1.3-py2-none-any.whl (7.8 kB view details)

Uploaded Python 2

File details

Details for the file ldm-0.1.3.tar.gz.

File metadata

  • Download URL: ldm-0.1.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.4.5

File hashes

Hashes for ldm-0.1.3.tar.gz
Algorithm Hash digest
SHA256 65969b847a3f0c5d0038fd811768b308bafde4d632c03ee81cc8ac9dc8583334
MD5 1b224bda3914232bc247f62962e8f4d5
BLAKE2b-256 940e5b3f37208189540ffc4648a841543393de7bd1451fcaaf21ede40b4e580c

See more details on using hashes here.

File details

Details for the file ldm-0.1.3-py2.7.egg.

File metadata

  • Download URL: ldm-0.1.3-py2.7.egg
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.4.5

File hashes

Hashes for ldm-0.1.3-py2.7.egg
Algorithm Hash digest
SHA256 02fdb035b3c2ef55fe1a08071ed3222c8d66e08a155a244d1420b604e757a458
MD5 1e2313189a2a3d94f4d4c42a1fb0d927
BLAKE2b-256 83f2d1d4101133442eb51da066a5b2c1cd379f663a330a429409d98688e3e3f8

See more details on using hashes here.

File details

Details for the file ldm-0.1.3-py2-none-any.whl.

File metadata

  • Download URL: ldm-0.1.3-py2-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.4.5

File hashes

Hashes for ldm-0.1.3-py2-none-any.whl
Algorithm Hash digest
SHA256 21eda2f2b22f851207a541cf51ef93cdd2adc060d07b4a1d260edbaf0be9ae9b
MD5 7f72e1dcbc5a3c2b4db3e31c7eea24b1
BLAKE2b-256 20b5d43cac57883122588bf3d3e0a39f6cbe0c0ad8144fdd3bf61c6f2c21f863

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page