USB Camera Setup
1. Plug in the USB camera to the raspberry pi.
2. Install open cv at the home directory of the pi. This is needed to control the USB camera through the raspberry pi. It includes a command for installing the required prerequisites.
- open a new terminal
- Install prequisites using the below command by copy pasting
sudo apt-get install build-essential cmake pkg-config libjpeg-dev libtiff5-dev libjasper-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev -y
- Then to install open cv run the below command
sudo apt-get install python-opencv
- If you want more information on this process you can follow the below guide.
https://raspberrypi-guide.github.io/programming/install-opencv.html
- Test to ensure that open cv is installed correctly by typing python into the terminal then when in the python interactive environment type import open-cv then enter. After the new line asks for input put cv2.(two underscores)version(two underscores) The result should be the version of open-cv that was installed.
3. If not created create a folder on the desktop called pi-camera-latest
4. Go to the ADPAA folder created earlier when fetching the repository via source forge and copy and paste the following files into the pi-camera-latest folder. Do not test the transfer+move.sh file yet there needs to be more setup.
- save-image-usbcam.py
- save-img-usb.sh
- transfer+move.sh
3. Test the camera by running the save-image-usbcam.py by navigating to /home/pi/Desktop/pi-camera-latest folder in the terminal and running the command “python save-image-usbcam.py” without parentheses. This will run the script to take a picture from the camera. You can confirm the image was created by checking the folder created in step 3.