Understanding the Philosophy Behind OpenCV's DNN Module

Hello everyone,

Sometime back, I was working on a proposal for a GSoC project about integrating LightGlue and ALIKED into OpenCV by using the DNN module and extending Feature2D modules. While experimenting with LightGlue ONNX models, I encountered challenges like lack of dynamic input shape support and unsupported operations (like ScatterND, GridSample, logical layers like And, Or, etc.).

This made me wonder:

  • Given that frameworks like ONNX Runtime and TensorFlow already provide C++ APIs for running deep learning models, what was the core motivation behind creating the OpenCV DNN module?
  • Was it mainly for ease of integration into OpenCV pipelines (image processing, feature matching, etc.), portability across CPU architectures, minimal dependencies, or something else?
  • Was one of the original goals to enable efficient inference across different CPU architectures (x86, ARM, etc.) with the same lightweight C++ codebase, without heavy external dependencies?
  • How should one decide when it is appropriate to use OpenCV DNN versus integrating external runtime libraries?

I would love to understand the original design and what kinds of problems OpenCV DNN is best suited to solve.
Sorry if these are very basic questions — I’m just trying to learn the background properly.

Thank you!