OpenCV在OS X上比Linux更准确

时间:2015-01-11 00:20:47

标签: python linux macos opencv ubuntu

我们有一个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 ..

在Mac上输出brew info opencv

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

1 个答案:

答案 0 :(得分:1)

如您所说,变体可能来自与编解码器相关的问题,或者您似乎没有使用相同版本的opencv。但重点是,你观察到的主要差异很可能来自你的测试的敏感性(例如,如果某些东西略低于某个阈值,它会停止显示,打破整个检测,从而打破分数),而不是两者之间的主要区别。安装。

除了单独测试您使用的所有cv2方法以查看每次安装之间不同的方法之外,我没有别的办法。或者至少在测试过程中打印一些中间结果,以获得有关差异开始出现的更多细节。

然后,您应该能够更多地了解正在发生的事情,或者使用更具体的背景来编辑您的问题。同样,我认为全球差异值在此阶段无关紧要。