upgrade to bionic in travis
MODIFY
.travis.yml
.travis.yml
@@ -12,7 +12,7 @@ cache:
- $HOME/build/opencv
sudo: true
-dist: xenial
+dist: bionic
addons:
apt:
@@ -34,7 +34,6 @@ addons:
- libgoogle-glog-dev
- libgphoto2-dev
- libgstreamer-plugins-base1.0-dev
- - libgstreamer1.0-dev
- libharfbuzz-dev
- libhdf5-dev
- libjpeg-dev
@@ -46,7 +45,7 @@ addons:
- libtbb-dev
- libtesseract-dev
- libtiff-dev
- - libvtk6-dev
+ - libvtk7-dev
- libwebp-dev
- qtbase5-dev
- tree
@@ -61,7 +60,7 @@ env:
- OPENCV_VERSION=4.1.1 OPENCV_PKGCONFIG=opencv4 CARGO_FEATURES=opencv-41
before_script:
- - ci/install-opencv.sh
+ - ci/bionic-install-opencv.sh
- pkg-config --cflags $OPENCV_PKGCONFIG
- pkg-config --libs $OPENCV_PKGCONFIG

MODIFY
README.md
README.md
@@ -126,7 +126,7 @@ for compiling OpenCV for your platform. Make sure to compile from the
correct release tag! We recommend including opencv_contrib and
configuring your build with the same flags the travis build uses:
-[install-opencv.sh](https://github.com/twistedfall/opencv-rust/blob/master/ci/install-opencv.sh)
+[bionic-install-opencv.sh](https://github.com/twistedfall/opencv-rust/blob/master/ci/bionic-install-opencv.sh)
## Contrib modules

ADD
ci/bionic-install-opencv.sh
+#!/bin/bash
+
+set -ex
+
+BUILD_FLAGS="
+ -D BUILD_CUDA_STUBS=OFF
+ -D BUILD_DOCS=OFF
+ -D BUILD_EXAMPLES=OFF
+ -D BUILD_IPP_IW=ON
+ -D BUILD_ITT=ON
+ -D BUILD_JASPER=OFF
+ -D BUILD_JAVA=OFF
+ -D BUILD_JPEG=OFF
+ -D BUILD_OPENEXR=OFF
+ -D BUILD_PERF_TESTS=OFF
+ -D BUILD_PNG=OFF
+ -D BUILD_PROTOBUF=ON
+ -D BUILD_SHARED_LIBS=ON
+ -D BUILD_TBB=OFF
+ -D BUILD_TESTS=OFF
+ -D BUILD_TIFF=OFF
+ -D BUILD_WEBP=OFF
+ -D BUILD_WITH_DEBUG_INFO=OFF
+ -D BUILD_WITH_DYNAMIC_IPP=OFF
+ -D BUILD_ZLIB=OFF
+ -D BUILD_opencv_apps=ALL
+ -D BUILD_opencv_python2=OFF
+ -D BUILD_opencv_python3=OFF
+ -D CMAKE_BUILD_TYPE=Release
+ -D CMAKE_INSTALL_PREFIX=/usr
+ -D CV_DISABLE_OPTIMIZATION=OFF
+ -D ENABLE_CONFIG_VERIFICATION=OFF
+ -D ENABLE_FAST_MATH=OFF
+ -D CV_ENABLE_INTRINSICS=ON
+ -D ENABLE_LTO=OFF
+ -D ENABLE_PIC=ON
+ -D ENABLE_PRECOMPILED_HEADERS=OFF
+ -D INSTALL_CREATE_DISTRIB=OFF
+ -D INSTALL_PYTHON_EXAMPLES=OFF
+ -D INSTALL_C_EXAMPLES=OFF
+ -D INSTALL_TESTS=OFF
+ -D OPENCV_ENABLE_NONFREE=ON
+ -D OPENCV_FORCE_3RDPARTY_BUILD=OFF
+ -D OPENCV_GENERATE_PKGCONFIG=ON
+ -D PROTOBUF_UPDATE_FILES=OFF
+ -D WITH_1394=ON
+ -D WITH_ADE=ON
+ -D WITH_ARAVIS=OFF
+ -D WITH_CLP=OFF
+ -D WITH_CUDA=OFF
+ -D WITH_EIGEN=ON
+ -D WITH_FFMPEG=ON
+ -D WITH_GDAL=ON
+ -D WITH_GDCM=OFF
+ -D WITH_GIGEAPI=OFF
+ -D WITH_GPHOTO2=ON
+ -D WITH_GSTREAMER=ON
+ -D WITH_GSTREAMER_0_10=OFF
+ -D WITH_GTK=OFF
+ -D WITH_GTK_2_X=OFF
+ -D WITH_HALIDE=OFF
+ -D WITH_IMGCODEC_HDcR=ON
+ -D WITH_IMGCODEC_PXM=ON
+ -D WITH_IMGCODEC_SUNRASTER=ON
+ -D WITH_INF_ENGINE=OFF
+ -D WITH_IPP=ON
+ -D WITH_ITT=ON
+ -D WITH_JASPER=OFF
+ -D WITH_JPEG=ON
+ -D WITH_LAPACK=ON
+ -D WITH_LIBV4L=OFF
+ -D WITH_MATLAB=OFF
+ -D WITH_MFX=OFF
+ -D WITH_OPENCL=ON
+ -D WITH_OPENCLAMDBLAS=ON
+ -D WITH_OPENCLAMDFFT=ON
+ -D WITH_OPENCL_SVM=ON
+ -D WITH_OPENEXR=ON
+ -D WITH_OPENGL=ON
+ -D WITH_OPENMP=OFF
+ -D WITH_OPENNI=OFF
+ -D WITH_OPENNI2=OFF
+ -D WITH_OPENVX=OFF
+ -D WITH_PNG=ON
+ -D WITH_PROTOBUF=ON
+ -D WITH_PTHREADS_PF=ON
+ -D WITH_PVAPI=OFF
+ -D WITH_QT=ON
+ -D WITH_QUIRC=ON
+ -D WITH_TBB=ON
+ -D WITH_TIFF=ON
+ -D WITH_UNICAP=OFF
+ -D WITH_V4L=ON
+ -D WITH_VA=ON
+ -D WITH_VA_INTEL=ON
+ -D WITH_VTK=ON
+ -D WITH_WEBP=ON
+ -D WITH_XIMEA=OFF
+ -D WITH_XINE=OFF"
+
+if [[ "$OPENCV_VERSION" == "3.2.0" ]]; then
+ sudo apt -y install libopencv-dev=3.2.0*
+else
+ mkdir -p ~/build/opencv
+
+ wget -q -O- "https://github.com/opencv/opencv/archive/$OPENCV_VERSION.tar.gz" | tar -xzC ~/build/opencv
+ wget -q -O- "https://github.com/opencv/opencv_contrib/archive/$OPENCV_VERSION.tar.gz" | tar -xzC ~/build/opencv
+
+ mkdir -p ~/"build/opencv/opencv-$OPENCV_VERSION-build"
+ pushd ~/"build/opencv/opencv-$OPENCV_VERSION-build" > /dev/null
+ cmake $BUILD_FLAGS \
+ -D CMAKE_INSTALL_PREFIX=/usr \
+ -D OPENCV_EXTRA_MODULES_PATH=~/"build/opencv/opencv_contrib-$OPENCV_VERSION/modules" \
+ ~/"build/opencv/opencv-$OPENCV_VERSION"
+ sudo make -j"$(nproc)" install
+ tree .
+ popd > /dev/null
+fi

RENAME
ci/install-opencv.sh
ci/xenial-install-opencv.sh
MODIFY
tests/dnn.rs
tests/dnn.rs
@@ -10,10 +10,10 @@ use opencv::{
};
#[test]
+#[cfg(not(feature = "opencv-32"))]
fn net() -> Result<()> {
let mut net = Net::default()?;
assert!(net.empty()?);
- #[cfg(not(feature = "opencv-32"))]
net.enable_fusion(false)?;
let mut params = LayerParams::default()?;
assert_eq!(params.name()?, "");
@@ -30,18 +30,16 @@ fn net() -> Result<()> {
let res = net.add_layer("layer", "type", &mut params)?;
assert_ne!(-1, res);
assert!(!net.empty()?);
- #[cfg(not(feature = "opencv-32"))]
- {
let mut blobs = VectorOfMat::new();
blobs.push(Mat::default()?);
params.set_blobs(blobs)?;
let blobs = params.blobs()?;
assert_eq!(1, blobs.len());
- }
Ok(())
}
#[test]
+#[cfg(not(feature = "opencv-32"))]
fn dict() -> Result<()> {
{
let v = DictValue::from_f64(123.456)?;
@@ -51,12 +49,9 @@ fn dict() -> Result<()> {
assert_eq!(1, v.size()?);
assert_eq!(123.456, v.get_f64(-1)?);
assert_matches!(v.get_i64(-1), Err(Error{code: core::StsAssert, ..}));
- #[cfg(not(feature = "opencv-32"))]
- {
assert_eq!(123.456, v.get_real_value(-1)?);
assert_matches!(v.get_int_value(-1), Err(Error{code: core::StsAssert, ..}));
}
- }
{
let v = DictValue::from_i64(123)?;
@@ -66,13 +61,10 @@ fn dict() -> Result<()> {
assert_eq!(1, v.size()?);
assert_eq!(123, v.get_i64(-1)?);
assert_eq!(123., v.get_f64(-1)?);
- #[cfg(not(feature = "opencv-32"))]
- {
assert_eq!(123, v.get_int_value(-1)?);
assert_eq!(123., v.get_real_value(-1)?);
assert_matches!(v.get_string_value(-1), Err(Error{code: core::StsAssert, ..}));
}
- }
{
let v = DictValue::from_str("876543.123")?;
@@ -81,12 +73,9 @@ fn dict() -> Result<()> {
assert!(v.is_string()?);
assert_eq!(1, v.size()?);
assert_eq!("876543.123", v.get_string(-1)?);
- #[cfg(not(feature = "opencv-32"))]
- {
assert_eq!(876543, v.get_i64(-1)?);
assert_eq!(876543.123, v.get_real_value(-1)?);
assert_eq!("876543.123", v.get_string_value(-1)?);
}
- }
Ok(())
}

upgrade to bionic in travis