Here we cover the steps to get rpiasgige
running on Raspberry Pi
You need the following list of material to run tutorial:
|
Follow the Raspberry Pi's official Getting Started tutorial: https://projects.raspberrypi.org/en/projects/raspberry-pi-getting-started only if you are totally new to Raspberry PI.
Otherwise, skip to the next section!
Open the Terminal and execute the following commands:
sudo apt update
sudo apt upgrade
sudo apt install git build-essential cmake binutils-dev libopencv-dev python3-opencv
Installing dependencies |
This last command may take longer to finish. It will download and install OpenCV 3.2 and some required tools used afterwards in the build of rpiasgige
itself.
The OpenCV version installed from libopencv-dev is quite old (3.2). Check here, here or here if you prefer to install the most recent version of OpenCV instead.
Once the installation of dependencies is finished, execute the following commands to clone and build the rpiasgige
server:
git clone https://github.com/doleron/raspberry-as-gige-camera.git
cd raspberry-as-gige-camera/code/server
mkdir build
cd build
cmake ..
make
Building rpiasgige
|
Connect your USB camera to one of Raspiberry Pi's USB ports. After it, run the rpiasgige
server as follows:
./rpiasgige
The expected output is:
DEBUG - /dev/video0 - Not initialized. Initializing now.
DEBUG - /dev/video0 - successfuly initialized.
DEBUG - /dev/video0 - Waiting for client
Note: You can stop the
rpiasgige
server by pressing control+c
By default, rpiasgige
uses the device /dev/video0
and TCP port 4001
. Of course, you can use different settings. For example:
./rpiasgige -port=5753 -device=/dev/video2
starts the rpiasgige
server on port 5753
using the device /dev/video2
It is important to take attention tothe choice of TCP port. The correct TCP port is mandatory in order to client programs to make TCP requests.
Once the server is running, it is ready to reply incoming requests.
It is likely that you end up defining a static IP for your camera. You can achieve it by setting a static IP in the device itself or setting up a rule on your DHCP server. Here, we assume that you have set the eth0 interface with IP 192.168.2.3 and network mask 255.255.255.0:
At this point, we have the server up and running. You can make TCP requests to it in different ways. More commonly, you will prefer to write your own clients to connect to the camera remotely. Check out the following client examples below:
- Running the C++ client example
- Running the Python 3 client example