cv-rs icon indicating copy to clipboard operation
cv-rs copied to clipboard

Make all modules optional and separate them out in the codebase

Open vadixidav opened this issue 6 years ago • 12 comments

TL;DR: It should be possible to specify exactly what features you want using cargo, and it should "just work."

Currently there is some intermingling between features2d and xfeatures2d. OpenCV also has several other modules and some have dependencies on each other. This depends on the completion of the sys crate refactor #115. The sys crate will only build the parts of OpenCV requested. This should result in being able to include just the components needed to avoid having to pay royalties to patent encumbered things in opencv_contrib.

vadixidav avatar Mar 08 '19 04:03 vadixidav

Moving all contrib features behind contrib feature would be sufficient.

Pzixel avatar Mar 12 '19 10:03 Pzixel

That might be a good starting point, but it wouldn't be too hard for me to just put in logic for all the modules based on their dependencies.

vadixidav avatar Mar 12 '19 13:03 vadixidav

It just make no sense to me. Having 100+ features doesn't make crate easier to use but the opposite. Having minimal amount of switches that covers all cases is the best. Think of it as of Karnaugh map.

Pzixel avatar Mar 12 '19 14:03 Pzixel

Whats the status of this? I just compiled opencv3 from sources and ocr.hpp doesnt seem to exist? I also cant find it in the source repo. This might help these kind of issues

geoeo avatar Mar 30 '19 23:03 geoeo

@geoeo It seems @Pzixel might not be interested in accepting changes to enable only specific modules. However if you are interested in messing around with cv-rs where it builds OpenCV for you, you can use my #117 branch. Just point your git line to my repo and set `rev = "refactor". You can also use the system feature to cause it to use the system packages like the current master does. It requires clang to be installed as well though.

Are you interested in making each OpenCV module optional? If you could provide some feedback, it might help determine what happens with this issue.

vadixidav avatar Mar 30 '19 23:03 vadixidav

The core issue is different. Its that it seems that the ocr.hpp file has been removed from the core opencv repo. This would have helped to mitigate the failed compilation. But im not 100% sure.

geoeo avatar Mar 31 '19 00:03 geoeo

@geoeo Make sure you compile the opencv submodule in this repository. It points to the right build of OpenCV.

vadixidav avatar Mar 31 '19 01:03 vadixidav

I thought I only have to do $cargo build What else do I have to do?

Edit: i see now text is part of the opencv_contrib repo. Which i have to link in cmake explicitly

geoeo avatar Mar 31 '19 09:03 geoeo

I cant get this folder to compile. I have to install 100 dependencies which are not relevant. I would +1 this if that means anything.

geoeo avatar Apr 01 '19 20:04 geoeo

@geoeo After I merge the #117 branch, you wont really need any dependencies installed on Linux (except GTK3) or Windows. You can try it out now if you want, but I am still dealing with issues on Ubuntu 16.04 on Travis (so it passes CI). It also statically links OpenCV by default so you don't need to install that either.

vadixidav avatar Apr 01 '19 22:04 vadixidav

There's a typo in build.rs line 102

let cargo_rustc_link_search = env::var("OPENCV_LIB").unwrap_or("/use/local/lib".into());

I think it should be

let cargo_rustc_link_search = env::var("OPENCV_LIB").unwrap_or("/usr/local/lib".into());

Didnt want to make a PR for this.

geoeo avatar Apr 06 '19 10:04 geoeo

Fixed

Pzixel avatar Apr 07 '19 07:04 Pzixel