Тёмный

Eye motion tracking - Opencv with Python 

Подписаться
Просмотров 118 тыс.
% 1 824

Build your own AI vision solutions: pysource.com/community
We’re going to learn in this tutorial how to track the movement of the eye using Opencv and Python.
Instructions and source code: pysource.com/2019/01/04/eye-motion-tracking-opencv-with-python/
➤ Full Videocourses:
Object Detection: pysource.com/object-detection-opencv-deep-learning-video-course/
➤ Follow me on:
Instagram: pysource7
LinkedIn: www.linkedin.com/company/pysource
➤ For business inquiries:
pysource.com/contact

Опубликовано:

 

4 янв 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 101   
@pysource-com
@pysource-com 2 года назад
🔥Learn how to build your own AI vision solutions: pysource.com/community
@wessauder7708
@wessauder7708 4 года назад
Thank you very much for the tutorial. I am curious what type of camera you used - Is it a web cam? What resolution and fps would you suggest for a setup. Thank You.
@camiladisanto
@camiladisanto 4 года назад
Thank you so much for all of your videos! I'm currently working with gaze detection at work, and you helped me a lot! :)
@muhammadusamarauf3917
@muhammadusamarauf3917 4 года назад
Hey. I am also working on it and need some help. Can you help me?
@mohammedradman2756
@mohammedradman2756 3 года назад
Thank you so much for this video as well as the eye gaze series. They are really awesome. I have faced a problem with the code in this video when obtaining the contours by the function findContours, it produces an error "not enough vales to unpack (expected 3, got 2)" I hope you can help me with that.
@mites2011
@mites2011 Год назад
Thank you so much for the very interesting and helpful video. I have a question for you. What to do in order to count how many times eye iris moves for example in a minute? Thanks for consideration.
@hishamayasrah8776
@hishamayasrah8776 3 года назад
Hi, after detect where the eye is looking can I use this information and send it into the microcontroller to take some action? if yes, this code will be efficient to do this work? and thank you for sharing this awesome work.
@reddot_22
@reddot_22 3 года назад
Bruh I think you are trying to do the same shit as me lol.
@nadaomar5451
@nadaomar5451 Год назад
@@reddot_22 And now I'm trying to do the same shit that you guys are trying too
@reddot_22
@reddot_22 Год назад
@@nadaomar5451 Plot twist never tried bro, I dedicate to web and some backend stuff lol. Gives me the impression that this is already implemented by other companies.
@Ash-br8oo
@Ash-br8oo 4 года назад
Great video sir! Just one question, how do you calculate the exact position of the eye in opencv?
@pysource-com
@pysource-com 4 года назад
I've done a video on how to get the position of facial landmark points. You can find that here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-MrRGVOhARYY.html also you can check my video series "Gaze controlled keyboard" where I go more in depth about the eye detection.
@Ash-br8oo
@Ash-br8oo 4 года назад
@@pysource-com Thank you so much! Your videos are very helpful to me.
@nathancook8452
@nathancook8452 2 года назад
Its amazing that gpt3 can program its own code, so it can code this automatically, I was wondering if the cisco opendna spaces is what is used to route all the cloud data for the public.
@phamxuantrung7104
@phamxuantrung7104 4 года назад
Excellent and educative source, thanks, man!
@ArunMPEdison
@ArunMPEdison 3 года назад
Thank you, it’s extremely helpful.
@sudhanshumungole9436
@sudhanshumungole9436 9 месяцев назад
Sir what is the hardware requirement? like what camera and all?
@navanitkrishkm9570
@navanitkrishkm9570 11 месяцев назад
is there any algorithm in particular that you're using?
@OctainDesign
@OctainDesign 5 лет назад
Thank you very much, your Tutorials help me a lot and I learn much even though i am just beginner. If you want, could you make a Tutorial about tracking objects like darts to find out their position in the dart board (wether it is a 20 or a 5 for example).
@Draginx
@Draginx 3 года назад
Hello, I am coding a project to where I have to set a variable to a different value when my eyes look in different directions. Whenever my eyes look away, I want it to make value = 'some number'. How could I do this?
@adarshajayan564
@adarshajayan564 5 лет назад
When i try to run the contour part i got error like AttributeError: module 'cv2.cv2' has no attribute 'drawCounters' and ValueError: not enough values to unpack (expected 3, got 2)
@Charles-xu7pu
@Charles-xu7pu 4 года назад
findContours() was changed to not return ret, so change the line to contours = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) instead
@shipratiwari1132
@shipratiwari1132 4 года назад
Thanks a lot, your videos have helped me in my college work and since I am new to this, it really helped me. I just wanted to ask, if you could provide the codes to crop the eye part as you have showed.
@pysource-com
@pysource-com 4 года назад
Hi Shipra, I have a video about that, check my other series "Gaze controlled keyboard"
@shipratiwari1132
@shipratiwari1132 4 года назад
@@pysource-com thanks a lot..
@gpmdf__348
@gpmdf__348 10 месяцев назад
is it possible to fiz the camera window os a HTML page? I mean nos a desktop app, but inside a web app?
@amaanmeer8014
@amaanmeer8014 11 месяцев назад
What do I have to do if i want it to do this while i give an input video of my entire face
@pranit282
@pranit282 2 года назад
Hello sir from where i can download that eye movement video That is not in the discription!
@pysource-com
@pysource-com 2 года назад
on the blog post linked in the description you need to click "click here to download source code" and you'll get source code + the video
@pranit282
@pranit282 2 года назад
@@pysource-com thank you sir
@ajithas1293
@ajithas1293 3 года назад
Hi,Thank you for the video.Could you help me for tracking eyes of audience from live video conferencing like zoom meeting or meeting in MS team
@lucaslukasavicussilva30
@lucaslukasavicussilva30 3 года назад
Simple, amazing. I already learned a lot from different sources, but this videos comprises very well the main idea of ​​Computer Vision. I would just recommed add 2 things: Instead of using the '_' special variable, use a named variable, helps us that do not have much knowledge in cv2 to understand better what its been returning. Also, I would like to you to add a little explanation about each cv2 methods (Yes, I know that I can check the docs, but I want a shortcut :)
@jacobadamczyk3353
@jacobadamczyk3353 2 года назад
Underscores "_" are typically used as "throwaway" variables. So when a cv2 method is returning several items (say line 12) but we only want one of them, we use this method
@robthorn3910
@robthorn3910 5 лет назад
For some reason "_, contours, _ = " does not work for me. If I leave off the first '_,' then it does work, i.e., "contours, _ = " works. Same thing in the shapes video.
@pysource-com
@pysource-com 5 лет назад
I think you're probably using Opencv 4, while in this video I used an older version of Opencv, 3.x. On opencv 4 there are a few differences.
@pythonocean7879
@pythonocean7879 5 лет назад
just use _,contours = cv2.findcontours()
@subinalex88
@subinalex88 5 лет назад
I got below error, TypeError Traceback (most recent call last) in 1 while True: 2 ret,frame = cap.read() ----> 3 roi = frame[269:795,537:1416] 4 gray_roi = cv2.cvtColor(roi,cv2.COLOR_BGR2GRAY) 5 gray_roi = cv2.GaussianBlur(gray_roi,(7,7),0) TypeError: 'NoneType' object is not subscriptable
@jordanordonez8535
@jordanordonez8535 Год назад
how can i fix this error _,threshold = cv2.threshold(gray_roi, 3, 255, cv2.THRESH_BINARY_INV) IndentationError: unexpected indent
@joeyawiki3315
@joeyawiki3315 3 года назад
is it possible to use this as a mean to verify a person is real not a picture or some sort of that
@yadnyeshjoshi6078
@yadnyeshjoshi6078 Год назад
how can we take this data of movement of pupil in csv file to perform ML Algorithm
@maciejg8864
@maciejg8864 2 года назад
why do you speficy position of the eye; roi = frame[269: 795, 537: 1416] rather than detecting eye first using custom object detection (with tensorflow) or already build haar cascade object detecion? With your approach it only applies to your recorded video witch have no sense. Imagine if you try to track eye motion with live webcam. Overall thank you for contributing
@umeshpandey5226
@umeshpandey5226 2 года назад
Hi... Will it work with VR device?
@sapk3532
@sapk3532 2 года назад
can we use erosion and dilation to eliminate the upper part where you don't want it in the pic? i find it easier than using blur and break the loop
@reallitygamerTV
@reallitygamerTV 2 года назад
what is Algorithm ? i need to know name Algorithm.
@informationDesigner
@informationDesigner 3 года назад
Hi .. I have a mistake is : Traceback (most recent call last): File "D:\eye_motion_tracking\tessst_roi.py", line 19, in contours = sorted(contours, key=lambda x: cv2.contourArea(x), reverse=True) TypeError: 'NoneType' object is not iterable what is solve?
@adlinsyahirah6863
@adlinsyahirah6863 3 года назад
do u know how to solve this?
@nanocritix
@nanocritix 3 года назад
Is it possible to create Tobii style application with webcam or better one?
@deepak223098
@deepak223098 4 года назад
Great tutorial sir, Can you give me direction how to do the same for live video example: using the camera. Thank you !
@pysource-com
@pysource-com 4 года назад
Hi Deepak, I've a video about that as well. Check my series "Gaze controlled keyboard" and you will learn there how to extract the eye from the face in real time and then detect the gaze
@deepak223098
@deepak223098 4 года назад
@@pysource-com Thank you so much..actually I was watching that series only. Again Thank you for your reply
@ghzich017
@ghzich017 2 года назад
Just do cv2.videoCapture(0)
@migueldelahoz4740
@migueldelahoz4740 4 года назад
Hi buddy. What device did you use?
@DAEI_JAGADAUmahesh
@DAEI_JAGADAUmahesh 3 года назад
I'm getting error while executing code can u please help with it
@AbdulSamad-hd1sr
@AbdulSamad-hd1sr 5 лет назад
but this method will not work in outdoor conditions. like in sunlight
@shakteesamantpanda3039
@shakteesamantpanda3039 3 года назад
How to detect liveness in a face
@Aishwarya_Varma21
@Aishwarya_Varma21 2 года назад
where could i run this source code ?
@ernestogarcia8014
@ernestogarcia8014 4 года назад
One of my questions is how would you make the console print out whether it is moving left, right, up, down, or center? You mentioned at the end of the video that you could do that. Could you please provide that information? Thank you!
@subinalex88
@subinalex88 5 лет назад
I got another error at this code _, contours = cv2.findContours ( threshold , cv2.RETR_TREE , cv2.CHAIN_APPROX_SIMPLE)[-2:] for cnt in contours: # ctr = numpy.array(cnt).reshape((-1,1,2)).astype(numpy.int32) cv2.drawContours(roi,cnt , -1,(0,0,255) ,3) Error says, cv2.drawContours(roi,cnt , -1,(0,0,255) ,3) cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\imgproc\src\drawing.cpp:2509: error: (-215:Assertion failed) npoints > 0 in function 'cv::drawContours'
@rohitbadjatya9237
@rohitbadjatya9237 5 лет назад
sir, can you give an idea about how we recognize iris and matched to our pre-stored iris image?
@urdu600
@urdu600 3 года назад
hi bro how i 4 led on off from eye movement ,
@rahulrokade2048
@rahulrokade2048 4 года назад
Great Work ! But can anyone help me to do this using Iris ??? What dimensions i have to change, please anyone guide me for this .
@OctainDesign
@OctainDesign 5 лет назад
I have a question. When i try to run the code after the command cv2.drawContours(roi, [cnt], -1, (0,0,255), 3), i get the following error code: TypeError: contours is not a numpy array, neither a scalar
@95_himanshukumar20
@95_himanshukumar20 4 года назад
Import thr numph library to overcome this error
@shipratiwari1132
@shipratiwari1132 4 года назад
File "P:/Pysource/eye_motion_tracking/eye_motion_tracking.py", line 17, in _, contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) not enough values to unpack (expected 3, got 2) this is the error, can anyone please help me?
@retro1974
@retro1974 4 года назад
Just accept 2 values ex:- _, contours= cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
@smiley3753
@smiley3753 4 года назад
How to calculate how much the change of position contour..?
@BlackemOutGaming
@BlackemOutGaming Год назад
What about tracking dilation
@mehdibouhamidi4675
@mehdibouhamidi4675 Месяц назад
Did you find any solution to that ?
@pythonocean7879
@pythonocean7879 5 лет назад
i need little help.how can i estimate the position like if i move my eye up then it just print eye location up.i want to use it for my project
@pysource-com
@pysource-com 5 лет назад
Take a look at this playlist ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-VWUgkcX_KoY.html It's explained how to understand if the eye is lloking at the lefto or right, so you can adapt it to detect when the eye is looking up
@blankspace9184
@blankspace9184 3 года назад
I've got a problem in line 14 of your code. error: (-215:Assertion failed) npoints > 0 in function 'cv::drawContours' Can anyone figure out what this means?
@blankspace9184
@blankspace9184 3 года назад
Nevermind, I figured it out. in OpenCV 4.x.x the first parameter returned by findContours() is the contour. Simply swapping out the contour with the first parameter should do the trick.
@aishwaryav3177
@aishwaryav3177 2 года назад
@@blankspace9184 hey need some help. where did u run this code ?
@OctainDesign
@OctainDesign 5 лет назад
Is it possible to output the coordinates of the center of the cross?
@vortexplays4946
@vortexplays4946 3 года назад
I am currently attempting this rn
@sudiptachatterjee5862
@sudiptachatterjee5862 3 года назад
sir how can i detect the left, right direction ?? please help
@pysource-com
@pysource-com 3 года назад
I have a video series called "gaze controlled keyboard" where I explain that. you'll find on my youtube channel
@mustafaozcam
@mustafaozcam 5 лет назад
I was waiting for you
@Ambrozekwerondaa
@Ambrozekwerondaa 4 года назад
i cant seem to find this face video you imported anywhere. Anyone know how I can get hold of it?
@pysource-com
@pysource-com 4 года назад
On the blog post click on "click here to download source code". You'll get source code and the video
@Ambrozekwerondaa
@Ambrozekwerondaa 4 года назад
@@pysource-com Thanks. I managed to get it. My masters research paper has elements of your tutorials. So thanks a lot for your priceless tutorials.
@diwakar8815
@diwakar8815 3 года назад
can we make it using the live video from a webcam??
@androidoptimusprime
@androidoptimusprime 3 года назад
Yes, instead of using the path for the file you just use cap = cv2.VideoCapture(0) (0 if you only have one camera connected)
@stivstivsti
@stivstivsti 5 лет назад
i doubt this will work on other video with different light conditions...
@jarosawmaruszewski1678
@jarosawmaruszewski1678 5 лет назад
Thats my problem too, all those tutorials are stuffed with magic numbers beyond all recognition.Tuned to actual case, so they are useless in real cases. I'm trying to use more adaptive method based on median, etc, but the problem is really hard, starting from the gaussianblur kernel size (3,3) :)
@stivstivsti
@stivstivsti 5 лет назад
@@jarosawmaruszewski1678 forget it, use neural network based approaches...
@jarosawmaruszewski1678
@jarosawmaruszewski1678 5 лет назад
@@stivstivsti yeah, but still need contours or edge detection to measure distance between two elliptic curves. On the shop floor, dust, fog, steam, light etc.
@stivstivsti
@stivstivsti 5 лет назад
@@jarosawmaruszewski1678 drop me samples to stiv.yakovenko@gmail.com, may be i'll give you an idea.
@jarosawmaruszewski1678
@jarosawmaruszewski1678 5 лет назад
@@stivstivsti Thank you, unfortunatelly can't share anything - company's policy
@danielkoodziejczyk8398
@danielkoodziejczyk8398 3 года назад
_, contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) ValueError: not enough values to unpack (expected 3, got 2) what wrong with that? Can someone help?
@pysource-com
@pysource-com 3 года назад
change that line with: contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) and it will solve the problem this because you're using Opencv 4 while the code was made for opencv 3
@mrwaseemmalik5766
@mrwaseemmalik5766 2 года назад
Thank you so much 😊
@bharathkumar-li9fu
@bharathkumar-li9fu 4 года назад
please help how to draw circles on top of thos contours instead rectangle
@shubhamturakhia1649
@shubhamturakhia1649 4 года назад
Instead of cv2.rectangle you can use cv2.circle(), find the complete details here: docs.opencv.org/master/dc/da5/tutorial_py_drawing_functions.html
@PedroAyalaRafael
@PedroAyalaRafael 2 года назад
I think I've been hacked,my question is that if it's possible that this person is able to see what I'm exactly reading? Because I can hear them reading along with me. Sorry for my English
@PedroAyalaRafael
@PedroAyalaRafael 2 года назад
I have a s21 ultra or I think it still is. Because I have only-read files larger than my phone's storage capacity.
@ahmadkakarr
@ahmadkakarr 5 лет назад
شکریہ
@rdoetjes
@rdoetjes 4 года назад
Hard coding the ROI is cheating. You want to train a HAAT network (there probably is one already) to detect the contrast levels that make up an eye and return that ROI.