Repository navigation
Remove opencv_highgui as optional dependency of features2d module - #13849
tedsteiner wants to merge 2 commits into
Conversation
The highgui module is added as an optional dependency of features2d. However, this is only used in file blobdetector.cpp for a default-disabled debug option. This makes it simple if someone someday wants to debug the blob detector. However, this also means that any library downstream linking to the features2d module will also need to link to highgui and its dependencies.
|
I think it is better to remove debug code completely. Looks like sfm module in opencv_contrib uses highgui as transitive dependency from features2d, so it should be explicitly listed in module dependencies here: https://github.com/opencv/opencv_contrib/blob/796853e057d08ae840e2d7d559775e8b701084a0/modules/sfm/CMakeLists.txt#L79-L85 Could you please create PR to the opencv_contrib repository using branch with same name ( |
|
It is not features2d-specific case only. We need more robust/common solution for this. |
|
I will update this soon with a matching branch in opencv_contrib and removing the debug code sections entirely. When I dug in to where this is used in the I won't be able to test this until I get to another computer. However, I think the better fix is to remove the include line to highgui in the |
This code is dependent on the highgui module, which features2d no longer links against.
|
I removed the debug lines from |
|
Is there anything holding this back from being merged? |
The highgui module is added as an optional dependency of features2d.
However, this is only used in file blobdetector.cpp for a default-disabled debug option.
This makes it simple if someone someday wants to debug the blob detector.
However, this also means that any library downstream linking to the features2d module will also need to link to highgui and its dependencies.
This pullrequest changes
[From my understanding] the current behavior is that if
BUILD_opencv_highguiis enabled, then thehighguimodule is added as an optional dependency for thefeatures2dmodule.However, the only place
highguielements are used are inblobdetector.cpp, and only ifDEBUG_BLOB_DETECTORis manually defined.And even if
DEBUG_BLOB_DETECTORis defined, all lines of code in theDEBUG_BLOB_DETECTORcode blocks would need to be uncommented.These lines of debug code have been commented out in the repository for at least 8 years.
My guess is that these lines of debug code are very rarely, if ever, used, and only in special cases.
I would further guess that users who enable this debug tool would know how to enable highgui (or to read the fairly clear compile errors saying highgui not found).
I think it makes sense to delete the debug code entirely, however, as this is my first OpenCV PR I don't want to overstep.
Reasoning
A codebase that I manage benefits from the OpenCV features2d library.
A "core" portion of this codebase is used on embedded systems that do not support GUI tools.
A separate portion of this codebase allows GUI tools.
We recently ran into some issues where the features2d library caused strange build errors because it silently links against highgui due to CMake's modules system.
Once we tracked down the issue and understood it we were able to fix the issue for our systems.
However, it seems like linking features2d against highgui just because its' enabled doesn't serve any larger benefit except for in a very specific and rare use case, and sometimes can lead to system integration challenges.