Ask Your Question

Revision history [back]

Why self compiled Opencv is slower than apt-get package?

Hi community.

I have 2 opencv package: one is self-compiled opencv3.1 with cuda and the other is installed using sudo apt-get install ros-kinetic-opencv3.

When I tried the same program on different packages, it appears my self compiled package is much slower than that in ROS.

Ex> Template matching with ORB My opencv3.1 : 150 - 200 ms per frame ROS opencv3.2.0-dev : 40~50ms per frame

This is tested in python, but I also find my c++ codes have a similar result.

Q1. Do you know why it happen and can I fix with recompile with some cmake prefix? Q2. Can I pick ROS opencv package for normal cpu function and pick my own package for cuda function?

Thank you.

Why self compiled Opencv is slower than apt-get package?

Hi community.

I have 2 opencv package: one is self-compiled opencv3.1 with cuda and the other is installed using sudo apt-get install ros-kinetic-opencv3.

When I tried the same program on different packages, it appears my self compiled package is much slower than that in ROS.

Ex> Template matching with ORB ORB

My opencv3.1         : 150 - 200 ms per frame
frame 
ROS opencv3.2.0-dev : 40~50ms per frame

frame

This is tested in python, but I also find my c++ codes have a similar result.

Q1. Do you know why it happen and can I fix with recompile with some cmake prefix? Q2. Can I pick ROS opencv package for normal cpu function and pick my own package for cuda function?

Thank you.

Why self compiled Opencv is slower than apt-get package?

Hi community.

I have 2 opencv package: one is self-compiled opencv3.1 with cuda and the other is installed using sudo apt-get install ros-kinetic-opencv3.

When I tried the same program on different packages, it appears my self compiled package is much slower than that in ROS.

Ex> Template matching with ORB

My opencv3.1        : 150 - 200 ms per frame 
ROS opencv3.2.0-dev : 40~50ms per frame

This is tested in python, but I also find my c++ codes have a similar result.

Q1. Do you know why it happen and can I fix with recompile this by recompiling with some cmake prefix? prefix?

Q2. Can I pick ROS opencv package for normal cpu function and pick my own package for cuda function?

Thank you.

Why self compiled Opencv is slower than apt-get package?

Hi community.

I have 2 opencv package: one is self-compiled opencv3.1 with cuda and the other is installed using sudo apt-get install ros-kinetic-opencv3.

When I tried the same program on different packages, it appears my self compiled package is much slower than that in ROS.

Ex> Template matching with ORB

My opencv3.1        : 150 - 200 ms per frame 
ROS opencv3.2.0-dev : 40~50ms per frame

This is tested in python, but I also find my c++ codes have a similar result.

Here shows getBuildInformation() result in each version.

1.Self compiled opencv

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0-3-g50b7dfd-dirty

  Platform:
    Host:                        Linux 3.10.96-tegra aarch64
    CMake:                       3.5.1
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               RelWithDebugInfo

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):
    Linker flags (Debug):
    Precompiled headers:         NO
    Extra dependencies:          Qt5::Test Qt5::Concurrent Qt5::OpenGL /usr/lib/aarch64-linux-gnu/libwebp.so /usr/lib/aarch64-linux-gnu/libpng.so /usr/lib/aarch64-linux-gnu/libtiff.so /usr/lib/aarch64-linux-gnu/libjasper.so /usr/lib/aarch64-linux-gnu/libjpeg.so v4l1 v4l2 avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg /usr/lib/aarch64-linux-gnu/libbz2.so Qt5::Core Qt5::Gui Qt5::Widgets /usr/lib/aarch64-linux-gnu/hdf5/serial/lib/libhdf5.so /usr/lib/aarch64-linux-gnu/libpthread.so /usr/lib/aarch64-linux-gnu/libsz.so /usr/lib/aarch64-linux-gnu/libz.so /usr/lib/aarch64-linux-gnu/libdl.so /usr/lib/aarch64-linux-gnu/libm.so correspondence multiview numeric glog gflags dl m pthread rt /usr/lib/aarch64-linux-gnu/libGLU.so /usr/lib/aarch64-linux-gnu/libGL.so tbb atomic cudart nppc nppi npps cufft -L/usr/local/cuda-8.0/lib64
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 cudev core cudaarithm flann hdf imgproc ml reg surface_matching video cudabgsegm cudafilters cudaimgproc cudawarping dnn fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo cvv datasets rgbd stereo structured_light superres tracking videostab xfeatures2d ximgproc aruco optflow sfm stitching python2
    Disabled:                    world contrib_world
    Disabled by dependency:      -
    Unavailable:                 java python3 viz matlab

  GUI: 
    QT 5.x:                      YES (ver 5.5.1)
    QT OpenGL support:           YES (Qt5::OpenGL 5.5.1)
    OpenGL support:              YES (/usr/lib/aarch64-linux-gnu/libGLU.so /usr/lib/aarch64-linux-gnu/libGL.so)
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.8)
    JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver )
    WEBP:                        /usr/lib/aarch64-linux-gnu/libwebp.so (ver encoder: 0x0202)
    PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.2.54)
    TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
    JPEG 2000:                   /usr/lib/aarch64-linux-gnu/libjasper.so (ver 1.900.1)
    OpenEXR:                     NO
    GDAL:                        NO

  Video I/O:
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES
      codec:                     YES (ver 56.60.100)
      format:                    YES (ver 56.40.101)
      util:                      YES (ver 54.31.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    UniCap:                      NO
    UniCap ucil:                 NO
    V4L/V4L2:                    Using libv4l1 (ver 1.10.0) / libv4l2 (ver 1.10.0)
    XIMEA:                       NO
    Xine:                        NO
    gPhoto2:                     NO

  Parallel framework:            TBB (ver 4.4 interface 9002)

  Other third-party libraries:
    Use IPP:                     NO
    Use VA:                      NO
    Use Intel VA-API/OpenCL:     NO
    Use Eigen:                   YES (ver 3.2.92)
    Use Cuda:                    YES (ver 8.0)
    Use OpenCL:                  NO
    Use custom HAL:              NO

  NVIDIA CUDA
    Use CUFFT:                   YES
    Use CUBLAS:                  NO
    USE NVCUVID:                 NO
    NVIDIA GPU arch:             52
    NVIDIA PTX archs:            52
    Use fast math:               NO

  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.12)
    numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
    packages path:               lib/python2.7/dist-packages

  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.5.2)

  Python (for build):            /usr/bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Documentation:
    Doxygen:                     NO
    PlantUML:                    NO

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              YES

  Install path:                  /usr/local

  cvconfig.h is in:              /home/ubuntu/opencv/build
-----------------------------------------------------------------

ros-kinetic-opencv

General configuration for OpenCV 3.2.0-dev =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/opencv_contrib
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2017-06-07T18:53:03Z
    Host:                        Linux 3.13.0-48-generic aarch64
    CMake:                       3.5.1
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               None

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/lib/ccache/aarch64-linux-gnu-g++  (ver 5.4.0)
    C++ flags (Release):         -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/lib/ccache/aarch64-linux-gnu-gcc
    C flags (Release):           -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2    -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):
    Linker flags (Debug):
    ccache:                      YES
    Precompiled headers:         NO
    Extra dependencies:          Qt5::Test Qt5::Concurrent /usr/lib/aarch64-linux-gnu/libwebp.so /usr/lib/aarch64-linux-gnu/libjasper.so avcodec-ffmpeg avformat-ffmpeg avutil-ffmpeg swscale-ffmpeg Qt5::Core Qt5::Gui Qt5::Widgets /usr/lib/aarch64-linux-gnu/hdf5/serial/lib/libhdf5.so /usr/lib/aarch64-linux-gnu/libpthread.so /usr/lib/aarch64-linux-gnu/libsz.so /usr/lib/aarch64-linux-gnu/libdl.so /usr/lib/aarch64-linux-gnu/libm.so vtkRenderingOpenGL vtkImagingHybrid vtkIOImage vtkCommonDataModel vtkCommonMath vtkCommonCore vtksys vtkCommonMisc vtkCommonSystem vtkCommonTransforms vtkCommonExecutionModel vtkDICOMParser vtkIOCore /usr/lib/aarch64-linux-gnu/libz.so vtkmetaio /usr/lib/aarch64-linux-gnu/libjpeg.so /usr/lib/aarch64-linux-gnu/libpng.so /usr/lib/aarch64-linux-gnu/libtiff.so vtkImagingCore vtkRenderingCore vtkCommonColor vtkFiltersExtraction vtkFiltersCore vtkFiltersGeneral vtkCommonComputationalGeometry vtkFiltersStatistics vtkImagingFourier vtkalglib vtkFiltersGeometry vtkFiltersSources vtkInteractionStyle vtkRenderingLOD vtkFiltersModeling vtkIOPLY vtkIOGeometry /usr/lib/aarch64-linux-gnu/libjsoncpp.so vtkFiltersTexture vtkRenderingFreeType /usr/lib/aarch64-linux-gnu/libfreetype.so vtkftgl vtkIOExport vtkRenderingAnnotation vtkImagingColor vtkRenderingContext2D vtkRenderingGL2PS vtkRenderingContextOpenGL /usr/lib/libgl2ps.so vtkRenderingLabel dl m pthread rt
    3rdparty dependencies:       IlmImf tegra_hal

  OpenCV modules:
    To be built:                 core flann hdf imgproc ml photo reg surface_matching video viz fuzzy imgcodecs shape videoio highgui objdetect plot superres xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cvv datasets rgbd stereo videostab xfeatures2d ximgproc aruco optflow phase_unwrapping stitching structured_light python2
    Disabled:                    world contrib_world
    Disabled by dependency:      tracking
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3 ts cnn_3dobj freetype matlab sfm

  GUI: 
    QT 5.x:                      YES (ver 5.5.1)
    QT OpenGL support:           NO
    OpenGL support:              NO
    VTK support:                 YES (ver 6.2.0)

  Media I/O: 
    ZLib:                        /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.8)
    JPEG:                        /usr/lib/aarch64-linux-gnu/libjpeg.so (ver )
    WEBP:                        /usr/lib/aarch64-linux-gnu/libwebp.so (ver encoder: 0x0202)
    PNG:                         /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.2.54)
    TIFF:                        /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
    JPEG 2000:                   /usr/lib/aarch64-linux-gnu/libjasper.so (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO
    GDCM:                        NO

  Video I/O:
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES
      avcodec:                   YES (ver 56.60.100)
      avformat:                  YES (ver 56.40.101)
      avutil:                    YES (ver 54.31.100)
      swscale:                   YES (ver 3.1.101)
      avresample:                NO
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    Aravis SDK:                  NO
    UniCap:                      NO
    UniCap ucil:                 NO
    V4L/V4L2:                    NO/YES
    XIMEA:                       NO
    Xine:                        NO
    gPhoto2:                     NO

  Parallel framework:            pthreads

  Other third-party libraries:
    Use IPP:                     NO
    Use VA:                      NO
    Use Intel VA-API/OpenCL:     NO
    Use Lapack:                  NO
    Use Eigen:                   YES (ver 3.2.92)
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use OpenVX:                  NO
    Use custom HAL:              YES (carotene (ver 0.0.1))

  OpenCL:                        <Dynamic loading of OpenCL library>
    Include path:                /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/3rdparty/include/opencl/1.2
    Use AMDFFT:                  NO
    Use AMDBLAS:                 NO

  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
    Libraries:                   /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.12)
    numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
    packages path:               lib/python2.7/dist-packages

  Python 3:
    Interpreter:                 /usr/bin/python3 (ver 3.5.2)

  Python (for build):            /usr/bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Documentation:
    Doxygen:                     NO

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  /opt/ros/kinetic

  cvconfig.h is in:              /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/obj-aarch64-linux-gnu
-----------------------------------------------------------------

Q1. Do you know why it happen and can I fix this by recompiling with some cmake prefix?

Q2. Can I pick ROS opencv package for normal cpu function and pick my own package for cuda function?

Thank you.