I am using OpenCV 3.0 in my Java application through the opencv-300.jar
and opencv_java300.dll
. They come with the standard installation. But some extra modules are not in the standard installation. So I build an OpenCV 3.0 with the opencv-contrib repo.
But the build generates about 40 binaries. How can I generate something like opencv-300.jar
and opencv_java300.dll
for Java adoption? Do I need to turn to SWIG or something?
ADD 1
I see the following log in the cmake-gui
generation process:
Java:
ant: C:/apache-ant-1.9.4/bin/ant.bat (ver
1.9.4)
JNI: C:/Java/jdk1.6.0_45_32bit/include C:/Java/jdk1.6.0_45_32bit/include/win32 C:/Java/jdk1.6.0_45_32bit/include
Java wrappers: NO
Java tests: NO
Could this be the reason?
The complete log is below:
found IPP (ICV version): 8.2.1 [8.2.1]
at: E:/Softwares/OpenCV/OpenCV3.0.0/opencv/sources/3rdparty/ippicv/unpack/ippicv_win
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "2.7" (found C:/Python/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "2.6" (found C:/Python/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "3.4" (found C:/Python/Python27/python.exe)
Could NOT find PythonInterp: Found unsuitable version "1.4", but required is at least "3.2" (found C:/Python/Python27/python.exe)
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
Found apache ant 1.9.4: C:/apache-ant-1.9.4/bin/ant.bat
ERROR:
The system was unable to find the specified registry key or value.
ERROR:
The system was unable to find the specified registry key or value.
Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Tesseract: NO
videoio: Removing WinRT API headers by default
Tesseract: NO
General configuration for OpenCV 3.0.0 =====================================
Version control: unknown
Platform:
Host: Windows 6.1 AMD64
CMake: 3.1.3
CMake generator: Visual Studio 12 2013
CMake build tool: C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe
MSVC: 1800
C/C++:
Built as dynamic libs?: NO
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe (ver 18.0.31101.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /MP4 /MT /O2 /Ob2 /D NDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /wd4324 /MP4 /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MP4 /MT /O2 /Ob2 /D NDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MP4 /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:X86 /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /INCREMENTAL:NO /debug /NODEFAULTLIB:libcmtd.lib
Linker flags (Debug): /machine:X86 /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib /debug /INCREMENTAL /NODEFAULTLIB:libcmt.lib
Precompiled headers: YES
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32
3rdparty dependencies: zlib libjpeg libwebp libpng libtiff libjasper IlmImf ippicv
OpenCV modules:
To be built: hal core flann imgproc ml photo reg surface_matching video face imgcodecs shape videoio highgui objdetect optflow superres tracking ts xobjdetect xphoto adas bgsegm bioinspired features2d latentsvm line_descriptor saliency text calib3d ccalib datasets rgbd stereo videostab xfeatures2d ximgproc stitching
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz cvv matlab
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.8)
JPEG: build (ver 90)
WEBP: build (ver 0.3.1)
PNG: build (ver 1.5.12)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
resample: NO
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Other third-party libraries:
Use IPP: 8.2.1 [8.2.1]
at: E:/Softwares/OpenCV/OpenCV3.0.0/opencv/sources/3rdparty/ippicv/unpack/ippicv_win
Use IPP Async: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency YES
Use C=: NO
Use pthreads for parallel for:
NO
Use Cuda: NO
Use OpenCL: YES
OpenCL:
Version: dynamic
Include path: E:/Softwares/OpenCV/OpenCV3.0.0/opencv/sources/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: NO
Python 3:
Interpreter: NO
Python (for build): NO
Java:
ant: C:/apache-ant-1.9.4/bin/ant.bat (ver 1.9.4)
JNI: C:/Java/jdk1.6.0_45_32bit/include C:/Java/jdk1.6.0_45_32bit/include/win32 C:/Java/jdk1.6.0_45_32bit/include
Java wrappers: NO
Java tests: NO
Matlab:
mex: NO
Documentation:
Doxygen: NO
PlantUML: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: E:/Softwares/OpenCV/OpenCV3.0.0/opencv/build.with_extra_modules/install
cvconfig.h is in: E:/Softwares/OpenCV/OpenCV3.0.0/opencv/build.with_extra_modules
-----------------------------------------------------------------
Configuring done
Generating done
ADD 2
Since the issue may be related to the missing Python Interpreter, I uninstalled the 64bit python27 and python34. And reinstalled the x86 version of python 2.7.10
. Now CMake reports this error:
Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.4" (found C:/Python/Python27x86/python.exe)
Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.2" (found C:/Python/Python27x86/python.exe)
At least the Python 1.4 issue is gone. Now I am trying to install the python 3.4.3
Add 3
I installed both python 3.4.3
and python 2.7.10
. (Though it seems they messed up with my %PATH% environment variable.)
Now I happily see this in the CMake generation log:
Python 2:
Interpreter: C:/Python/Python27x86/python.exe (ver 2.7.10)
Python 3:
Interpreter: (ver 3.4.3)
Python (for build): C:/Python/Python27x86/python.exe
Java:
ant: C:/apache-ant-1.9.4/bin/ant.bat (ver 1.9.4)
JNI: C:/Java/jdk1.6.0_45_32bit/include C:/Java/jdk1.6.0_45_32bit/include/win32 C:/Java/jdk1.6.0_45_32bit/include
Java wrappers: YES
Java tests: YES
Now I am rebuilding the INSTALL
project. God speed.
Add 4
The opencv-300.jar
and opencv_java300.dll
shows up like a charm in the Install\java
folder! Since it's DEBUG build, the size is as big as 37M
.
Many thanks to berak
for accompanying me through this.