Difference between revisions of "Birds Eye View/Getting the Code/Building and Installation Guide"
(→Build library and examples) |
(→Build library and examples) |
||
Line 91: | Line 91: | ||
cd bird-eye-view | cd bird-eye-view | ||
mkdir build | mkdir build | ||
+ | cd build | ||
meson .. | meson .. | ||
ninja | ninja |
Revision as of 10:40, 8 January 2020
Birds Eye View |
---|
![]() |
Introduction |
Getting the Code |
Getting Started |
Examples |
Library Docs |
Performance |
Contact Us |
Contents
Building OpenCV with GStreamer support
1. Install previous GStreamer dependencies
sudo apt-get install gstreamer1.0*
sudo apt install ubuntu-restricted-extras
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
2. Install compiler and building dependencies
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
pip3 install numpy
3. Obtain source code from Github
git clone https://github.com/opencv/opencv.git
cd opencv/
git checkout 4.1.0
4. Configure with required flags
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D BUILD_opencv_python2=OFF \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D WITH_GSTREAMER=ON \
-D BUILD_EXAMPLES=ON ..
5. Check configuration log
✔ Verify if it has Python 3: section and all interpreter and path are right. (If they aren’t there, check the numpy package)
✔ Check the GStreamer section. (If it does not indicate YES, go check GStreamer lib package)
6. Building
It will last some time. Please be patient.
sudo make -j4
7. Install the package
sudo make install
sudo ldconfig
Birds eye view library and examples installation
System Dependencies
Birds eye view has the following system dependencies:
- meson
- ninja
- boost
- opencv 3.1.0 (or higher version)
Build library and examples
git clone https://gitlab.com/RidgeRun/rnd/bird-eye-view.git
cd bird-eye-view
mkdir build
cd build
meson ..
ninja
Now you will find the example files:
Patch to support 4 USB cameras
When using more than 2 USB cameras it is necessary to jump over the bandwidth restriction imposed by the generic usb driver, which is not capable of requesting the correct image size therefore requests the max size. It is necessary to recompile the driver after applying the required patch.
1. Download the kernel source
sudo apt-get source linux-image-unsigned-$(uname -r)
cd $(uname -r)/drivers/media/usb/uvc/
mkdir patches
cd patches
If you get this error:
E: You must put some 'source' URIs in your sources.list
Run the following commands:
sudo cp /etc/apt/sources.list /etc/apt/sources.list~
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
2. Create the patch file
vim 001-uvc-add-compressed-video-bandwidth-parameter.patch
Index: ./uvc_video.c
===================================================================
--- ./uvc_video.c
+++ ./uvc_video.c
@@ -161,6 +161,11 @@ static void uvc_fixup_video_ctrl(struct
ctrl->dwMaxPayloadTransferSize = bandwidth;
}
+
+ if (format->flags & UVC_FMT_FLAG_COMPRESSED) {
+ ctrl->dwMaxPayloadTransferSize = 0x300;
+ }
+
}
static int uvc_get_video_ctrl(struct uvc_streaming *stream,
3. Setup the series file:
echo 001-uvc-add-compressed-video-bandwidth-parameter.patch > series
cd ..
4. Apply the patch:
quilt push
5. Compile and reload the kernel module:
sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
sudo rmmod uvcvideo
sudo insmod uvcvideo.ko