What is best practice for adding OpenCV as a dependency in a Julia Package?

I went through the recipe online for building the Julia OpenCV bindings. It is all based on CxxWrap to automatically create the bindings. So I get something locally installed, but I cannot add OpenCV as a dependency to my packages:

pkg> add OpenCV
ERROR: The following package names could not be resolved:
* OpenCV (not found in project, manifest or registry)

Does anyone have any advice on how to best proceed? I could add a local path I suppose, but I cooperate with somebody else on this repo. I have contemplated looking into making a local registry, or exploring BinaryBuilder to see if I could wrap this up in a more proper Julia package that can be put on a GitHub repo. But I am thinking I cannot be the first one with this problem. What do other people using OpenCV in Julia currently do?

Yeah, all people that tried to build OpenCV with BinaryBuilder gave up. Seems to be complicated, as far as I understand, or maybe it needs too many dependencies not yet packaged?

Before you continue with the OpenCV attempt, just wanted to double check that you are aware of Images.jl? Is there a specific functionality from OpenCV that is not yet available in Images.jl?

I don’t know well what is in Images. It seems very generic what I have seen thus far. I specifically want to do stereo matching. OpenCV has this StereoBM class for that. First step is to compute a disparity map, which means taking two images of the same scene and finding how much the features are shifted left or right. This can then be later used to create a depth map.

If Images.jl can already do something like this, then I would be thrilled. Could you point me in the right direction? I am new to this domain, so it is not obvious to me what functions in Images.jl I may use for this.

Thanks, that potentially saved me a ton of wasted time. What would be best then? Just putting it all in a Docker container or something?

Also contemplate, maybe wrapping whatever I need in OpenCV in a C API as that is easy to call from Julia. But I guess that doesn’t help on the challenge of compiling OpenCV through Julia.

Unfortunately I am super busy here, but try to take a look at the JuliaImages organization, and try to contact the active maintainers in Zulip for example.

https://github.com/JuliaImages

1 Like

Thanks for the help!

In case someone wants to try again, this PR might be a good starting point. Most platforms were actually successful

1 Like