pre-built OpenCv with extra modules for java

asked 2020-12-04 06:32:31 -0500

fafafafa gravatar image

updated 2020-12-04 09:17:00 -0500

For two weeks, I have been trying to add extra modules especially face module to opencv without success,can I find pre-built OpenCv for java somewhere?? please if someone could help me with a link or send me prebuild opencv with face module in a .zip file , it's time to send my project I am stilling overwhelmed with downloading and installing,windows 7 ,jdk 15 , opencv 4.5.0

this is the cmake result with the genertor visual studio 2013 and when i start building in visual studio Iget errors as shown in the picture

General configuration for OpenCV 4.5.0 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            C:/Users/Mini/Downloads/opencv_contrib-4.5.0/modules
    Version control (extra):     unknown

    Timestamp:                   2020-12-04T12:59:37Z
    Host:                        Windows 6.1.7601 AMD64
    CMake:                       3.19.1
    CMake generator:             Visual Studio 12 2013
    CMake build tool:            C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe
    MSVC:                        1800

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (17 files):         + SSSE3 SSE4_1
      SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (5 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX

    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe  (ver 18.0.21005.1)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MT /O2 /Ob2 /DNDEBUG 
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MTd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/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 /Oi  /fp:precise     /MP   /MT /O2 /Ob2 /DNDEBUG 
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP /MTd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /NODEFAULTLIB:atlthunk.lib /INCREMENTAL:NO  /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib
    Linker flags (Debug):        /machine:x64  /NODEFAULTLIB:atlthunk.lib /debug /INCREMENTAL  /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib
    ccache:                      NO
    Precompiled headers:         YES
    Extra dependencies:          ade wsock32 comctl32 gdi32 ole32 setupapi ws2_32
    3rdparty dependencies:       ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc

  OpenCV modules:
    To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform java line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 alphamat cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect ...
edit retag flag offensive close merge delete


I have been trying to add extra modules

well, you could ask us about that, and we could try to help you getting it built.

send me prebuild opencv with face module in a .zip file

that is unlikely to happen, it also would need to fit your os, java sdk, etc.

please add at least opencv version / os / sdk version to your question

it's time to send my project

which is ? if it is about face recognition, you're probably better off, using the dnn based methods, which are in the main opencv repo, anyway

berak gravatar imageberak ( 2020-12-04 06:37:05 -0500 )edit

@berak okey , I am repeating the process in cmake using visual studio 2013, i will edit the post with the cmake result after it finishes the configutaion and generation , hope u help me to solve it , i am getting crazy with it my project is emotions detection i need the face module inorder to use eigenfaces

fafafafa gravatar imagefafafafa ( 2020-12-04 06:52:06 -0500 )edit

nice, that you try it again ;)

do you have the apache ant tool installed ? (you will need it !)

my project is emotions detection i need the face module inorder to use eigenfaces

do you have labelled data to train it ?

please also consider trying out some pretrained dnn for this

berak gravatar imageberak ( 2020-12-04 07:46:25 -0500 )edit

^^ cmake output looks good ! it will build both java bindings and the face module !

berak gravatar imageberak ( 2020-12-04 07:50:56 -0500 )edit

@berak will you believe me if I say that I try it with cmake more than 14 times in vain, yes I already have labbeled data and also a code for emotions detection using face module , I want to test them but this issues blocked me , apache ant already installed anyway you said that cmake output looks good , now I open the OpenCv.sln in visual studio 2013 inorder to buid it , should I start from release or debug? and from ALL BUILD or INSTALL

fafafafa gravatar imagefafafafa ( 2020-12-04 08:24:47 -0500 )edit

@berak last time when i finished the build I get the .jar file in the install folder but the .dll was missing

fafafafa gravatar imagefafafafa ( 2020-12-04 08:44:56 -0500 )edit

should I start from release or debug?

since you want mainly java, -- start with release

also, do your self a favour, and see that BUILD_SHARED_LIBS=OFF in cmake(-gui), so your opencv_java.dll won't depend on any other opencv dll's at runtime. (else you have to put the install/bin folder on the PATH to make it work)


i no more have VS here, and i don't remember. it's probably first ALL BUILD, then INSTALL

berak gravatar imageberak ( 2020-12-04 08:50:44 -0500 )edit

@berak, BUILD_SHARED_LIBS=OFF done , thanks a lot for your time ,I will try this in VS come back when it finishes, wish me good luck , it's the last try

fafafafa gravatar imagefafafafa ( 2020-12-04 08:57:10 -0500 )edit

@berak it's like every try , I got the same errors in VS ,don't know why

C:\Users\Mini\Downloads\opencv-4.5.0\opencv-4.5.0\modules\core\include\opencv2/core/ocl.hpp(739): error C2610: 'cv::ocl::OpenCLExecutionContext::OpenCLExecutionContext(cv::ocl::OpenCLExecutionContext &&)' : n'est pas une fonction membre spéciale qui peut être définie par défaut (C:\Users\Mini\Downloads\opencv-4.5.0\opencv-4.5.0\modules\imgproc\src\resize.sse4_1.cpp)

fafafafa gravatar imagefafafafa ( 2020-12-04 09:08:05 -0500 )edit

since this is about opencl and / or SSE/AVX optimization, you could try either to

  • set CPU_DISPATCH= (leave empty !)

in cmake. both quite radical, but you probably just want to get through for now :)

take a deep breath (maybe clean the build folder ?) , and try again !

berak gravatar imageberak ( 2020-12-04 09:54:31 -0500 )edit