Inspiration
It was common for our parents to always tell us we need to get off our computer and stand up once in a while. I didn't listen at first, but later the strain on my eyes forced me to understand. This extension attempts to prevent health problems from prolonged computer use.
What it does
LazeDetect is a chrome extension that uses your camera to detect how long you have been in front of your computer. If you have been in front of your computer for a certain amount of time, then your browser tabs will continuously close and prevent reopening temporarily, forcing you to get off your computer for a while.
How we built it
We built this extension in two parts: the extension and the backend. The extension uses a background script to find out when the timer ends and uses a content script to inject JS to get image data from the computer's camera. This camera data encoded in base64 is then sent to the backend, where it is processed by opencv face detection to determine if a face is still in front of the camera. If so, the tabs of the browser will stay closed and prevent reopening for some time.
Challenges we ran into
One of the main challenges that we ran into was finding a way to get video from the chrome extension. Initially, we tried to use navigator.mediaDevices.getUserMedia() from the background script, but we were not able to request permission. Later, we solved the problem by requesting camera access in a separate tab under the chrome extension domain and getting the image through a content script that inserts an iframe into the page.
Accomplishments that we're proud of
In this project, we are proud of learning how to handle video in a chrome extension and how to use FastAPI and other new technologies.
What we learned
We learned how to make requests, use OpenCV pre-trained models, and request video through a chrome extension. We also learned a lot about the chrome extension messaging APIs and content scripts.
What's next for LazeDetect
Next, we plan to make customizable session and break times, as well as improve the UI and add a website to make it more presentable.
Built With
- chrome
- fastapi
- html5
- http
- javascript
- opencv
- python
Log in or sign up for Devpost to join the conversation.