What is the difference between using opencv-python and building from source?

I’m currently building OpenCV from source and using the DNN module.
My end-user would like us to deliver an application that only requires the use of an inference script and a Conda environment.

Please can someone explain what the limitations are with using opencv-python instead of building from source?

I hope you mean https://pypi.org/project/opencv-python/ because anything listed on conda tends to be unmaintained junk.

that package lacks CUDA, because that’s notoriously fussy about its environment, and it can’t come with non-free algorithms due to licensing.

if you redistribute a binary package, you’ll be subject to the legal stuff too. I doubt that you’ll need any of those non-free algorithms.

the DNN module has many possible backends. OpenCL tends to work anywhere.

practically, there are no limitations to you and your use case.

@crackwitz Thanks for the info.
As far as I understand Cuda is required to accelerate the computing on the GPU.
Does that mean it will work but just not as fast for inference?

in general, that’s false.

CUDA can only be used with NVIDIA GPUs. CUDA and NVIDIA hardware are designed for each other.

OpenCL can be used on NVIDIA and AMD GPUs, as well as CPUs. NVIDIA doesn’t give it much love but it’ll run decently.

if that’s news to you, perhaps you’re getting ahead of yourself with these questions.

OpenCV’s dnn module can use many different backends, CUDA being one, OpenCL being another.

@crackwitz thanks for the info.
I’m installing opencv-python with pip and my end-user has an Nvidia GPU (v100).
I’ll try using OpenCL for the backend and see if it can use the GPU.

your end user should be willing to build OpenCV with cuda on their system. there’s a ton of recipes out there, of various quality, but I’d stick with cmake-gui for all the configuration needs.

a dnn::Net can be told at runtime what backend and target to prefer. you say your_net.setPreferableBackend(cv.dnn.DNN_BACKEND_CUDA) if that’s available.

@crackwitz thanks again.
Ideally, yes we would like them to build from source and further down the line we will suggest that. The issue is that they already have a framework in place and are restricted as to which software they can install.
For the purpose of testing our model we’ll have to use opencv-python initially. I’ve added the option in my script to first check for a GPU, then check if it’s CUDA enabled. If not, it should use OPENCL for the backend and if no GPU is found it should use the CPU.