How to build openCV.jar?

asked 2019-03-27 09:45:14 -0500


First: My mission is to use OpenCV to compare photos of faces, correct me if I am wrong when I say that it will be possible with OpenCV?

Second I need to use Linux as OS and Java as environment. If I am not wrong I need to "build" the opencv*.jar my self? It does not seems to be able to download from below link, right?

So I think I need to go through these steps to produce the opencv.jar file: I do not seem to find any opencv.jar after I had execute:


cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

Do you see what I miss? Best regards Fredrik

edit retag flag offensive close merge delete


sturkmen gravatar imagesturkmen ( 2019-03-27 12:16:27 -0500 )edit

please edit your question, and add the cmake output as TEXT there.

most likely, you're missing some requirement, like ant was not installed, ,etc.

berak gravatar imageberak ( 2019-03-28 01:09:00 -0500 )edit

Hello guys! I have done some progress but when I followed the instructions at: there seems to be something wrong any way. I got a jar named opencv-2413.jar, (I thought it would be opencv-4.0.1.jar). But when I try to compile the HelloOpenCV, the class org.opencv.imgcodecs.Imgcodecs is missing in the newly build jar-file. Could that be because of the "git checkout 2.4" the is mentioned?

Do you see what I miss? Best regards Fredrik

fredand44 gravatar imagefredand44 ( 2019-03-28 15:34:22 -0500 )edit

Hmm, hello again guys. I tried to checkout 3.4 instead and this time the class that was missing in opencv-2432.jar was available in the opencv-346.jar. But the next problem, in the example code there is a call to Imgproc.rectangle... but that method seems not to be available in the class "org.opencv.imgproc.Imgproc" (the import to this class was also missing in the example). Any clues would be helpful. Best regards Fredrik

fredand44 gravatar imagefredand44 ( 2019-03-28 16:09:57 -0500 )edit

Hello guys! I think I finally manage to build and run the example from branch 3.4. I will try to assemble a description of how I did it. Best regards Fredrik ANdersson

fredand44 gravatar imagefredand44 ( 2019-04-02 00:32:33 -0500 )edit

@fredand44 -- please do so !!

berak gravatar imageberak ( 2019-04-02 00:53:44 -0500 )edit

Hello @berak what do you think of this description: Best regards Fredrik

fredand44 gravatar imagefredand44 ( 2019-04-12 10:20:10 -0500 )edit