Skip to content

Plan-V4D: A task graph engine with support for 2D/3D graphics as well as GUI in conjuction with computer vision. #22923

Closed

Description

@kallaballa

The name changed from V4D to Plan-V4D because it consists of two components now.

Tutorials

Describe the feature and motivation

How it Compares

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)
  • in optimal cases it uses my 4.x fork: https://github.com/kallaballa/opencv but it is compatible with main-line
  • Most of the PRs pertaining the fork have already been intergrated into 4.x and 5.0
  • External dependencies: OpenCL (optionally), OpenGL, GLEW and GLFW
  • Internal dependencies: opencv_core opencv_imgproc opencv_videoio opencv_video

What do you think?

Activity

  1. kallaballa commented on Dec 6, 2022

    @kallaballa
    ContributorAuthor
    optflow-demo.mp4

    A screen capture of the full example as it looks now.

    Video credits in the README

  2. kallaballa commented on Dec 6, 2022

    @kallaballa
    ContributorAuthor
  3. kallaballa commented on Dec 9, 2022

    @kallaballa
    ContributorAuthor

    I redesigned it into a simple object model.

    https://viel-zu.org/opencv/apidoc/

    Notes:

    • A lot of things still not use OpenCV types and ways
    • To retain NanoVG functionality I consider creating a OpenCV-wrapper for it in its own namespace. Similar to cv::ogl
    • I still have to write a demo without CL-interop
    • The member functions makeVAcapture(), makeVAwriter(), captureVA() and writeVA() 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 namedWindow and imshow.

  4. kallaballa commented on Dec 11, 2022

    @kallaballa
    ContributorAuthor

    After reading some more I think this fits much better into cv::viz.

  5. changed the title [-]Nanogui/OpenGL based UI-Backend[/-] [+]cv::viz::Viz2D implementation[/+] on Dec 12, 2022
  6. kallaballa commented on Dec 13, 2022

    @kallaballa
    ContributorAuthor

    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.

  7. mshabunin commented on Dec 15, 2022

    @mshabunin
    Contributor

    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).

  8. kallaballa commented on Dec 16, 2022

    @kallaballa
    ContributorAuthor

    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?

  9. kallaballa commented on Dec 16, 2022

    @kallaballa
    ContributorAuthor

    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?

  10. kallaballa commented on Dec 21, 2022

    @kallaballa
    ContributorAuthor
    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

  11. kallaballa commented on Dec 21, 2022

    @kallaballa
    ContributorAuthor

    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

  12. kallaballa commented on Dec 21, 2022

    @kallaballa
    ContributorAuthor

    updated the skeleton api docs

  13. kallaballa commented on Dec 21, 2022

    @kallaballa
    ContributorAuthor

    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.

  14. kallaballa commented on Dec 22, 2022

    @kallaballa
    ContributorAuthor

    I ported the Viz2D library and one of the simpler demos (no input video required) to WebAssembly

    emscripten.mp4
  15. 93 remaining items

  16. kallaballa commented on Jan 1, 2025

    @kallaballa
    ContributorAuthor

    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.

  17. 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
  18. 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
  19. kallaballa commented on Jan 1, 2025

    @kallaballa
    ContributorAuthor

    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.

  20. kallaballa commented on Jan 1, 2025

    @kallaballa
    ContributorAuthor

    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
  21. 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
  22. 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
  23. kallaballa commented on Jan 9, 2025

    @kallaballa
    ContributorAuthor

    Plan-V4D on my Anbernic RG351M

    ambernic2.webm
  24. kallaballa commented on Mar 24, 2025

    @kallaballa
    ContributorAuthor

    Plan-V4D is largely feature complete. Busy with beta-release work (docs, tutorials, cross-platform, pushing things upstream and packages).

  25. kallaballa commented on Mar 24, 2025

    @kallaballa
    ContributorAuthor

    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

  26. kallaballa commented on Aug 14, 2025

    @kallaballa
    ContributorAuthor

    Updated the README and the Tutorials

    This should make things much clearer.
    At the moment i am working on a flatpak release-demo.

  27. kallaballa commented on Jul 15, 2026

    @kallaballa
    ContributorAuthor

    I entirely rewrote the "Describe the feature and motivation" of the github issue.

  28. kallaballa commented on Sep 2, 2026

    @kallaballa
    ContributorAuthor

    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
  29. kallaballa commented on Sep 12, 2026

    @kallaballa
    ContributorAuthor

    see: #29935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions