berak / opencv_smallfry

it did not fit anywhere else ..
Other
57 stars 26 forks source link

Cant import org.opencv.face.*; #1

Closed twixrider closed 8 years ago

twixrider commented 8 years ago

Hey, i cannot import the org.opencv.face - class. like in your: "https://github.com/berak/opencv_smallfry/blob/master/java_face3.0/src/SimpleSample.java" example.

im using opencv 3 and loaded the opencv-300.jar

i hope you can help me!

ty and BR

berak commented 8 years ago

hi,

you need the opencv_contrib repo, also, the java bindings are not enabled by default.

add "java" at the end of line 2 here , and try to rebuild (cmake && make && make install)

twixrider commented 8 years ago

do i have to download the contrib-repo and put it into my project or how do i add it (just with the cmake?)?

berak commented 8 years ago

yes. download it to any folder, point your main opencv cmake settings to it:

cmake -DOPENCV_EXTRA_MODULES_PATH=/path/to/contrib/modules /main/opencv_source_directory

please take a minute with the readme here

twixrider commented 8 years ago

ty very much!!!

berak commented 8 years ago

good luck, come back, if you run into further trouble ;)

twixrider commented 8 years ago

-- Configuring incomplete, errors occurred! CMake Error: Cannot open file for write: C:/Program Files (x86)/CMake/bin/CMakeCache.txt.tmp CMake Error: : System Error: Permission denied CMake Error: Unable to open cache file for save. C:/Program Files (x86)/CMake/bin/CMakeCache.txt CMake Error: : System Error: Permission denied

berak commented 8 years ago

can you show, where you start this, and what is you cmake cmdline ?

(it should probably write to /your/main/opencv/build/CMakeCache.txt , not the one in cmake/bin)

twixrider commented 8 years ago

C:\Program Files (x86)\CMake\bin>cmake -DOPENCV_EXTRA_MODULES_PATH=C:\OpenCV\opencv_contrib-master\modules C:\OpenCV\opencv\sources

i could not start the cmake from the opencv_build_directory cant find "cmake" -error

i start the command tool with admin rights!

berak commented 8 years ago

please make a "build" folder somewhere, and start cmake from there. (this will be the folder for all the "temp" files, expect something like 3gb ;)

i think, the way you did it, it expected to build in cmake/bin (and thus tried to overwrite the readonly cmakecache.txt there)

twixrider commented 8 years ago

CMakeOutput.txt CMakeError.txt

ok my problem was i didnt add the cmake/bin folder to the systemvariables (im using windows) now when i start cmake from the buildfolder of opencv (like in the readme) i get following message:

cmake_error.txt

berak commented 8 years ago

yea, fun. it did not find the compiler ;)

either: locate the vcvars.bat in your visualstudio folder, and run that before cmake

or: set vars manually: CMAKE_CXX_COMPILER=/full/path/to/cl.exe

(similar to all vars it complains about)

sidenote: you also want cmake -DBUILD_SHARED_LIBS=OFF for java, else the opencv_java.dll depends on all other opencv dll's at runtime

twixrider commented 8 years ago

ok ill try. thanks man for your effort!

berak commented 8 years ago

nicht den tag vorm abend loben ;)

twixrider commented 8 years ago

hello again, i reinstalled the visual studio and tried again the cmake-command:

cmake -DOPENCV_EXTRA_MODULES_PATH=C:\OpenCV\opencv_contrib-master\modules C:\OpenCV\opencv\sources

diffent error log appeard(which is hopefully better than the old one): attached visual studio is 2015 community edition!

twixrider commented 8 years ago

sorry attach didnt work:

CMakeError.txt

berak commented 8 years ago

hmm, sorry, can't really help now (no vs2015 here).

it still did not find your compiler, but i'm at loss why or how so.

i guess, it will work, once you can just call cl.exe from a cmdline (that's more or less the same, what those build tools are trying)

twixrider commented 8 years ago

ok, no problem. is the cl.exe from the visual studio?

berak commented 8 years ago

yes, ofc. it's the c/c++ compiler

twixrider commented 8 years ago

so i figured out what the problem was. visual studio 2015 community, dont install the c++ components, neighter the c++ compiler. just go the install.exe and go modify, choose "programm language" and choose c++. it will install the c++ compiler as well. no the cmake command worked for me :)

hmm my application (working in intelliJ and updated the import of the library) still wont find the import org.opencv.face.*; now.. any ideas?

berak commented 8 years ago

so, you build the opencv libs, and created a new opencv-310.jar and a new opencv_java310.dll ?

did you enable the java bindings for the face module (see 2nd comment) ?

twixrider commented 8 years ago

i added java to the CmakeList.txt. where do i have to perform the make -j5 command?

berak commented 8 years ago

in your build folder

twixrider commented 8 years ago

C:\OpenCV\opencv\build>make -j5 make: *\ No targets specified and no makefile found. Stop.

ok thats the problem. i already got a "face" folder in the open_cv models folder

catapulveda commented 6 years ago

@berak It is not necessary to add "java" at the end of line 2 here, and try to rebuild (cmake && make && make install) Just include the path of the modules and it will be ready. But how to get opencv_java341.dll and opencv-341.jar for 64 bits and 32 bits in visual studio 2017? I can only get the 32 bit. I have another problem, I can not group all the .dll files into one.