for those who are having errors, I found out that when downloading the Haar Cascades through the link, sometimes it saves the file(s) as HTML (not XML). make sure it is NOT saved as HTML. check the first line of the file. originally I saved the link by using web browser, it saved it as HTML. then I just clone the link through git command. got everything (in another directory though, just copy them). it works. I hope it helps. this is a cool video tutorial. love it.
Hey, Harrison! Your channel is the Python: The Definitive guide on the internet. Literally everything I am not sure about, I can find the answer in one of your videos! Yesterday I found out I will need to learn some OpenCV for one of my projects. I came straight to Sentdex and bingo! How come you still don't have 100K subscribers? I don't get it. :) Thanks for sharing your knowledge!
Hello! I'm from Brazil and I just finishing the course of computer engineering and this video helped me a lot to complete my project, thank you! I'll subscribe to your channel
listen... you're the best at it... I really want to learn image analysis and I'm sure none is gonna explain better than you... but in this tutorial you missed to explain some part of the program like you usually do in your other tutorial... in fact in some part I'm really getting lost...
sentdex you're prob not going to read this but we have to do a project in university where we need to something with augmented reality so we stumbeld upon your video, and as it turns out the guy you're using the haar cascades from is our professor who's guiding/grading our project :D
your face detection code works perfectly and i was wondering if you are planning to make a face recognition tutorial any time soon or at all. Oh and u r awesome!!!
if you are having problems add. incase you're cascade is on a different location import os os.chdir("C:/Users/cariaga/Documents/haarcascades") on top right before face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
hi, i am trying to run this code and i got this error, Traceback (most recent call last): File "C:\Users\Lenovo\Desktop\camerapro.py", line 13, in faces = face_cascade.detectMultiScale(gray, 1.3, 5) error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\objdetect\src\cascadedetect.cpp:1634: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale Do you know what is the problem?
Can you help me with this? Traceback (most recent call last): File "C:/Users/Marcone/Desktop/Marcone/ex001.py", line 12, in gray = cv2.cvtColor(img, cv2.COLOR_BRG2GRAY) AttributeError: module 'cv2.cv2' has no attribute 'COLOR_BRG2GRAY'
Just in case anyone has problems the cascades; use this code instead: face_Cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_alt.xml")
Sounds like perhaps the file wasn't found? Ensure the .xml is saved in the same directory as your script, with case sensitive naming. It is possible to call it from another directory but I generally find it's one less possible problem on small scales like this to just put it all in the same bowl and eat with a big spoon I guess you could say. No need to dig for each file we are using.
Teach how make identification of the user. I saw a video of u about it... and I did not understand much... I'm Brazilian and study English hehehe.. but I like so much of u job!! Congratulations!! I wait your answer.
Hello Sentdex, i had been following your videos on NLP and CV and they are awesome. was looking for help. What is the solution for the faces which are recorded from side angle. Any other algorithm or parameter tuning. I tried many so far.
Hey sir! I've been working on a project for the blind people and yea your tutorials is just great! can i have some personal attention of yours please? i really understand the way you teach.
Hi sentdex, Thank you so much for this! Is there a way to do the same type of object recognition in a list of images rather than from a video feed? Thanks!
Thanks for the tutorial it was great. I was wondering if I'm using raspberry pi camera module, will cap = cv2.VideoCapture(0) work? Sorry I'm still a beginner and want to detect cars using haar cascade.
Suggesting a modification. Because we are using the ROI of face to detect the eyes within that ROI, when the lower half of the face is out of frame, the eye will never get detected.
Nice video tutorial. I was hoping if you could give an advise a new method on how to detect rules of thirds on a photograph using OpenCV? Thanks in advance.
Hi, I have done plant detection using ur method it worked well. Now I'm trying to do bottle detection But it doesn't recognise bottles Can u help me with taking the best suitable data set for it, i have tried many possible ways but didn't get results.
Hey Sentdex, I have been working on a project for detecting traffic signs and I was wondering how many negatives and positives will suffice? Any source for getting the negatives?
I m 3D Artist working as a Level designer, I m really new to coding and have only a bit knowledge on C# which I tried to learn once working in Unity3D. I just wanna make an app for both mobile and desktop-like lensKart or other latest selfie camera App like tracking face and placing goggles or some object in it. Kindly Let me know where should I start when this tutorial helps. Because I have some confussion like what camera you using to recognise any special or general Webcam while u testing and First most thing the software that which I need to develop my need. Thanks in advance.
Thanks for the video, amazing! My question is why did you apply faces to the gray image? why not to the color img? why did we do the cvtcolor to gray? Thanks
@@naghechebilal7269 Colored images have 3 channels (R,G,B), gray images only have one. Using gray images makes the problem easier and the computation faster.
hi, i have an understanding problem with this code. with the following code: for (ex, ey, ew, eh) in eyes: cv2.rectangle(roi_color, (ex, ey), (ex + ew, ey+eh),(0,255,0),2) with this code we draw every eye(s) detected on the roi_color, since the first parameter is the image we draw our rectangle on. At the end we say cv2.imshow("img", img). Now with which line do we say draw the eyes on this img that we later show?? Great video and greedings from germany
Hello, this video was very helpful and it works great, but I'd just like to ask you if there is any possible way to detect when you close your eyes. I'm trying to write a sleep detection program that sends a signal to the user when he is falling asleep, and I've been having an issue when trying to detect when the eye is closed. Thank you
Thanks for your wonderful videos! I have one question: why convert img to gray? I change faces = face_cascade.detectMultiScale(gray) to faces = face_cascade.detectMultiScale(img), still work. So, I think we don't need convert. Am I right?
Hi, Thank you for your wonderful work. What would be the "BEST" camera to get for this type of projects? Is it the more resolution the better? What do you recommend under $45
Haarcascades are hard! Haar haar haar. Anyways, would it be possible to go from tracking the eye to where the is pupil within the eye (like what you did with going from tracking the face to tracking eyes within the face)? If so, is it then possible to pull out information on where the gaze is? I was thinking if you can get the position of the pupil, it may be possible to calibrate that information to a screen position and have something of a rough eye tracker without $30,000 of research software and hardware. Anyways, great video!
+Jake Rember Great question. It would seem to me, logically, that you could indeed do this to track gaze. I'd personally detect the eye region, then detect the center of the pupil region. From there, assuming your eye center and pupil centers were indeed correct, you could draw a line between them and continue out to get the gaze.
+sentdex I was thinking about how you would clean up the data from this as well. I was thinking maybe add in a statement which evaluated a certain amount of deviance per frame and would ignore anything outside of that threshold. That way, if you calibrated/started with the eyes and face, and assuming the person was not moving too fast, one could decrease the jitter of the face and eyes in the video feed. It is all pretty exciting to me, once I have time, I think I may take a crack at trying to make a simple eye tracker and see if valid data can be gathered from it. Like say, mapping where a person is looking to a location on a screen. It would be very convenient for looking at the effectiveness of an application or webpage! It could also be a great tutorial (nudge, nudge :p). Thank you for your reply!
nice tutorial. How would you write a text('face_detected') on the screen when face is detected. Under 1st forloop, i tried like (if w>0): then cv2.putText....., but didn't work. Any suggestions?
We are using stretch and VNC viewer, our videos are having very low frame rates and has about 3 seconds latency, will remote desktop reduce the latency
you are such a big help to my final project
Great! Best wishes on your project.
what class whats that project for?
Plz tell me about your final project
"Morbidity aside, you aren't going to find eyes outside your face." - you made my day sir
for those who are having errors, I found out that when downloading the Haar Cascades through the link, sometimes it saves the file(s) as HTML (not XML). make sure it is NOT saved as HTML. check the first line of the file.
originally I saved the link by using web browser, it saved it as HTML. then I just clone the link through git command. got everything (in another directory though, just copy them). it works. I hope it helps. this is a cool video tutorial. love it.
The entire series up to this point was worth it for the Haar pun.
I mean, it's been extremely helpful, too, but the puns really make it. :)
Hey, Harrison! Your channel is the Python: The Definitive guide on the internet. Literally everything I am not sure about, I can find the answer in one of your videos! Yesterday I found out I will need to learn some OpenCV for one of my projects. I came straight to Sentdex and bingo! How come you still don't have 100K subscribers? I don't get it. :)
Thanks for sharing your knowledge!
+Soundscrap Glad to hear you are enjoying the tutorials! I enjoy doing them. Maybe 100K subs some time in 2016 :P
Hello! I'm from Brazil and I just finishing the course of computer engineering and this video helped me a lot to complete my project, thank you! I'll subscribe to your channel
That was SO FAST! Usuall these tutorials take hours, I got it up and running in 5 minutes! Thank you!
@maryam I've never used spyder IDE. But I think you could modify the code to work on a video instead of webcam
@Maryam Ashraf ruclips.net/video/HjCuISHb9WE/видео.html Does this help?
To avoid mouth being considered as eye we can consider ROI as just upper 70% of the face ,Therefore :
roi = frame[ y:int((y+h)*0.7) , x:x+w ]
roi_gray = gray[y:y-int((y + h) * 0.7), x:x + w]
roi_color = img[y:y-int((y + h) * 0.7), x:x + w]
right way to do it
@@shailendrapandit440 Thanks sir.
@@shailendrapandit440 what does these two lines mean?? Even the tutor didnt explain about it..so pls do help @takeTech @Shoeb Moin
@@sonalisahoo5170 It means you're grabbing from y to the 70% of the height and from X to X + W (width). It's a little bit complicated to explain
Great videos. I watch all the time, just want to tell you I appreciate that you cover advanced (for me at least) and useful topics.
"If you laughed, I appreciate it"... hahah, love this tutorials!
your channel is heavenly! everything is just awesome!!
Thanks!
Love your way of teaching😘😘
you're so intelligent and funny man, thanks for the videos
listen... you're the best at it... I really want to learn image analysis and I'm sure none is gonna explain better than you... but in this tutorial you missed to explain some part of the program like you usually do in your other tutorial... in fact in some part I'm really getting lost...
Just ran my first face detection program.Thanks a lot !
Woo!
Thank you sir! You are very helpful and generous in sharing your codes with others :)
sentdex you're prob not going to read this but we have to do a project in university where we need to something with augmented reality so we stumbeld upon your video, and as it turns out the guy you're using the haar cascades from is our professor who's guiding/grading our project :D
Haha, small world :)
i love you, you saved my final project of the degree
your face detection code works perfectly and i was wondering if you are planning to make a face recognition tutorial any time soon or at all. Oh and u r awesome!!!
you are really awesome, i am learning a lot from your videos. keep it up. thanks for sharing your knowledge.
if you are having problems add. incase you're cascade is on a different location
import os
os.chdir("C:/Users/cariaga/Documents/haarcascades")
on top
right before
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
dude you're such an inspiration !
I can't laugh because i still dont know how hard will be create my cascades!
Amazing work, btw!
Thank You!!
Your tutorials are very helpful :) waiting for the next video as it is going to help me a lot :) :)
Thanks Bro you saved me i used your code from your page and its working fine.
hi, i am trying to run this code and i got this error,
Traceback (most recent call last):
File "C:\Users\Lenovo\Desktop\camerapro.py", line 13, in
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\objdetect\src\cascadedetect.cpp:1634: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale
Do you know what is the problem?
thanks for your video tutorial so finally my project is done
Did you use the same haar cascade files from the link of 3 years ago?
just subbed...I am so going to binge watch your videos tonight :P
+divadbate Thanks for joining us!
how to enhance this detection into recognition. i.e., displaying the name of the person after detecting the face(on bounding box).
Maybe convolutional neural network?
Can you help me with this?
Traceback (most recent call last):
File "C:/Users/Marcone/Desktop/Marcone/ex001.py", line 12, in
gray = cv2.cvtColor(img, cv2.COLOR_BRG2GRAY)
AttributeError: module 'cv2.cv2' has no attribute 'COLOR_BRG2GRAY'
CH4pI3 it's BGR2GRAY and not BRG2GRAY
Just in case anyone has problems the cascades; use this code instead:
face_Cascade = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_alt.xml")
thank bro
Really helpful tutorial.
keep up the good work.
Great tutorial👍
Love your bad taste in humor :D thx for the vid bro!
Your videos are amazing ..
thank you so much for you videos!!! They are easy to follow and helped me a lot! I'm so happy that my face detector is working hahah
Happy to share!
That is epic,dude.Thank you for your this informative videos
Amazing tutorial! Loved it.
U R amazing
i can now track objects from my drone
Pure gold!!! THANK YOU!
Can you do something on Neural Evolution in python?
it is very helpful for my assignment.. Thanx Buddy
Hi, got this error<
any help :(
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
TypeError: 'str' object is not callable
Sounds like perhaps the file wasn't found? Ensure the .xml is saved in the same directory as your script, with case sensitive naming. It is possible to call it from another directory but I generally find it's one less possible problem on small scales like this to just put it all in the same bowl and eat with a big spoon I guess you could say. No need to dig for each file we are using.
Hi , can you code with JES?
now its working thanks guys
great tutorial
Such a great video.
Do you have an Idea why I'm only seeing frames instead of a video?
very nice tutorial...thanks
Teach how make identification of the user. I saw a video of u about it... and I did not understand much... I'm Brazilian and study English hehehe.. but I like so much of u job!! Congratulations!! I wait your answer.
Hello Sentdex, i had been following your videos on NLP and CV and they are awesome. was looking for help. What is the solution for the faces which are recorded from side angle. Any other algorithm or parameter tuning. I tried many so far.
Hey sir!
I've been working on a project for the blind people and yea your tutorials is just great! can i have some personal attention of yours please?
i really understand the way you teach.
Hi sentdex,
Thank you so much for this! Is there a way to do the same type of object recognition in a list of images rather than from a video feed?
Thanks!
Thanks for the tutorial it was great. I was wondering if I'm using raspberry pi camera module, will cap = cv2.VideoCapture(0) work? Sorry I'm still a beginner and want to detect cars using haar cascade.
Thanks a lot! By the way, which version of OpenCV and Python are you using ?
Thank you so much for making this video, you are a legend.
"If you laughed, I appreciate" ... LOL that was amazing!! ... N i actually laughed LOL
Been watching your videos. What do you recommend using for commercial use on facial recognition?
Awesome !!!
Thanks for this video.. :)
Suggesting a modification. Because we are using the ROI of face to detect the eyes within that ROI, when the lower half of the face is out of frame, the eye will never get detected.
thanks for this beautiful tutorial....
Hi, can you please tell me,
in which software he wrote the code
Hi! Thanks for the guide. Do you have a guide to help with putting a label to the person in front of the webcam?
Hey Harrison. The face detection part is really nice. Is there any way to detect emotions from an image??
so funny when he says " my mouth is also probably an eye " XD
Nice video tutorial. I was hoping if you could give an advise a new method on how to detect rules of thirds on a photograph using OpenCV? Thanks in advance.
Love it bro, thanks u very much!
you're THE MAN !!!!
really good video man ! Keep it up !!! :)
Hi,
I have done plant detection using ur method it worked well.
Now I'm trying to do bottle detection
But it doesn't recognise bottles
Can u help me with taking the best suitable data set for it, i have tried many possible ways but didn't get results.
You don't wanna find "eyes" outside of a "face" . . . . very funny stuff
thank you so much it was very helpful
nicely done! i have a question,How to locate landmarks on face using opencv python?
Hey Sentdex,
I have been working on a project for detecting traffic signs and I was wondering how many negatives and positives will suffice?
Any source for getting the negatives?
Thanks a lot men.! It works ..!
Great help, thank you very much. Can you suggest how to detect pupil using the same method?
You are awesome man
Why did you take y co-ordinate first in roi_gray and roi_color...
it's not showing the rectangle why? :( please help about that i am using Ubuntu...
how to add filter like dogs .. like snapchat ?
I m 3D Artist working as a Level designer, I m really new to coding and have only a bit knowledge on C# which I tried to learn once working in Unity3D.
I just wanna make an app for both mobile and desktop-like lensKart or other latest selfie camera App like tracking face and placing goggles or some object in it. Kindly Let me know where should I start when this tutorial helps.
Because I have some confussion like what camera you using to recognise any special or general Webcam while u testing and First most thing the software that which I need to develop my need.
Thanks in advance.
It works! Thanks !!
can it determine different ppl or that just that they all have faces? i want to identify with face recognition for home automation?
you are a geniussssss
cheers for doing these videos, its making sense now. got a problem with the xmls though, it keeps saying file should start
5:03 there is some nice drum going on in the background :D
müptezel cihat nikiyle python tutorialı izlemek baya sıradışı bi olay reis fdsfad
Hi, where can i get the full playlist for OpenCV. Amazing video by the way
Very useful tutorial. Do you know any tutorial for insects detection
Thanks for the video, amazing!
My question is why did you apply faces to the gray image? why not to the color img?
why did we do the cvtcolor to gray?
Thanks
+Alejandro Serna allowing there to be colors means exponentially far more variables
Does it affect on result! ????
Try it and find out. See what happens. That's how you learn.
i think that the gray scale image means less data processed
@@naghechebilal7269 Colored images have 3 channels (R,G,B), gray images only have one.
Using gray images makes the problem easier and the computation faster.
hi, i have an understanding problem with this code.
with the following code:
for (ex, ey, ew, eh) in eyes:
cv2.rectangle(roi_color, (ex, ey), (ex + ew, ey+eh),(0,255,0),2)
with this code we draw every eye(s) detected on the roi_color, since the first parameter is the image we draw our rectangle on.
At the end we say cv2.imshow("img", img). Now with which line do we say draw the eyes on this img that we later show??
Great video and greedings from germany
Hello, this video was very helpful and it works great, but I'd just like to ask you if there is any possible way to detect when you close your eyes. I'm trying to write a sleep detection program that sends a signal to the user when he is falling asleep, and I've been having an issue when trying to detect when the eye is closed.
Thank you
Thanks for your wonderful videos!
I have one question: why convert img to gray? I change faces = face_cascade.detectMultiScale(gray) to faces = face_cascade.detectMultiScale(img), still work. So, I think we don't need convert. Am I right?
its probably faster
Yup makes it faster because there are less color channels (rgb is three, grayscale is one) to process.
Hi,
Thank you for your wonderful work.
What would be the "BEST" camera to get for this type of projects? Is it the more resolution the better? What do you recommend under $45
Pi cam
Thank you bro for this tutorial is there any way to show the confidence level of the detection?
Great video. I laughed.
Thanks!
Haarcascades are hard! Haar haar haar.
Anyways, would it be possible to go from tracking the eye to where the is pupil within the eye (like what you did with going from tracking the face to tracking eyes within the face)? If so, is it then possible to pull out information on where the gaze is? I was thinking if you can get the position of the pupil, it may be possible to calibrate that information to a screen position and have something of a rough eye tracker without $30,000 of research software and hardware.
Anyways, great video!
+Jake Rember Great question. It would seem to me, logically, that you could indeed do this to track gaze. I'd personally detect the eye region, then detect the center of the pupil region. From there, assuming your eye center and pupil centers were indeed correct, you could draw a line between them and continue out to get the gaze.
+sentdex I was thinking about how you would clean up the data from this as well. I was thinking maybe add in a statement which evaluated a certain amount of deviance per frame and would ignore anything outside of that threshold. That way, if you calibrated/started with the eyes and face, and assuming the person was not moving too fast, one could decrease the jitter of the face and eyes in the video feed.
It is all pretty exciting to me, once I have time, I think I may take a crack at trying to make a simple eye tracker and see if valid data can be gathered from it. Like say, mapping where a person is looking to a location on a screen. It would be very convenient for looking at the effectiveness of an application or webpage! It could also be a great tutorial (nudge, nudge :p). Thank you for your reply!
did you make the eye tracker code
Hi I am using IPython and Jupyter notebook to run the code. But the video streaming and detection is very slow. Any idea what might be the issue?
nice tutorial. How would you write a text('face_detected') on the screen when face is detected. Under 1st forloop, i tried like (if w>0): then cv2.putText....., but didn't work. Any suggestions?
Wow ! Is it possible to "log in" with facial recognition ? so I can unlock my session just with my face ?
Could you please tell me which opencv version and which environment you are using ?
We are using stretch and VNC viewer, our videos are having very low frame rates and has about 3 seconds latency, will remote desktop reduce the latency
Thank you so much
Hi Sentdex, is there any way to detect the forehead with OpenCV ? I want to crop the forehead after the image is captured.
Thanks for this video. How can I also get to track the eye gaze itself ?
bro! I also want to detect gaze ! can we talk ?
lol bro did you know how to add image in the eye like i want to add glasses (like snapchat) please answer me in quicktime and thank you