Systems[edit | edit source]

This code is compatible with both Mac and Windows operating systems. It requires just a USB cable to connect the webcam to the computer. Next, ensure that the computer has detected the camera and that it is functioning properly. On a Mac, you can test the camera by using the FaceTime or Photo Booth app and switching the camera source from the top left to see if it functions correctly.

Camera-test.png

Software[edit | edit source]

It is essential to have Python 3 installed on your computer. Furthermore, an IDE is required to implement the codes. Visual Studio Code is a recommended open-source option. To utilize Visual Studio Code, navigate to the 'Extensions' sidebar, install the Python extension by Microsoft, and then add the Prettier package.

VSC code .png

To create a new Python file, press (Ctrl/Cmd + N). Then, save the file by pressing (Ctrl/Cmd + S) and name it with a '.py' suffix.

Screenshot 2024-05-25 at 21.57.18.png

Additionally, you need to install the libraries OpenCV, Matplotlib, and Schedule using pip install. To install the libraries, open the terminal and enter the following command:

pip install opencv-python
pip install schedule
pip install matplotlib

Find all connected cameras[edit | edit source]

To locate all cameras connected to your computer, use the find.py script. Download the code and open the file in Visual Studio Code. Ensure you know the path and directory where you saved your file. For example, if you saved it on your desktop, navigate to your Visual Studio Code terminal and type the following commands:

cd Users/UserName/Desktop/
python3 find.py

This will change the directory to your desktop and run the find.py script.

Typically, the index 0 is used for the built-in camera of your laptop. If not, index 0 usually refers to your external webcam.

Taking snapshots and saving them[edit | edit source]

To initiate real-time image capture from the camera at intervals, such as every 60 minutes, and to store these images in a specific file, you should first create a new, empty file. Afterward, download and execute the `camera-script.py` file on your device. This script utilizes OpenCV to take snapshots at specified time intervals and saves each image with the precise time and date in your file.

If you have any further questions about running this script on your computer, please consult the README file on GitHub or email me at kaghamoh@uwo.ca.

FA info icon.svg Angle down icon.svg Page data
Keywords safety, laboratory, fast methods
Authors Kimia Ketabforoosh
License CC-BY-SA-4.0
Organizations Free Appropriate Sustainable Technology, Western University
Language English (en)
Related 0 subpages, 2 pages link here
Impact page views
Created May 26, 2024 by Kimia Ketabforoosh
Modified May 26, 2024 by StandardWikitext bot
Cookies help us deliver our services. By using our services, you agree to our use of cookies.