Установка OpenCV
Installing OpenCV 2.4.9 on Mac OSX with Python Support | jjyaptap [tap]
Tap a new formula repository from GitHub, or list existing taps.
tap is of the form user/repo, e.g. brew tap homebrew/dupes.
brew tap homebrew/science
brew info opencv
opencv: stable 2.4.9, HEAD http://opencv.org/ Not installed From: https://github.com/homebrew/homebrew-science/blob/master/opencv.rb ==> Dependencies Build: cmake ✘, pkg-config ✔ Required: jpeg ✔, libpng ✔, libtiff ✔ Recommended: openexr ✘ Optional: eigen ✘, 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-eigen Build with eigen 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-opencl Disable GPU code in OpenCV using OpenCL --without-openexr Build without openexr support --HEAD install HEAD version
OpenCV поддерживает работу со следующими технологиями:
- C++11
- CUDA
- Eigen (C++ library)
- FFmpeg
- GStreamer
- JasPer
- Java (programming language)
- libdc1394
- OpenNI
- Qt
- QuickTime
- Intel Threading Building Blocks
- OpenCL
- OpenEXR
brew install opencv
$ brew install opencv ==> Installing dependencies for opencv: cmake, ilmbase, openexr ==> Installing opencv dependency: cmake ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-3.0.1.mountain_lion.bottle.tar.gz ######################################################################## 100,0% ==> Pouring cmake-3.0.1.mountain_lion.bottle.tar.gz 🍺 /usr/local/Cellar/cmake/3.0.1: 1623 files, 27M ==> Installing opencv dependency: ilmbase ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ilmbase-2.1.0.mountain_lion.bottle.tar.gz ######################################################################## 100,0% ==> Pouring ilmbase-2.1.0.mountain_lion.bottle.tar.gz 🍺 /usr/local/Cellar/ilmbase/2.1.0: 75 files, 1,6M ==> Installing opencv dependency: openexr ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openexr-2.1.0.mountain_lion.bottle.tar.gz ######################################################################## 100,0% ==> Pouring openexr-2.1.0.mountain_lion.bottle.tar.gz 🍺 /usr/local/Cellar/openexr/2.1.0: 127 files, 7,0M ==> Installing opencv ==> Downloading https://github.com/Itseez/opencv/archive/2.4.9.tar.gz ######################################################################## 100,0% ==> cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv/2.4.9 -DCMAKE_BUILD_TYPE=None -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DCMAKE_OSX_DEPLOYMENT_TARGET= -DBUILD_ZLIB=OFF -DBUILD_TIFF=OFF -DBUILD_PNG=O ==> make ==> make install 🍺 /usr/local/Cellar/opencv/2.4.9: 217 files, 38M, built in 7.9 minutes
Я тут произвел установку без флага --with-java, но вам бы порекомендовал чтобы потом не переустанавливать.
Классическое введение: Introduction to programming with OpenCV
Установка JavaCV
1) Для работы с JavaCV устанавливать OpenCV не обязательно. Я например сразу удалил: brew uninstall opencv2) Со страницы проекта bytedeco/javacv нужно скопировать зависимость для Apache Maven.
При самостоятельной сборке надо убедиться что JAVA_HOME установлена правильно. Это можно сделать так: java - Where is JAVA_HOME on OSX Lion (10.7) , Mountain Lion (10.8) or Mavericks (10.9)? - Stack Overflow
3) Импорт пакетов:
import org.bytedeco.javacv.*;
import org.bytedeco.javacpp.*;
import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
import static org.bytedeco.javacpp.opencv_calib3d.*;
import static org.bytedeco.javacpp.opencv_objdetect.*;
import static org.bytedeco.javacpp.opencv_highgui.*;
4) Код:
IplImage colorImage = IplImage.create(640, 480, IPL_DEPTH_8U, 3);
cvZero(colorImage);
if (colorImage != null)
{
cvSaveImage("black.png", colorImage);
}
cvReleaseImage(colorImage);
java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path
Практически 100% это что-то с версиями. В моем случае проблема решилась понижением версии с 0.9 до 0.8 в Maven зависимости.
--
- eclipse - Using OpenCV in Java with JavaCV - Stack Overflow (-Djava.library.path=)
- netbeans - Missing file in java.library.path - Stack Overflow
- How to Load a Java Native/Shared Library (.jnilib) by calling System.loadLibrary or System.load (.dylib)
- My Question Library: JAVACV: no jniopencv_core in java.library.path (CLASSPATH)
- sklee74: Using OpenCV on Mac OS X with JavaCV (Eclipse) (jar, DYLD_FALLBACK_LIBRARY_PATH)
- Ask Yoda: Configure JavaCV on Mac OS X
- no jniopencv_core in java.library.path - viltran - 博客园
- Problems setting up Javacvpro in OSX Lion - Processing Forum
- java.lang.UnsatisfiedLinkError: no jniopencv_core in java.library.path in mac osx (DYLD_LIBRARY_PATH)