Eye fatigue monitor based on eye blinking for Linux (Docker) and Android using OpenCV
Eye fatigue monitor based on eye blinking for Linux and Android using OpenCV.
Currently are employed two methods for eye blink detection (template based and using farneback optical flow). See common_settings_comp.cpp
In the scope of this project, eyeMonTester was developed. You can test the methods against public available databases, or create your own (you can determine frame numbers of eye blinks with “make annot” tool).
git clone git@github.com:predkambrij/eyeMon.git
git clone git@github.com:predkambrij/eyeLike eyeMon/_1OpenCVopticalflow/src/main/jni/eyeLike
docker build --build-arg ARG_UID=$(id -u) --build-arg ARG_GID=$(id -g) -t predkambrij/eyemon eyeMon/dockerfileDesktop/
# it takes some time to download and compile; currently docker image takes 882.6 MBNote: if you want sound notifications, you need to pass —device /dev/tty0 and —cap-add SYS_TTY_CONFIG so that beep command (pc speaker) will work
Using SSH: (pass: developerpw)
docker run -d -p 127.0.2.4
22 -v $(pwd)/eyeMon:/eyeMon --device /dev/video0 --device /dev/tty0 --cap-add SYS_TTY_CONFIG predkambrij/eyemon
ssh -Y developer@127.0.2.4 -p 1122 "cd /eyeMon/; make d"
Using X11 unix socket (it’s less CPU intensive)
docker run -it --rm -v $(pwd)/eyeMon:/eyeMon -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --device /dev/video0 --device /dev/tty0 --cap-add SYS_TTY_CONFIG -u developer predkambrij/eyemon bash -c "cd /eyeMon/; make d"
git clone git@github.com:predkambrij/eyeMon.git
git clone git@github.com:predkambrij/eyeLike eyeMon/_1OpenCVopticalflow/src/main/jni/eyeLike
docker build -t predkambrij/eyemondev eyeMon/dockerfileDevelop/
# it takes some time to download and compile; currently docker image takes 8.7 GBNote: if you want to install the apk using adb, find which usb device belongs to your phone, in this case it’s /dev/bus/usb/003/013
Note2: you can use also X11 unix the same way as above
Note3: this docker image contains also setup for running the code on your computer, so you can run “make d” to start the application
Using SSH: (pass: developerpw)
docker run -d -p 127.0.2.5
22 -v $(pwd)/eyeMon:/eyeMon --device /dev/video0 --device /dev/bus/usb/003/013 --device /dev/tty0 --cap-add SYS_TTY_CONFIG predkambrij/eyemondev
Building the apk and running it on your phone
ssh -Y developer@127.0.2.5 -p 1122
cd /eyeMon/
make ndkb
./gradlew assembleDebug
~/android-sdk-linux/platform-tools/adb install -r ./_1OpenCVopticalflow/build/outputs/apk/_1OpenCVopticalflow-debug.apk
~/android-sdk-linux/platform-tools/adb uninstall org.blatnik.eyemon
~/android-sdk-linux/platform-tools/adb shell am start -n org.blatnik.eyemon/org.blatnik.eyemon.FdActivity
Start Android Studio and open the project
ssh -Y developer@127.0.2.5 -p 1122
~/android-studio/bin/studio.sh
note: you can install and start it inside the screen or tmux command