Error while building OpenCV with Contrib-Modules

asked 2016-11-15 18:33:33 -0500

rabie gravatar image

updated 2016-11-17 07:34:20 -0500

'm trying to build OpenCV with Cotrib-modules in elementry os after success installation of OpenCV i try to build it with the contrib module but always i get an error while the generation of the .jar file I'm getting the following error:

update after delete the contrib and clone it again the error reduced to

[ 95%] Built target opencv_interactive-calibration

[javac] /home/rabie/Downloads/opencv-master/buildb/src/org/opencv/text/ error: nativeObj has protected access in Algorithm

[javac] detectRegions_0(image.nativeObj, er_filter1.nativeObj, er_filter2.nativeObj, regions_mat.nativeObj);
[javac] ^

[javac] /home/rabie/Downloads/opencv-master/buildb/src/org/opencv/text/ error: nativeObj has protected access in Algorithm

[javac] detectRegions_0(image.nativeObj, er_filter1.nativeObj, er_filter2.nativeObj, regions_mat.nativeObj);
[javac] ^

[javac] 2 errors

Target 'jar' failed with message 'Compile failed; see the compiler error output for details.'.


/home/rabie/Downloads/opencv-master/buildb/build.xml:9: Compile failed; see the compiler error output for details.

Total time: 2 seconds

make[2]: *** [bin/opencv-310.jar] Error 1

make[1]: *** [modules/java/CMakeFiles/opencv_java.dir/all] Error 2

make: *** [all] Error 2

Can anyone please guide me as to how to fix this error?

Thanks in advance!!

edit retag flag offensive close merge delete


Its hard to identify the source of your Error, when you do't seperate the Parts of your Question. Please look at the FAQ. It helps you to make a good Question. (Good Question = More People who try to solve your Question!). Besides that, did you try any Tutorial or Building? For Example This or This?

Vintez gravatar imageVintez ( 2016-11-16 04:02:49 -0500 )edit

ops sorry for that. first time to share a problem to this community i will try to modify and yes i try every known tutorial and every time with the same problem

rabie gravatar imagerabie ( 2016-11-16 07:22:34 -0500 )edit

this is weird, - a lot of errors from modules, that should never have been wrapped to java at all. (optflow, dnn, bgsegm)

did you change some cmakelists.txt files there ?

actually, the only 2 modules from opencv_contrib, that have java bindings atm. are aruco and bioinspired

berak gravatar imageberak ( 2016-11-16 07:54:01 -0500 )edit

no i didn't and i try other tutorial and all of them make an error while generating the .jar file and i don't know the reason i will try it one more time

rabie gravatar imagerabie ( 2016-11-16 08:07:46 -0500 )edit

btw, why did you want to build with opencv_contrib ? (what exactly do you need?)

berak gravatar imageberak ( 2016-11-16 08:12:25 -0500 )edit

i need to use face , dataset and text module in my GP

rabie gravatar imagerabie ( 2016-11-16 08:15:24 -0500 )edit

well, sad as it is, none of those is exposed to java by default

(you might have a chance with the face module, but need to change cmakelists.txt, and add "java" at the end of the line)

berak gravatar imageberak ( 2016-11-16 08:21:05 -0500 )edit

i will give it another try and hope it work thanks @berak for your help

rabie gravatar imagerabie ( 2016-11-16 09:12:51 -0500 )edit

[ 96%] Generating opencv-310.jar [javac] /home/rabie/Downloads/opencv-master/buildb/src/org/opencv/bgsegm/ error: cannot find symbol [javac] public class BackgroundSubtractorGMG extends BackgroundSubtractor { [javac] ^ [javac] symbol: class BackgroundSubtractor the same result again

rabie gravatar imagerabie ( 2016-11-16 10:01:46 -0500 )edit

i still think, you're doing something weird, there, if you look here - there should not be generated any java code for this at all

can you cross-check here ?

again no idea, how it tried to wrap the bgsegm module at all, but very curious.

maybe you owe us an explanation of which steps you're doing there (and better put that into your question)

berak gravatar imageberak ( 2016-11-16 10:09:05 -0500 )edit