Building - viscloud/saf GitHub Wiki
First install OpenCV 3.x.
If you have issues installing OpenCV from source, then try using this CMake command:
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_CUDA=OFF -DBUILD_SHARED_LIBS=OFF -DWITH_IPP=OFF -DBUILD_PROTOBUF=OFF -DBUILD_opencv_dnn=OFF BUILD_EXAMPLES=OFF BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF BUILD_opencv_apps=OFF ..Standard packages:
sudo apt update
sudo apt install -y cmake libglib2.0-dev libgoogle-glog-dev \
libboost-all-dev libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgstreamer-plugins-bad1.0-dev gstreamer1.0-libav libjemalloc-dev \
libzmq3-dev libeigen3-dev libjsoncpp-dev libcurl4-gnutls-dev \
libprotobuf-dev protobuf-compiler gitIf you are building with -DUSE_MQTT=yes, then SAF has one additional dependency:
sudo apt install -y libssl-devIf you are building with -DUSE_WEBSOCKET=yes, then SAF has two additional dependencies:
sudo apt install -y libwebsocketpp-dev libcpprest-devPlease see the main README for a quick start guide on how to compile and run SAF.
-
Control the backend
- Use CPU:
-DBACKEND=cpu - Use CUDA device:
-DBACKEND=cuda - Use OpenCL device:
-DBACKEND=opencl
- Use CPU:
-
Add deep learning frameworks
- Use Caffe:
-DUSE_CAFFE=yes -DCAFFE_HOME=<path to Caffe>/distribute - Use TensorFlow (see this page for details):
-DUSE_TENSORFLOW=yes -DTENSORFLOW_HOME=<path to TensorFlow
- Use Caffe:
-
Enable additional camera types
- Build with the PtGray SDK for their GigE cameras:
-DUSE_PTGRAY=yes - Build with the Vimba SDK for Allied Vision cameras:
-DUSE_VIMBA=yes -DVIMBA_HOME=<path to Vimba_2_1>
- Build with the PtGray SDK for their GigE cameras:
-
Configure gRPC support. (Note that SAF already includes ZeroMQ support by default, which can be used for publishing and subscribing to streams. This option adds gRPC as an alternative way to connect SAF instances running on different machines.)
- Build with gRPC support (see [this page](https://github.com/viscloud/saf/wiki/Building:-gRPC-Support for details):
-DUSE_RPC=yes
- Build with gRPC support (see [this page](https://github.com/viscloud/saf/wiki/Building:-gRPC-Support for details):
By default, SAF tries to pick a good GStreamer encoder and decoder for
the platform (i.e., prefers hardware over software). To force SAF to use
other decoders and encoders, edit the config/config.toml file.
Running the gst-inspect-1.0 command (on Ubuntu, found in the gstreamer1.0-tools) lists the available encoders and decoders. The list varies
depending on which GStreamer plugins are installed.
GStreamer supports hardware-accelerated encode and/or decode on some hardware through VA-API. On Ubuntu, there are two steps:
- Install the
gstreamer1.0-vaapipackage. - Become part of the
videogroup (usuallysudo adduser <username> video). You may have to log out and log back in for the group change to take effect.
If these steps work, then gst-inspect-1.0 | grep vaapi should return some results,
and the vainfo command should also succeed.