How to generate an OpenCV .SO file?

  cmake, java, opencv, terminal, windows

I am new to compiling sources, forgive me if there is already a similar answer here.

I downloaded the OpenCV files from this link https://github.com/opencv/opencv/archive/4.5.1.zip

I unzipped the zip, created a folder called build and inside it I applied the following command:

cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF -DOPENCV_EXTRA_MODULES_PATH=C:UsersLVTLWF631Desktopopencv-4.5.1build

and the following log was presented:

CMake Error: The source directory "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

This is another way I tried

enter image description here

And this is the log

CMake Error: The source "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/modules/CMakeLists.txt" does not match the source "C:/Users/LVTLWF631/Desktop/opencv-4.5.1/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

I am trying to generate the .so file to work in linux environment. I need this file because I’m going to apply this command in java. I generated any name just to illustrate:

System.load("opencv_451.so");

How can I compile the opencv source to generate the .so file using windows? Could anyone help?

Source: Windows Questions

LEAVE A COMMENT