OSVR-Core icon indicating copy to clipboard operation
OSVR-Core copied to clipboard

Does not build with OpenCV 4

Open ChristophHaag opened this issue 6 years ago • 6 comments

Archlinux ships OpenCV 4 and osvr-core does not build with it.

There are several #ifdefs in the code checking explicitly for OpenCV 2 or 3 and producing an #error for OpenCV 4 but just removing those does not help, apparently the API changed.

osvr-core should either

  1. build an appropriate opencv version with osvr-core
  2. ~~allow the selection of an opencv installation in a non default path (/opt/...) in cmake~~ It already does that with OpenCV_DIR
  3. update to the opencv 4 API

ChristophHaag avatar Jan 22 '19 12:01 ChristophHaag

Can you set OpenCV_DIR in CMake? That should let you choose the location of the CMake config file to use. (You could also disable building with opencv if you don't need the hdk optical tracker.)

In any case, I will have to look and see what they broke in the API ;) thanks for the report!

On Tue, Jan 22, 2019, 6:57 AM Christoph Haag [email protected] wrote:

Archlinux ships OpenCV 4 and osvr-core does not build with it.

There are several #ifdefs in the code checking explicitly for OpenCV 2 or 3 and producing an #error for OpenCV 4 but just removing those does not help, apparently the API changed.

osvr-core should either

  1. build an appropriate opencv version with osvr-core
  2. allow the selection of an opencv installation in a non default path (/opt/...) in cmake
  3. update to the opencv 4 API

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OSVR/OSVR-Core/issues/596, or mute the thread https://github.com/notifications/unsubscribe-auth/AADuyWz1qx62SkLVmhP3i5Gze-gkVwtpks5vFwq1gaJpZM4aMnYf .

rpavlik avatar Jan 22 '19 13:01 rpavlik

This method was not immediately obvious from the CMakeList.txt but it works. Thanks.

ChristophHaag avatar Jan 22 '19 13:01 ChristophHaag

Yeah, it's not in the CMake file because it's the standard way built into CMake for config files.

On Tue, Jan 22, 2019, 7:26 AM Christoph Haag [email protected] wrote:

This method was not immediately obvious from the CMakeList.txt but it works. Thanks.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/OSVR/OSVR-Core/issues/596#issuecomment-456398405, or mute the thread https://github.com/notifications/unsubscribe-auth/AADuyYlBAIlhqIwhNCyaaforv4nNzq1tks5vFxGSgaJpZM4aMnYf .

rpavlik avatar Jan 22 '19 13:01 rpavlik

Updated to make it compile with OpenCV4: https://github.com/ChristophHaag/OSVR-Core/commit/f693399b1d7cb28b34c767c8aa78c4ec6c1a7ce3

I have not tested running this, I mostly just used the suggestions from my IDE. I haven't cared to test whether the code still works with OpenCV3, personally I would just ditch OpenCV2 and OpencV3 support to minimize the maintenance burden.

ChristophHaag avatar Jul 24 '20 02:07 ChristophHaag

awesome thanks christoph, I will check and merge this soonish.

rpavlik avatar Jul 27 '20 15:07 rpavlik

[(https://aur.archlinux.org/packages/osvr-core-git/)] it's patched version for OpenCV4. It compiled with OpenCV 4.3 and older gcc. But it won't compile with OpenCV 4.5

[85%] Built target com_osvr_Multiserver Scanning dependencies of target vbtracker-core [ 85%] Building CXX object plugins/videobasedtracker/CMakeFiles/vbtracker-core.dir/BeaconBasedPoseEstimator.cpp.o /mnt/magazyn/archlinux/aur-osvr-core-git/src/osvr-core/plugins/videobasedtracker/BeaconBasedPoseEstimator.cpp: In member function ‘bool osvr::vbtracker::BeaconBasedPoseEstimator::m_pnpransacEstimator(osvr::vbtracker::LedGroup&)’: /mnt/magazyn/archlinux/aur-osvr-core-git/src/osvr-core/plugins/videobasedtracker/BeaconBasedPoseEstimator.cpp:303:14: error: ‘void ransacResult’ has incomplete type 303 | auto ransacResult = cv::solvePnPRansac( | ^~~~~~~~~~~~ make[2]: [plugins/videobasedtracker/CMakeFiles/vbtracker-core.dir/build.make:82: plugins/videobasedtracker/CMakeFiles/vbtracker-core.dir/BeaconBasedPoseEstimator.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:2083: plugins/videobasedtracker/CMakeFiles/vbtracker-core.dir/all] Error 2 make: *** [Makefile:171: all] Error

isopix avatar Oct 16 '20 00:10 isopix