Repository: opencv
Issue: 22 modules (main and contrib) depend on opencv_flann module (cv::flann::Index instead of cv::DescriptorMatcher)
Labels: feature,priority: low,category: build/install

##### System information (version)
<!-- Example
- OpenCV => 4.2
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
-->

- OpenCV => master (2a52e44bc605bf73502dee0e0e3954bcda19a246)
- Operating System / Platform => Kubuntu 19.10
- Compiler => GCC g++ 9

##### Detailed description

The calib3d module makes use and obviously depends on the flann module. Another 21 modules depend on calib3d. 
This is a problem because disabling flann, which is a 3rd party (and a bit outdated) module/library disables half of the entire opencv library. 

The flann dependency can be relieved as flann itself doesn't do anything the opencv "native" BruteForceMatcher can't do, ofc with an increased processing cost. 

Ideally, calib3d (and any other directly depending on flann) should use the DescriptorMatcher interface and whatever implementation is available with conditional compilation or dependency injection (if u happen to use that approach somewhere else in the library).

> Module opencv_calib3d disabled because opencv_flann dependency can't be resolved!
> Module opencv_objdetect disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_stitching disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_aruco disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_bgsegm disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_ccalib disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_datasets disabled because opencv_flann dependency can't be resolved!
> Module opencv_dpm disabled because opencv_objdetect dependency can't be resolved!
> Module opencv_face disabled because opencv_objdetect dependency can't be resolved!
> Module opencv_optflow disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_rapid disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_rgbd disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_sfm disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_shape disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_stereo disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_structured_light disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_superres disabled because opencv_optflow dependency can't be resolved!
> Module opencv_surface_matching disabled because opencv_flann dependency can't be resolved!
> Module opencv_videostab disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_xfeatures2d disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_ximgproc disabled because opencv_calib3d dependency can't be resolved!
> Module opencv_xobjdetect disabled because opencv_objdetect dependency can't be resolved!

As to why someone would want to disable the flann module, well could be multiple reasons, mine is I want to use the slightly updated and fully functional (opencv version won't work on multiple cores and some index types can't be used with binary features) official flann code but having both generates a lot of compilation and linking problems that can't be trivially solved with namespace prefixing.

##### Steps to reproduce

Download opencv and contrib repos
Configure cmake disabling the flann module with the "BUILD_opencv_flann"  and confirm  21 modules get disabled by unmet dependency on calib3d (or something else that in turn depends on calib3d).