dilawar / eye-blink-detector

An eye blink detector in python + opencv
48 stars 24 forks source link

A lot of issues with avi format. #1

Closed dilawar closed 8 years ago

dilawar commented 9 years ago

On the video 3.avi following traceback:

 Exception in Tkinter callback
>>> Traceback (most recent call last):
>>>   File "C:\python27\lib\lib-tk\Tkinter.py", line 1536, in __call__
>>>     return self.func(*args)
>>>   File "C:\python27\lib\lib-tk\Tkinter.py", line 587, in callit
>>>     func(*args)
>>>   File
>>> "C:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin
>>> e 147, in _on_timer
>>>     TimerBase._on_timer(self)
>>>   File "C:\python27\lib\site-packages\matplotlib\backend_bases.py", line
>>> 1305, i
>>> n _on_timer
>>>     ret = func(*args, **kwargs)
>>>   File "C:\python27\lib\site-packages\matplotlib\animation.py", line 991,
>>> in _st
>>> ep
>>>     still_going = Animation._step(self, *args)
>>>   File "C:\python27\lib\site-packages\matplotlib\animation.py", line 797,
>>> in _st
>>> ep
>>>     self._draw_next_frame(framedata, self._blit)
>>>   File "C:\python27\lib\site-packages\matplotlib\animation.py", line 816,
>>> in _dr
>>> aw_next_frame
>>>     self._draw_frame(framedata)
>>>   File "C:\python27\lib\site-packages\matplotlib\animation.py", line
>>> 1179, in _d
>>> raw_frame
>>>     self._drawn_artists = self._func(framedata, *self._args)
>>>   File "blinky_gui.py", line 100, in animate
>>>     (x0, y0), (x1, y1) = box_
>>> ValueError: need more than 0 values to unpack
>>>

Send over email by Piyush.

dilawar commented 9 years ago
 $ python blinky_gui.py -f ~/Videos/3.avi
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 536, in callit
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 141, in _on_timer
    TimerBase._on_timer(self)
  File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 1203, in _on_timer
    ret = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 876, in _step
    still_going = Animation._step(self, *args)
  File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 735, in _step
    self._draw_next_frame(framedata, self._blit)
  File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 754, in _draw_next_frame
    self._draw_frame(framedata)
  File "/usr/lib/pymodules/python2.7/matplotlib/animation.py", line 1049, in _draw_frame
    self._drawn_artists = self._func(framedata, *self._args)
  File "blinky_gui.py", line 121, in animate
    tB, bB = extract.find_blinks_using_pixals(data_[:,:])
  File "/data/dilawars/Work/GITHUB/eye-blink-detector/extract.py", line 138, in find_blinks_using_pixals
    bT, yy = t[x-1:-x], w[x-1:-x] - smoothW
ValueError: operands could not be broadcast together with shapes (0,) 
dhuadaar commented 9 years ago

This error has been resolved. The problem occurred when I by mistake press the 'q' key without selecting the region of interest.

The problem now is that I am using greyscale videos but processing halts at exactly 6 seconds (No idea why). Also, the second graph below doesn't plot anything on occurrence of a blink

dhuadaar commented 9 years ago

The command line after the 6 second halt

Microsoft Windows Version 6.3.9600 2013 Microsoft Corporation. All rights reserved.

C:\Users\user\Desktop\p\eye>c:\python27\python blinky_gui.py -f 4.avi Exception in Tkinter callback Traceback (most recent call last): File "c:\python27\lib\lib-tk\Tkinter.py", line 1536, in call return self.func(_args) File "c:\python27\lib\lib-tk\Tkinter.py", line 587, in callit func(_args) File "c:\python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", lin e 147, in _on_timer TimerBase._on_timer(self) File "c:\python27\lib\site-packages\matplotlib\backend_bases.py", line 1305, i n _on_timer ret = func(_args, _kwargs) File "c:\python27\lib\site-packages\matplotlib\animation.py", line 991, in _st ep still_going = Animation._step(self, args) File "c:\python27\lib\site-packages\matplotlib\animation.py", line 797, in _st ep self._draw_next_frame(framedata, self._blit) File "c:\python27\lib\site-packages\matplotlib\animation.py", line 816, in _dr aw_next_frame self._draw_frame(framedata) File "c:\python27\lib\site-packages\matplotlib\animation.py", line 1179, in _d raw_frame self._drawn_artists = self._func(framedata, *self._args) File "blinky_gui.py", line 121, in animate tB, bB = extract.find_blinks_usingpixals(data[:,:]) File "C:\Users\user\Desktop\p\eye\extract.py", line 138, in find_blinksusing pixals bT, yy = t[x-1:-x], w[x-1:-x] - smoothW ValueError: operands could not be broadcast together with shapes (0,) (48,) [INFO] Writing to file 4.avi_out.csv [INFO] Writing to file 4.avi_out.csv

dilawar commented 9 years ago

Six seconds is the window time after which it computes the location of blink.

dhuadaar commented 9 years ago

It means, my program is halting at the initialization of the plot of second graph?

dilawar commented 9 years ago

Yes. I'll fix it soon. If you want to have a look, fork the repo and send the pull request after fixing it.

dilawar commented 8 years ago

I've added another script blinky_webcam.py . If you run it, it will capture frames from your camera.

The gui will show you the raw plots as well as detected blinks. The blink detection is very sensitive to running baseline, so if you have lot of noisy background around your eye, the count will not be correct.

Also you may have to expand your eye a bit to be detected for blinks. These algorithms are written for a mouse eye which is quite round :eyes: