You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plan-V4D: A task graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision. #22923
Plan-V4D is like GStreamer, but with a compile-time graph that is type-safe C++. It has the pipeline-thinking of a node-based compositor like Blender or Nuke, but implemented in code. It delivers the performance of a low-level tasking library like Intel TBB, but is specialized for the computer vision and graphics domain.
Release
I have released an alpha version of the module. See the README!
At the moment it depends on pull requests that haven't been merged yet but could work without, just slower: #22780 and #22704
Currently supported
it uses C++20
It supports OpenGL 3.0 and ES 3.2
Depth buffer support
it supports usage of multiple OpenGL-contexts (using context-sharing) so multiple independent state-machines are available. Very handy when you want to integrate an external API based on OpenGL or you simply don't want/need to manage GL-states meticulously between different rendering sub-systems.
It supports NanoVG (2D and font-rendering) out-of-the-box by using the multi-context-support.
It supports an experimental fork of BGFX (3D engine which i altered so it will adhere to the concurrency model of Plan-V4D)
It supports making GUI-overlays using IMGui
it is based on a template impementation of a task graph engine which is facilitated for parallelization
it is based on T-API
it supports fast videoio and manipulation of videos
it facilitates hardware acceleration where it can (e.g. VAAPI) and makes use of interop implementations to keep frames on the GPU (in some samples all the time)
I have a first version of a wrapper for NanoVG. There are still some things to do (like using cv::String everywhere and cv::Mat for the transform functions) but it basically works. all the functions inside namespace kb::nvg should only be used inside kb::Viz2D::nanovg().
Still a lot of testing needed.
I'm wondering why is it necessary to wrap nanovg? Isn't it easier to use this library directly and maybe provide small compatibility header from OpenCV side?
highgui module purpose is to provide cross-platform interface for very basic GUI applications, probably because there were no appropriate existing libraries at the time of its creation.
viz module has been moved to the opencv_contrib (#13069) because it was considered that this module is not useful for majority of users and sometimes adds build problems due to its dependency on VTK.
Also there is ovis module wrapping Ogre3d library (cross-platform, HW-accelerated).
The wrapping of nanovg might be questionable but I just found it natural. I am trying to get some guidance on the whole idea. :)
You don't think it is worth it?
The wrapping of nanovg might be questionable but I just found it natural. I am trying to get some guidance on the whole idea. :) You don't think it is worth it?
Anyway, they are a few good reasons to wrap NanoVG. NanoVG requires OpenGL which involves a complex setup (especially cross-platform). By wrapping it that initialization could be required (e.g. by exception) or even performed on use. My motivation behind wrapping NanoVG is to bring hardware accelerated 2D Vector graphics to the opencv user in an easy manner. That's also why the wrapper (mostly) provides an interface using OpenCV types and behaviour (e.g. colorspace conversions and the definition of hue).
At the moment the use of NanoVG is bound to a kb::viz::Viz2object which ensures everything is setup right and CL/GL interop can be used in conjunction with it seamlessly.
Btw. what was the motivation behind the cv::ogl wrapper?
The wrapping of nanovg might be questionable but I just found it natural. I am trying to get some guidance on the whole idea. :) You don't think it is worth it?
Anyway, they are a few good reasons to wrap NanoVG. NanoVG requires OpenGL which involves a complex setup (especially cross-platform). By wrapping it that initialization could be required (e.g. by exception) or even performed on use. My motivation behind wrapping NanoVG is to bring hardware accelerated 2D Vector graphics to the opencv user in an easy manner. That's also why the wrapper (mostly) provides an interface using OpenCV types and behaviour (e.g. colorspace conversions and the definition of hue).
At the moment the use of NanoVG is bound to a kb::viz::Viz2object which ensures everything is setup right and CL/GL interop can be used in conjunction with it seamlessly. Btw. what was the motivation behind the cv::ogl wrapper?
Another important point is resilience against API changes in NanoVG
Anyway there is still much to do but I am hesitant about which direction this project should go. Pushing it to contrib at start and re-evaluating based on user acceptance later would be fine for me. I believe this may become very useful to the user and then it doesn't matter if it's in contrib for starters. also if it would stay for various reasons (like dependencies) in contrib that's also an acceptable outcome to me. As long as the user has a decent way of getting hands on that code.
I actually thought about documenting it by adapting existing OpenCV tutorials to it one by one. And there is of course the challenge of the minimal source commenting at the moment. :)
If OpenCV decides it doesn't want the module at all I would still continue developing it but the project would probably take quite another direction.
Much has changed while the samples should do the same. I wrote an introduction to what is now called Plan-V4D (until i eventually entierly split the two components: Plan a task graph engine and V4D a 2D/3D graphics runtime). Check it out: Introduction
changed the title [-]Plan/V4D: high performance applications with OpenCV by using a computational graph with support for 2D/3D graphics as well as GUI.[/-][+]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI inconjuction with computer vision.[/+]on Jan 1, 2025
changed the title [-]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI inconjuction with computer vision.[/-][+]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+]on Jan 1, 2025
Among other things (like instructions for building packages) i added build instructions or Ubuntu noble (latest LTS). For other distributions I added instructions on how to use a chroot for the build. Anyway, those instructions shouldn't be hard to adapt to other distributions.
Next: Working on Mac OS X build instructions
Then: Complete the API docs
Then: CI
Then: Tests
Finally: Finalize a beta release with packages.
On the side I am working on a 3D game as the most complex demo/workload yet. Rocks and mist are generated by raymarching distance fields. The whole scene is live-generated like that and goes on forever in a fractal fashion. It renders at around 110FPS@1080p on a Intel A770 GPU and a Intel i9 13900K CPU.
changed the title [-]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/-][+]Plan-V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+]on Jan 3, 2025
changed the title [-]Plan-V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/-][+]Plan-V4D: A task graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+]on Jan 4, 2025
A re-implementation of window_QT.*pp (imshow window using QT-style and counting ~4000 lines) using Plan-V4D (only ~700 lines). It is also much faster. gonna present some figures later.
Activity
kallaballa commentedon Dec 6, 2022
optflow-demo.mp4
A screen capture of the full example as it looks now.
Video credits in the README
kallaballa commentedon Dec 6, 2022
A WebAssembly/WebGL application based on nanogui
kallaballa commentedon Dec 9, 2022
I redesigned it into a simple object model.
https://viel-zu.org/opencv/apidoc/
Notes:
cv::oglmakeVAcapture(),makeVAwriter(),captureVA()andwriteVA()are only required till Redesign of CL/VA interop initialization #22780 is resolved.Is see large potential to go beyond the highgui API but I guess one of the next things to do is to implement my version of
namedWindowandimshow.kallaballa commentedon Dec 11, 2022
After reading some more I think this fits much better into cv::viz.
[-]Nanogui/OpenGL based UI-Backend[/-][+]cv::viz::Viz2D implementation[/+]kallaballa commentedon Dec 13, 2022
I have a first version of a wrapper for NanoVG. There are still some things to do (like using cv::String everywhere and cv::Mat for the transform functions) but it basically works. all the functions inside namespace kb::nvg should only be used inside
kb::Viz2D::nanovg().Still a lot of testing needed.
mshabunin commentedon Dec 15, 2022
I'm wondering why is it necessary to wrap nanovg? Isn't it easier to use this library directly and maybe provide small compatibility header from OpenCV side?
highgui module purpose is to provide cross-platform interface for very basic GUI applications, probably because there were no appropriate existing libraries at the time of its creation.
viz module has been moved to the opencv_contrib (#13069) because it was considered that this module is not useful for majority of users and sometimes adds build problems due to its dependency on VTK.
Also there is ovis module wrapping Ogre3d library (cross-platform, HW-accelerated).
kallaballa commentedon Dec 16, 2022
The wrapping of nanovg might be questionable but I just found it natural. I am trying to get some guidance on the whole idea. :)
You don't think it is worth it?
kallaballa commentedon Dec 16, 2022
Anyway, they are a few good reasons to wrap NanoVG. NanoVG requires OpenGL which involves a complex setup (especially cross-platform). By wrapping it that initialization could be required (e.g. by exception) or even performed on use. My motivation behind wrapping NanoVG is to bring hardware accelerated 2D Vector graphics to the opencv user in an easy manner. That's also why the wrapper (mostly) provides an interface using OpenCV types and behaviour (e.g. colorspace conversions and the definition of hue).
At the moment the use of NanoVG is bound to a
kb::viz::Viz2object which ensures everything is setup right and CL/GL interop can be used in conjunction with it seamlessly.Btw. what was the motivation behind the
cv::oglwrapper?kallaballa commentedon Dec 21, 2022
multiwindow.mp4
New features: Multiple light- and heavy-weight windows, zooming, feeding multiples windows from one frame buffer and a couple of little things.
https://github.com/kallaballa/GCV/blob/main/src/optflow/optflow-demo.cpp
kallaballa commentedon Dec 21, 2022
Another important point is resilience against API changes in NanoVG
kallaballa commentedon Dec 21, 2022
updated the skeleton api docs
kallaballa commentedon Dec 21, 2022
Anyway there is still much to do but I am hesitant about which direction this project should go. Pushing it to contrib at start and re-evaluating based on user acceptance later would be fine for me. I believe this may become very useful to the user and then it doesn't matter if it's in contrib for starters. also if it would stay for various reasons (like dependencies) in contrib that's also an acceptable outcome to me. As long as the user has a decent way of getting hands on that code.
I actually thought about documenting it by adapting existing OpenCV tutorials to it one by one. And there is of course the challenge of the minimal source commenting at the moment. :)
If OpenCV decides it doesn't want the module at all I would still continue developing it but the project would probably take quite another direction.
Would be nice to gain more clarity on that.
kallaballa commentedon Dec 22, 2022
I ported the Viz2D library and one of the simpler demos (no input video required) to WebAssembly
emscripten.mp4
93 remaining items
kallaballa commentedon Jan 1, 2025
Much has changed while the samples should do the same. I wrote an introduction to what is now called Plan-V4D (until i eventually entierly split the two components: Plan a task graph engine and V4D a 2D/3D graphics runtime). Check it out: Introduction
Build instructions will follow.
[-]Plan/V4D: high performance applications with OpenCV by using a computational graph with support for 2D/3D graphics as well as GUI.[/-][+]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI inconjuction with computer vision.[/+][-]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI inconjuction with computer vision.[/-][+]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+]kallaballa commentedon Jan 1, 2025
Among other things (like instructions for building packages) i added build instructions or Ubuntu noble (latest LTS). For other distributions I added instructions on how to use a chroot for the build. Anyway, those instructions shouldn't be hard to adapt to other distributions.
Next: Working on Mac OS X build instructions
Then: Complete the API docs
Then: CI
Then: Tests
Finally: Finalize a beta release with packages.
kallaballa commentedon Jan 1, 2025
On the side I am working on a 3D game as the most complex demo/workload yet. Rocks and mist are generated by raymarching distance fields. The whole scene is live-generated like that and goes on forever in a fractal fashion. It renders at around 110FPS@1080p on a Intel A770 GPU and a Intel i9 13900K CPU.
record.mp4
[-]Plan/V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/-][+]Plan-V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+][-]Plan-V4D: A computational graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/-][+]Plan-V4D: A task graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision.[/+]kallaballa commentedon Jan 9, 2025
Plan-V4D on my Anbernic RG351M
ambernic2.webm
kallaballa commentedon Mar 24, 2025
Plan-V4D is largely feature complete. Busy with beta-release work (docs, tutorials, cross-platform, pushing things upstream and packages).
kallaballa commentedon Mar 24, 2025
Made a techdemo of the 3D video game I am working on the side. It is based on Plan-V4D
https://www.youtube.com/watch?v=IxMKj1ywQpQ
kallaballa commentedon Aug 14, 2025
Updated the README and the Tutorials
This should make things much clearer.
At the moment i am working on a flatpak release-demo.
kallaballa commentedon Jul 15, 2026
I entirely rewrote the "Describe the feature and motivation" of the github issue.
kallaballa commentedon Sep 2, 2026
A re-implementation of window_QT.*pp (imshow window using QT-style and counting ~4000 lines) using Plan-V4D (only ~700 lines). It is also much faster. gonna present some figures later.
imshow_final.mp4
kallaballa commentedon Sep 12, 2026
see: #29935