【发布时间】:2015-03-09 01:51:53
【问题描述】:
我们有一个 OpenCV 项目,它使用其 Python 绑定对视频文件运行一些运动检测。我们使用我们构建的工具中的一些手动输入的输入构建了一系列准确性测试,我们注意到一些奇怪的东西。
我们在 OS X 上使用 OpenCV 2.4.9,通过 Homebrew 安装,在 Ubuntu 上使用 2.4.10,从源代码编译。我们在几台不同的机器上进行了测试,并注意到我们在 OS X 上的准确度得分要高得多——平均约为 70%,而 Ubuntu 的得分平均约为 15%。
造成这种差异的最可能原因是什么?我会假设劣质硬件会导致测试运行更慢,但不确定是什么会导致准确性发生如此剧烈的变化。也许是视频编解码器?是否有任何适用于 Ubuntu、开源或其他方面的软件包可以改善这一点?
已安装依赖项:
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg
cmake 参数:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
brew info opencv 在 Mac 上的输出:
opencv: stable 2.4.9, HEAD
http://opencv.org/
/usr/local/Cellar/opencv/2.4.9 (219 files, 38M) *
Built from source with: --with-gstreamer
From: https://github.com/homebrew/homebrew-science/blob/master/opencv.rb
==> Dependencies
Build: cmake ✘, pkg-config ✔
Required: jpeg ✔, libpng ✔, libtiff ✔
Recommended: eigen ✘, openexr ✔
Optional: gstreamer ✘, jasper ✘, libdc1394 ✘, openni ✘, qt ✘, tbb ✘, ffmpeg ✔
==> Options
--32-bit
Build 32-bit only
--c++11
Build using C++11 mode
--with-cuda
Build with CUDA support
--with-ffmpeg
Build with ffmpeg support
--with-gstreamer
Build with gstreamer support
--with-jasper
Build with jasper support
--with-java
Build with Java support
--with-libdc1394
Build with libdc1394 support
--with-openni
Build with openni support
--with-qt
Build the Qt4 backend to HighGUI
--with-quicktime
Use QuickTime for Video I/O insted of QTKit
--with-tbb
Enable parallel code in OpenCV using Intel TBB
--with-tests
Build with accuracy & performance tests
--without-eigen
Build without eigen support
--without-opencl
Disable GPU code in OpenCV using OpenCL
--without-openexr
Build without openexr support
--HEAD
install HEAD version
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> homebrew.pth
【问题讨论】:
-
opencv 是一个相当广泛的话题。但我不确定(我希望)对于相同的视频,您是否使用相同的级联文件运行检测,或者您是否也在每台机器上独立构建级联文件?第一步是在两台计算机上使用相同的级联文件。
标签: python linux macos opencv ubuntu