vcpkg install opencv shouldn't install opencv contrib in my opinion. It's quite separate from the main OpenCV distribution. It's a separate zip file download and installation. It takes significant amount of time to install as well and significant space on the HDD, for something many people that just want the core package will never need. contrib should definitely be a feature package, or, maybe even a separate package (like with boost who has modular packages).
The same goes for protobuf: opencv or opencv[core] shouldn't need protobuf - protobuf is only needed in very specific places in OpenCV, and I've used opencv for years without ever needing protobuf. It adds significant compile-time and install-space overhead.
Again these are included before the introduction of feature packages, personally I don't think what you are suggesting is a good idea but I suppose you can still submit a PR for this and let the maintainers make the decision.
I really disagree there, especially with opencv-contrib. It is a very separate module (even apt and other package managers separate it), and you shouldn't impose on anyone that wants to pull opencv to also pull opencv-contrib.
I completely agree contrib should be represented as a feature, the question is whether to add it to the Default-Features list.
I think it makes sense to have off-by-default, simply because it is so large.
As for the separation into separate packages: it isn't possible to completely separate them _at build time_[1]. apt and friends are able to separate the produced binaries into multiple packages, but they all are actually including contrib at build time by default. This is because they must be built together with OpenCV (and might have source patches to the main codebase? I'm not 100% sure there).
In Vcpkg, this is why we have "features" -- for things like this that can't be split into a separate build-time.
Great! :-)
But one thing, during vcpkg install opencv, I saw it pull/download an extra file or repo (which took quite a long time). Upon further inspection I think it was this: https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake#L24, which is the separate opencv_contrib GitHub repo. So if a user wants to build OpenCV (without contrib), then it's not necessary to pull that repo (in fact I have build OpenCV numerous times and have never pulled or downloaded anything except for the "main" repository).
Yes, that's totally right.
However, it also means that splitting contrib off into a feature is significantly more complex, because you must use a _completely different source directory_ depending on the setting to ensure no cross-contamination takes place (we cache sources by default to improve multiarch/upgrade build times). Otherwise this would have incorrect results:
vcpkg install opencv[contrib]
vcpkg remove opencv
vcpkg install opencv[core]
This might require improvements to vcpkg_from_github() to support some sort of "source path disambiguator tag".
Hi @patrikhuber, thanks for posting this issue. I noticed that this port has been updated and contrib and protobuf are not in Build-Depends and Default-Features list. So when install opencv, contrib and protobuf will not be installed now. Please have a try and confirm whether there is any problem.
Hi @NancyLi1013, that's great to hear. I'm currently not very actively using vcpkg or OpenCV, if you'd like to close this issue soon, it would be best if you try and confirmed within the team. Otherwise I'm sure there's some point in the future where I'll try it again.
Thanks for your quick reply. I install openv, contrib and protobuf are not installed by default. So I'll close this issue now. Please feel free to reopen it or open a new issue if this is still a problem for you.