Build a Face Detection App in Python (OpenCV)
![]() |
2 - Create a new file
3 - Write the code:
import cv2
face_cascade = cv2.CascadeClassifier('venv/Lib/site-packages/cv2/data/haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('venv/Lib/site-packages/cv2/data/haarcascade_eye.xml')
img = cv2.imread('images/face3.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x, y, w, h) in faces:
img = cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
roi_gray = gray[y:y + h, x:x + w]
roi_color = img[y:y + h, x:x + w]
eyes = eye_cascade.detectMultiScale(roi_gray)
for (ex, ey, ew, eh) in eyes:
cv2.rectangle(roi_color, (ex, ey), (ex + ew, ey + eh), (0, 255, 0), 2)
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
4 - Full Video:
can you make for indentify current face while using camera
ReplyDeleteI am glad that I saw this post. It is informative blog for us and we need this type of blog thanks for share this blog, Keep posting such instructional blogs and I am looking forward for your future posts. Python Projects for Students Data analytics is the study of dissecting crude data so as to make decisions about that data. Data analytics advances and procedures are generally utilized in business ventures to empower associations to settle on progressively Python Training in Chennai educated business choices. In the present worldwide commercial center, it isn't sufficient to assemble data and do the math; you should realize how to apply that data to genuine situations such that will affect conduct. In the program you will initially gain proficiency with the specialized skills, including R and Python dialects most usually utilized in data analytics programming and usage; Python Training in Chennai at that point center around the commonsense application, in view of genuine business issues in a scope of industry segments, for example, wellbeing, promoting and account. Project Center in Chennai
DeleteI haven't started to investigate the genuine degree of AI in this article, however perhaps I've aroused your advantage. artificial intelligence course
ReplyDeletei have this problem when run code
ReplyDeleteC:\Users\user\PycharmProjects\Face_Recognition\venv\Scripts\python.exe C:/Users/user/PycharmProjects/Face_Recognition/Face_Rec_OpenCV.py
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/Face_Recognition/Face_Rec_OpenCV.py", line 16, in
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'
The content that I normally go through nowadays is not at all in parallel to what you have written. It has concurrently raised many questions that most readers have not yet considered.
ReplyDeleteData Science training in Mumbai
Data Science course in Mumbai
SAP training in Mumbai
Thanks for the efforts in writing the wonderful article.
ReplyDeletejava interview questions and answers
selenium interview questions and answers
digital marketing interview questions and answers
hadoop interview questions and answers
oracle interview questions
data science interview questions and answers
Incredible post! It is so helpful for me and I appreciated for this innovative thing...
ReplyDeleteFull Stack Developer Course in Chennai
Full Stack Developer Course in Pune
Full Stack Developer Course in Hyderabad
Full Stack Developer Course in Gurgaon
Mean Stack Training in Chennai
Mean Stack Course in Chennai
Aivivu - đại lý chuyên vé máy bay trong nước và quốc tế
ReplyDeletevé máy bay đi Mỹ
cách đăng ký chuyến bay từ mỹ về việt nam
vé máy bay nhật bản về việt nam
mua ve may bay gia re tu duc ve viet nam
vé máy bay từ canada về việt nam bao nhiêu tiền
vé máy bay từ hàn quốc về việt nam
khách sạn cách ly tại hà nội
seo fiyatları
ReplyDeletesaç ekimi
dedektör
instagram takipçi satın al
ankara evden eve nakliyat
fantezi iç giyim
sosyal medya yönetimi
mobil ödeme bozdurma
kripto para nasıl alınır
instagram beğeni satın al
ReplyDeleteyurtdışı kargo
seo fiyatları
saç ekimi
dedektör
fantazi iç giyim
sosyal medya yönetimi
farmasi üyelik
mobil ödeme bozdurma
bitcoin nasıl alınır
ReplyDeletetiktok jeton hilesi
youtube abone satın al
gate io güvenilir mi
referans kimliği nedir
tiktok takipçi satın al
bitcoin nasıl alınır
mobil ödeme bozdurma
mobil ödeme bozdurma
TÜL PERDE MODELLERİ
ReplyDeletesms onay
Mobil odeme bozdurma
nft nasıl alınır
ANKARA EVDEN EVE NAKLİYAT
Trafik sigortasi
DEDEKTOR
Web sitesi kurma
Ask kitaplari
Good content. You write beautiful things.
ReplyDeletevbet
korsan taksi
taksi
hacklink
sportsbet
mrbahis
hacklink
vbet
sportsbet
Success Write content success. Thanks.
ReplyDeletekralbet
deneme bonusu
betpark
kıbrıs bahis siteleri
betturkey
canlı slot siteleri
canlı poker siteleri
Önemli giriş adreslerine buradan ulaşabilirsiniz.
ReplyDeletebetturkey giriş
betpark giriş
0BM2XN