plstcharles / litiv

C++ implementation pool for computer vision R&D projects.
http://www.polymtl.ca/litiv/en/
Other
100 stars 30 forks source link

Can I use Opencv4? #22

Open BitandPoly opened 2 years ago

BitandPoly commented 2 years ago

Bonjour,

Thanks a lot for your great contribution.

I notice that opencv >= 3.0.0 is required, but I failed to cmake with a version 4.5.2 of opencv. I would like to know if it supports opencv 4.

Merci!

plstcharles commented 2 years ago

Hello!

I have not had to build this project with OpenCV 4+ myself (it's been a while!), but I'd love to try to get it working. Do you have a log from the generation/build process to share that contains the issue? I do not have a local C++ environment anymore, but I might be able to help you get it working remotely.

BitandPoly commented 2 years ago

Hi,

Thank you very much for your rapid reply, I know it's been a long time without update! Please download the log with the following link:

CMakeOutput.log

I am looking for a method to generate background/foreground segmentations. If it's hard to try an opencv 4 version, I will look for other methods. Anyway, I am really really grateful for answering me.

Best!

plstcharles commented 2 years ago

I tried to do a quick local build with OpenCV 4.5.5 to see what breaks, and I had to fix a couple of minor things, see this branch: https://github.com/plstcharles/litiv/tree/test-build-opencv4 ... let me know if it works on your end, I might merge it into master later if everything remains backward compatible! (nothing tested yet)

BitandPoly commented 2 years ago

Hello!

Remain the same problem. The error output after 'cmake ../' is as follows:

(base) qingwu@poly05:~/litiv/build$ cmake ../ -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:121 (find_package): Could not find a configuration file for package "OpenCV" that is compatible with requested version "3.0".

The following configuration files were considered but not accepted:

/usr/local/lib/cmake/opencv4/OpenCVConfig.cmake, version: 4.5.2
plstcharles commented 2 years ago

Are you sure you are using the correct branch?

Based on this change:

find_package(OpenCV 4.0)
if(NOT ${OpenCV_FOUND})
    find_package(OpenCV 3.0 REQUIRED)
endif()
message(STATUS "Found OpenCV >=3.0 at '${OpenCV_DIR}'")

...OpenCV 4 should now be supported, unless there's a difference between the version I tested locally (4.5.5) and yours (4.5.2) --- I might check it out directly later...

plstcharles commented 5 months ago

For anyone looking into OpenCV 4 compatibility: the test-build-opencv4 works with the default library config as of 2024-01-15 (thanks @michelpromonet !), but I will likely not merge that branch into master, as most of the 3rd-party dependencies break with OpenCV4 (this stuff is pretty old now).