Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Build Opencv 3.1 + Contrib (face module) for Java

Hi guys,

I'm looking to use in my Java application the face recognition features provided in the contrib modules but I'm facing a blocking issue : I can't manage to build the opencv_java310.dll.

I have read a lot and tried all that I could think about and today I'm requesting your help please.

In brief, the log file (opencv\build\modules\java\opencv_java.dir\Debug\opencv_java.log) after the build process fails show:

[...] face.cpp
1>C:\DEV\C\opencv\build\modules\java\face.cpp(1726): error C2664: 'bool cv::face::TopNPredictCollector::filter(int *,double *,const int)' : cannot convert argument 1 from 'jint *' to 'int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

1>C:\DEV\C\opencv\build\modules\java\face.cpp(1961): error C2664: 'bool cv::face::PredictCollector::defaultFilter(int *,double *,const int)' : cannot convert argument 1 from 'jint *' to 'int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

1>C:\DEV\C\opencv\build\modules\java\face.cpp(2032): error C2664: 'bool cv::face::PredictCollector::filter(int *,double *,const int)' : cannot convert argument 1 from 'jint *' to 'int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

1>C:\DEV\C\opencv\build\modules\java\face.cpp(2504): error C2664: 'bool cv::face::MinDistancePredictCollector::filter(int *,double *,const int)' : cannot convert argument 1 from 'jint *' to 'int *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

1>Done Building Project "C:\DEV\C\opencv\build\modules\java\opencv_java.vcxproj" (Rebuild target(s)) -- FAILED.

My cmake log shows: -Python 3.4.4 64 bits -Ant 1.8.4 -Java jdk 1.7 64 bits

I'm building with Visual Studio 12 (2013)

Below are the changes I made in cmake:

  • BUILD_SHARED_LIBS:BOOL=0
  • BUILD_opencv_line_descriptor:BOOL=0
  • BUILD_opencv_bgsegm:BOOL=0
  • OPENCV_EXTRA_MODULES_PATH:PATH=C:/DEV/C/opencv_contrib-master/modules
  • BUILD_opencv_rgbd:BOOL=0
  • BUILD_opencv_stitching:BOOL=0
  • BUILD_TESTS:BOOL=0
  • BUILD_opencv_surface_matching:BOOL=0
  • BUILD_opencv_videostab:BOOL=0
  • BUILD_opencv_saliency:BOOL=0
  • BUILD_opencv_reg:BOOL=0
  • BUILD_opencv_bioinspired:BOOL=0
  • BUILD_opencv_calib3d:BOOL=0
  • BUILD_PERF_TESTS:BOOL=0
  • BUILD_opencv_datasets:BOOL=0
  • BUILD_opencv_features2d:BOOL=0
  • BUILD_DOCS:BOOL=0
  • BUILD_opencv_ccalib:BOOL=0
  • BUILD_opencv_optflow:BOOL=0

I have also tried to build contrib with the version 2.4.9 and 3.0 in case there was a compatibiliy issue but no luck.

Please let me know if you need any other information. That's my last hope I fear. Thanks.