91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

分別在樹莓派和MAC中跑人臉識別代碼(分三個階段,采集,訓練,識別),識別效果還可以。

資源截圖

代碼片段和文件信息

‘‘‘‘
Capture?multiple?Faces?from?multiple?users?to?be?stored?on?a?Database?(dataset?directory)
==>?Faces?will?be?stored?on?a?directory:?dataset/?(if?does?not?exist?pls?create?one)
==>?Each?face?will?have?a?unique?numeric?integer?ID?as?1?2?3?etc???????????????????????

based?on?original?code?by?Anirban?Kar:?https://github.com/thecodacus/Face-Recognition????

Developed?by?Marcelo?Rovai?-?MJRoBot.org?@?21Feb18????

‘‘‘

import?cv2
import?os

cam?=?cv2.VideoCapture(0)
#cam.set(3?640)????#?set?video?width
#cam.set(4?480)????#?set?video?height

face_detector?=?cv2.CascadeClassifier(‘haarcascade_frontalface_alt2.xml‘)

color?=?(0?255?0)

#?For?each?person?enter?one?numeric?face?id
face_id?=?input(‘\n?Please?enter?user?id?end?press??==>??‘)

print(“\n?[INFO]?Initializing?face?capture.?Look?the?camera?and?wait?...“)
#?Initialize?individual?sampling?face?count
count?=?0

#Start?looping
while(True):
????
????ret?img?=?cam.read()
????
????#img?=?cv2.flip(img?-1)??#?flip?video?image?vertically
????
????#?convert?frame?to?grayscale
????gray?=?cv2.cvtColor(img?cv2.COLOR_BGR2GRAY)
????#?Using?the?classifier?to?detect?the?number?of?face?matrices?in?the?grayscale?image?1.3?indicates?the?scaling?ratio?and?5?indicates?the?number?of?valid?points?to?be?detected.
????
????#?Detect?frames?of?different?sizes?list?of?faces?rectangles
????faces?=?face_detector.detectMultiScale(gray?1.3?5)
????
????#?Loops?for?each?faces
????for?(xywh)?in?faces:
????????
????????#?Specify?the?size?of?the?rectangle?and?the?thickness?of?the?rectangle?border
????????cv2.rectangle(img?(xy)?(x+wy+h)?(25500)?2)?#?Crop?the?image?frame?into?rectangle
????????
????????#?Increment?sample?face?image
????????count?+=?1
????????
????????font?=?cv2.FONT_HERSHEY_SIMPLEX
????????cv2.putText(img‘count:%d‘?%?(count)(x+30?y+30)?font?1?(2550255)4)

????????#?Save?the?captured?image?into?the?datasets?folder
????????cv2.imwrite(“dataset/User.“?+?str(face_id)?+?‘.‘?+?str(count)?+?“.jpg“?gray[y:y+hx:x+w])
?
????????#?Display?the?video?frame?into?the?dataset?folder
????????cv2.imshow(‘image‘?img)

????#?To?stop?taking?video?Press?‘ESC‘?for?exiting?video
????k?=?cv2.waitKey(100)?&?0xff
????if?k?==?27:
????????break
????#?If?image?taken?reach?100?stop?taking?video?
????elif?count?>=?500:?#?Take?30?face?sample?and?stop?video
????????break



#?Do?a?bit?of?cleanup
print(“\n?[INFO]?Exiting?Program?and?cleanup?stuff“)
cam.release()
cv2.destroyAllWindows()



?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2202??2019-01-24?14:56??face_training.py
?????目錄???????????0??2019-03-12?16:27??__MACOSX\
?????文件?????????273??2019-01-24?14:56??__MACOSX\._face_training.py
?????文件??????540616??2019-01-08?19:27??haarcascade_frontalface_alt2.xml
?????文件?????????212??2019-01-08?19:27??__MACOSX\._haarcascade_frontalface_alt2.xml
?????文件????????2477??2019-03-12?09:07??face_dataset.py
?????文件?????????176??2019-03-12?09:07??__MACOSX\._face_dataset.py
?????文件??????930127??2018-02-23?11:52??haarcascade_frontalface_default.xml
?????目錄???????????0??2019-01-14?20:27??trainer\
?????文件????????6148??2019-01-14?20:17??trainer\.DS_Store
?????目錄???????????0??2019-03-12?16:27??__MACOSX\trainer\
?????文件?????????120??2019-01-14?20:17??__MACOSX\trainer\._.DS_Store
?????文件???240860526??2019-03-11?09:34??trainer\trainer.yml
?????文件????????2744??2019-02-15?14:17??face_recognition.py
?????文件?????????176??2019-02-15?14:17??__MACOSX\._face_recognition.py

評論

共有 條評論