From 10b88dc7fdabce9cb1a100224bf5eaa864bb3cc0 Mon Sep 17 00:00:00 2001 From: kallaballa Date: Sun, 16 Apr 2023 07:08:39 +0200 Subject: [PATCH] global renaming of viz2d to v4d --- .gitignore | 15 -- .gitmodules | 4 +- README.md | 14 +- modules/{viz2d => v4d}/CMakeLists.txt | 14 +- .../doc/custom_source_and_sink.png | Bin modules/{viz2d => v4d}/doc/display_image.png | Bin .../{viz2d => v4d}/doc/display_image_fb.png | Bin modules/{viz2d => v4d}/doc/font_rendering.png | Bin modules/{viz2d => v4d}/doc/font_with_gui.png | Bin modules/{viz2d => v4d}/doc/render_opengl.png | Bin .../{viz2d/doc/viz2d.bib => v4d/doc/v4d.bib} | 0 .../{viz2d => v4d}/doc/vector_graphics.png | Bin .../doc/vector_graphics_and_fb.png | Bin modules/{viz2d => v4d}/doc/video_editing.png | Bin .../include/opencv2/v4d}/cxxpool.hpp | 0 .../include/opencv2/v4d}/dialog.hpp | 14 +- .../include/opencv2/v4d}/formhelper.hpp | 6 +- .../viz2d => v4d/include/opencv2/v4d}/nvg.hpp | 10 +- .../include/opencv2/v4d}/sink.hpp | 10 +- .../include/opencv2/v4d}/source.hpp | 12 +- .../include/opencv2/v4d}/util.hpp | 26 +-- .../include/opencv2/v4d/v4d.hpp} | 38 ++--- modules/{viz2d => v4d}/samples/cpp/Makefile | 2 +- modules/{viz2d => v4d}/samples/cpp/assets | 0 .../samples/cpp/beauty/Makefile | 2 +- .../{viz2d => v4d}/samples/cpp/beauty/assets | 0 .../samples/cpp/beauty/beauty-demo.cpp | 8 +- .../samples/cpp/beauty/beauty.html | 2 +- .../{viz2d => v4d}/samples/cpp/beauty/get.php | 0 .../samples/cpp/beauty/index.php | 0 .../samples/cpp/custom_source_and_sink.cpp | 6 +- .../samples/cpp/display_image.cpp | 8 +- .../samples/cpp/display_image_fb.cpp | 6 +- .../{viz2d => v4d}/samples/cpp/font/Makefile | 2 +- .../samples/cpp/font/font-demo.cpp | 8 +- .../{viz2d => v4d}/samples/cpp/font/font.html | 0 .../{viz2d => v4d}/samples/cpp/font/get.php | 0 .../{viz2d => v4d}/samples/cpp/font/index.php | 0 .../samples/cpp/font_rendering.cpp | 6 +- .../samples/cpp/font_with_gui.cpp | 6 +- .../samples/cpp/nanovg/Makefile | 2 +- .../samples/cpp/nanovg/nanovg-demo.cpp | 6 +- .../samples/cpp/optflow/Makefile | 2 +- .../samples/cpp/optflow/get.php | 0 .../samples/cpp/optflow/index.php | 0 .../samples/cpp/optflow/local.html | 2 +- .../samples/cpp/optflow/optflow-demo.cpp | 10 +- .../samples/cpp/optflow/optflow.html | 2 +- .../samples/cpp/pedestrian/Makefile | 2 +- .../cpp/pedestrian/pedestrian-demo.cpp | 8 +- .../samples/cpp/render_opengl.cpp | 4 +- .../samples/cpp/shader/Makefile | 2 +- .../{viz2d => v4d}/samples/cpp/shader/get.php | 0 .../samples/cpp/shader/index.php | 0 .../samples/cpp/shader/shader-demo.cpp | 18 +-- .../samples/cpp/shader/shader.html | 0 .../{viz2d => v4d}/samples/cpp/tetra/Makefile | 2 +- .../samples/cpp/tetra/tetra-demo.cpp | 8 +- .../samples/cpp/vector_graphics.cpp | 6 +- .../samples/cpp/vector_graphics_and_fb.cpp | 6 +- .../{viz2d => v4d}/samples/cpp/video/Makefile | 2 +- .../samples/cpp/video/video-demo.cpp | 8 +- .../samples/cpp/video_editing.cpp | 6 +- .../{viz2d => v4d}/src/detail/clvacontext.cpp | 2 +- .../{viz2d => v4d}/src/detail/clvacontext.hpp | 4 +- .../src/detail/framebuffercontext.cpp | 8 +- .../src/detail/framebuffercontext.hpp | 10 +- .../src/detail/nanovgcontext.cpp | 8 +- .../src/detail/nanovgcontext.hpp | 14 +- modules/{viz2d => v4d}/src/dialog.cpp | 12 +- modules/{viz2d => v4d}/src/formhelper.cpp | 2 +- modules/{viz2d => v4d}/src/nvg.cpp | 2 +- modules/{viz2d => v4d}/src/sink.cpp | 4 +- modules/{viz2d => v4d}/src/source.cpp | 4 +- modules/{viz2d => v4d}/src/util.cpp | 12 +- .../{viz2d/src/viz2d.cpp => v4d/src/v4d.cpp} | 150 +++++++++--------- modules/{viz2d => v4d}/third/nanogui | 0 .../tutorials/00-intro.markdown | 78 ++++----- .../tutorials/01-dislay_image.markdown | 8 +- .../tutorials/02-vector_graphics.markdown | 6 +- .../tutorials/03-render_opengl.markdown | 6 +- .../tutorials/04-font_rendering.markdown | 6 +- .../tutorials/05-video_editing.markdown | 6 +- .../06-custom_source_and_sink.markdown | 17 ++ .../tutorials/07-font_with_gui.markdown | 4 +- .../tutorials/10-tetra.markdown | 6 +- .../tutorials/11-video.markdown | 6 +- .../tutorials/12-nanovg.markdown | 6 +- .../tutorials/13-shader.markdown | 6 +- .../{viz2d => v4d}/tutorials/14-font.markdown | 6 +- .../tutorials/15-pedestrian.markdown | 6 +- .../tutorials/16-optflow.markdown | 6 +- .../tutorials/17-beauty.markdown | 4 +- .../06-custom_source_and_sink.markdown | 17 -- 94 files changed, 363 insertions(+), 378 deletions(-) rename modules/{viz2d => v4d}/CMakeLists.txt (81%) rename modules/{viz2d => v4d}/doc/custom_source_and_sink.png (100%) rename modules/{viz2d => v4d}/doc/display_image.png (100%) rename modules/{viz2d => v4d}/doc/display_image_fb.png (100%) rename modules/{viz2d => v4d}/doc/font_rendering.png (100%) rename modules/{viz2d => v4d}/doc/font_with_gui.png (100%) rename modules/{viz2d => v4d}/doc/render_opengl.png (100%) rename modules/{viz2d/doc/viz2d.bib => v4d/doc/v4d.bib} (100%) rename modules/{viz2d => v4d}/doc/vector_graphics.png (100%) rename modules/{viz2d => v4d}/doc/vector_graphics_and_fb.png (100%) rename modules/{viz2d => v4d}/doc/video_editing.png (100%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/cxxpool.hpp (100%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/dialog.hpp (85%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/formhelper.hpp (97%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/nvg.hpp (99%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/sink.hpp (86%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/source.hpp (88%) rename modules/{viz2d/include/opencv2/viz2d => v4d/include/opencv2/v4d}/util.hpp (88%) rename modules/{viz2d/include/opencv2/viz2d/viz2d.hpp => v4d/include/opencv2/v4d/v4d.hpp} (93%) rename modules/{viz2d => v4d}/samples/cpp/Makefile (99%) rename modules/{viz2d => v4d}/samples/cpp/assets (100%) rename modules/{viz2d => v4d}/samples/cpp/beauty/Makefile (97%) rename modules/{viz2d => v4d}/samples/cpp/beauty/assets (100%) rename modules/{viz2d => v4d}/samples/cpp/beauty/beauty-demo.cpp (98%) rename modules/{viz2d => v4d}/samples/cpp/beauty/beauty.html (99%) rename modules/{viz2d => v4d}/samples/cpp/beauty/get.php (100%) rename modules/{viz2d => v4d}/samples/cpp/beauty/index.php (100%) rename modules/{viz2d => v4d}/samples/cpp/custom_source_and_sink.cpp (92%) rename modules/{viz2d => v4d}/samples/cpp/display_image.cpp (66%) rename modules/{viz2d => v4d}/samples/cpp/display_image_fb.cpp (79%) rename modules/{viz2d => v4d}/samples/cpp/font/Makefile (96%) rename modules/{viz2d => v4d}/samples/cpp/font/font-demo.cpp (97%) rename modules/{viz2d => v4d}/samples/cpp/font/font.html (100%) rename modules/{viz2d => v4d}/samples/cpp/font/get.php (100%) rename modules/{viz2d => v4d}/samples/cpp/font/index.php (100%) rename modules/{viz2d => v4d}/samples/cpp/font_rendering.cpp (82%) rename modules/{viz2d => v4d}/samples/cpp/font_with_gui.cpp (89%) rename modules/{viz2d => v4d}/samples/cpp/nanovg/Makefile (96%) rename modules/{viz2d => v4d}/samples/cpp/nanovg/nanovg-demo.cpp (96%) rename modules/{viz2d => v4d}/samples/cpp/optflow/Makefile (97%) rename modules/{viz2d => v4d}/samples/cpp/optflow/get.php (100%) rename modules/{viz2d => v4d}/samples/cpp/optflow/index.php (100%) rename modules/{viz2d => v4d}/samples/cpp/optflow/local.html (99%) rename modules/{viz2d => v4d}/samples/cpp/optflow/optflow-demo.cpp (97%) rename modules/{viz2d => v4d}/samples/cpp/optflow/optflow.html (99%) rename modules/{viz2d => v4d}/samples/cpp/pedestrian/Makefile (95%) rename modules/{viz2d => v4d}/samples/cpp/pedestrian/pedestrian-demo.cpp (97%) rename modules/{viz2d => v4d}/samples/cpp/render_opengl.cpp (92%) rename modules/{viz2d => v4d}/samples/cpp/shader/Makefile (96%) rename modules/{viz2d => v4d}/samples/cpp/shader/get.php (100%) rename modules/{viz2d => v4d}/samples/cpp/shader/index.php (100%) rename modules/{viz2d => v4d}/samples/cpp/shader/shader-demo.cpp (97%) rename modules/{viz2d => v4d}/samples/cpp/shader/shader.html (100%) rename modules/{viz2d => v4d}/samples/cpp/tetra/Makefile (96%) rename modules/{viz2d => v4d}/samples/cpp/tetra/tetra-demo.cpp (94%) rename modules/{viz2d => v4d}/samples/cpp/vector_graphics.cpp (83%) rename modules/{viz2d => v4d}/samples/cpp/vector_graphics_and_fb.cpp (85%) rename modules/{viz2d => v4d}/samples/cpp/video/Makefile (94%) rename modules/{viz2d => v4d}/samples/cpp/video/video-demo.cpp (94%) rename modules/{viz2d => v4d}/samples/cpp/video_editing.cpp (87%) rename modules/{viz2d => v4d}/src/detail/clvacontext.cpp (98%) rename modules/{viz2d => v4d}/src/detail/clvacontext.hpp (97%) rename modules/{viz2d => v4d}/src/detail/framebuffercontext.cpp (98%) rename modules/{viz2d => v4d}/src/detail/framebuffercontext.hpp (97%) rename modules/{viz2d => v4d}/src/detail/nanovgcontext.cpp (92%) rename modules/{viz2d => v4d}/src/detail/nanovgcontext.hpp (87%) rename modules/{viz2d => v4d}/src/dialog.cpp (93%) rename modules/{viz2d => v4d}/src/formhelper.cpp (97%) rename modules/{viz2d => v4d}/src/nvg.cpp (99%) rename modules/{viz2d => v4d}/src/sink.cpp (91%) rename modules/{viz2d => v4d}/src/source.cpp (93%) rename modules/{viz2d => v4d}/src/util.cpp (96%) rename modules/{viz2d/src/viz2d.cpp => v4d/src/v4d.cpp} (83%) rename modules/{viz2d => v4d}/third/nanogui (100%) rename modules/{viz2d => v4d}/tutorials/00-intro.markdown (60%) rename modules/{viz2d => v4d}/tutorials/01-dislay_image.markdown (57%) rename modules/{viz2d => v4d}/tutorials/02-vector_graphics.markdown (84%) rename modules/{viz2d => v4d}/tutorials/03-render_opengl.markdown (72%) rename modules/{viz2d => v4d}/tutorials/04-font_rendering.markdown (70%) rename modules/{viz2d => v4d}/tutorials/05-video_editing.markdown (79%) create mode 100644 modules/v4d/tutorials/06-custom_source_and_sink.markdown rename modules/{viz2d => v4d}/tutorials/07-font_with_gui.markdown (80%) rename modules/{viz2d => v4d}/tutorials/10-tetra.markdown (81%) rename modules/{viz2d => v4d}/tutorials/11-video.markdown (80%) rename modules/{viz2d => v4d}/tutorials/12-nanovg.markdown (80%) rename modules/{viz2d => v4d}/tutorials/13-shader.markdown (76%) rename modules/{viz2d => v4d}/tutorials/14-font.markdown (78%) rename modules/{viz2d => v4d}/tutorials/15-pedestrian.markdown (83%) rename modules/{viz2d => v4d}/tutorials/16-optflow.markdown (84%) rename modules/{viz2d => v4d}/tutorials/17-beauty.markdown (85%) delete mode 100644 modules/viz2d/tutorials/06-custom_source_and_sink.markdown diff --git a/.gitignore b/.gitignore index 3a4862ad2..6389de8d4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,21 +11,6 @@ src/*/*.wasm src/*/*/*.o src/*/*/*.dep src/*/*/*.d -src/common/libviz2d.so -src/tetra/tetra-demo -src/video/video-demo -src/shader/shader-demo -src/nanovg/nanovg-demo -src/optflow/optflow-demo -src/beauty/beauty-demo -src/font/font-demo -src/pedestrian/pedestrian-demo *.webm *.mkv -apidoc/ -docbook/ -latex/ -src/beauty/assets -src/beauty/beauty-demo.data -src/quad/quad-demo diff --git a/.gitmodules b/.gitmodules index a8fc499c1..9788c5e02 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "modules/viz2d/third/nanogui"] - path = modules/viz2d/third/nanogui +[submodule "modules/v4d/third/nanogui"] + path = modules/v4d/third/nanogui url = https://github.com/kallaballa/nanogui.git diff --git a/README.md b/README.md index 788fd6e47..61281c624 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Viz2D -Viz2D is a visualization module for [OpenCV](https://github.com/opencv/opencv). It features vector graphics using [NanoVG](https://github.com/memononen/nanovg) a GUI based on [NanoGUI](https://github.com/mitsuba-renderer/nanogui) and (on supported systems) OpenCL/OpenGL and OpenCL/VAAPI interoperability. It should be included in [OpenCV-contrib](https://github.com/opencv/opencv_contrib) once it is ready. +# V4D +V4D is a visualization module for [OpenCV](https://github.com/opencv/opencv). It features vector graphics using [NanoVG](https://github.com/memononen/nanovg) a GUI based on [NanoGUI](https://github.com/mitsuba-renderer/nanogui) and (on supported systems) OpenCL/OpenGL and OpenCL/VAAPI interoperability. It should be included in [OpenCV-contrib](https://github.com/opencv/opencv_contrib) once it is ready. -# What is Viz2D? -Viz2D is a way of writing graphical (on- and offscreen) high performance applications with OpenCV. It is light-weight and unencumbered by QT or GTK licenses. +# What is V4D? +V4D is a way of writing graphical (on- and offscreen) high performance applications with OpenCV. It is light-weight and unencumbered by QT or GTK licenses. -# Why Viz2D? -Please refer to the [online demos](https://github.com/kallaballa/Viz2D/blob/main/README.md#online-demos) to see at a glance what it can do for you. +# Why V4D? +Please refer to the [online demos](https://github.com/kallaballa/V4D/blob/main/README.md#online-demos) to see at a glance what it can do for you. * OpenGL: Easy access to OpenGL. * GUI: Simple yet powerful user interfaces through NanoGUI. @@ -25,7 +25,7 @@ Please note that the following online demos are slower and/or have less features * https://viel-zu.org/opencv/beauty # Documentation -OpenCV module documentation with tutorials, samples and build instructions is available [here](https://viel-zu.org/opencv/doxygen/html/dc/d7b/viz2d.html) +OpenCV module documentation with tutorials, samples and build instructions is available [here](https://viel-zu.org/opencv/doxygen/html/dc/d7b/v4d.html) # Attribution * The author of the bunny video is **(c) copyright Blender Foundation | www.bigbuckbunny.org**. diff --git a/modules/viz2d/CMakeLists.txt b/modules/v4d/CMakeLists.txt similarity index 81% rename from modules/viz2d/CMakeLists.txt rename to modules/v4d/CMakeLists.txt index ea821e87b..fe221ff14 100644 --- a/modules/viz2d/CMakeLists.txt +++ b/modules/v4d/CMakeLists.txt @@ -1,16 +1,16 @@ include("FindGLEW") -set(the_description "Viz2D Visualization Module") +set(the_description "V4D Visualization Module") if(NOT GLEW_FOUND) - message(STATUS "Module opencv_viz2d disabled because GLEW was not found") - ocv_module_disable(viz2d) + message(STATUS "Module opencv_v4d disabled because GLEW was not found") + ocv_module_disable(v4d) endif() get_property(known_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) list (FIND known_features "cxx_std_20" idx) if (${idx} LESS 0) - message(STATUS "Module opencv_viz2d disabled because it requires C++20") - ocv_module_disable(viz2d) + message(STATUS "Module opencv_v4d disabled because it requires C++20") + ocv_module_disable(v4d) endif() set(CMAKE_CXX_FLAGS "${CMAKE_LD_FLAGS} -L../../lib") @@ -35,7 +35,7 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third/nanogui/ext/nanovg/src/") include_directories(${GLEW_INCLUDE_DIRS}) link_directories(${GLEW_LIBRARY_DIRS}) -ocv_add_module(viz2d opencv_core opencv_imgproc opencv_videoio opencv_video) +ocv_add_module(v4d opencv_core opencv_imgproc opencv_videoio opencv_video) ocv_glob_module_sources() ocv_module_include_directories() ocv_create_module() @@ -46,7 +46,7 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third/nanogui) add_library(nanovg "third/nanogui/ext/nanovg/src/nanovg.c") -target_compile_features(opencv_viz2d PRIVATE cxx_std_20) +target_compile_features(opencv_v4d PRIVATE cxx_std_20) #ocv_add_samples(opencv_aruco) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-parameter -Wdeprecated-enum-enum-conversion) diff --git a/modules/viz2d/doc/custom_source_and_sink.png b/modules/v4d/doc/custom_source_and_sink.png similarity index 100% rename from modules/viz2d/doc/custom_source_and_sink.png rename to modules/v4d/doc/custom_source_and_sink.png diff --git a/modules/viz2d/doc/display_image.png b/modules/v4d/doc/display_image.png similarity index 100% rename from modules/viz2d/doc/display_image.png rename to modules/v4d/doc/display_image.png diff --git a/modules/viz2d/doc/display_image_fb.png b/modules/v4d/doc/display_image_fb.png similarity index 100% rename from modules/viz2d/doc/display_image_fb.png rename to modules/v4d/doc/display_image_fb.png diff --git a/modules/viz2d/doc/font_rendering.png b/modules/v4d/doc/font_rendering.png similarity index 100% rename from modules/viz2d/doc/font_rendering.png rename to modules/v4d/doc/font_rendering.png diff --git a/modules/viz2d/doc/font_with_gui.png b/modules/v4d/doc/font_with_gui.png similarity index 100% rename from modules/viz2d/doc/font_with_gui.png rename to modules/v4d/doc/font_with_gui.png diff --git a/modules/viz2d/doc/render_opengl.png b/modules/v4d/doc/render_opengl.png similarity index 100% rename from modules/viz2d/doc/render_opengl.png rename to modules/v4d/doc/render_opengl.png diff --git a/modules/viz2d/doc/viz2d.bib b/modules/v4d/doc/v4d.bib similarity index 100% rename from modules/viz2d/doc/viz2d.bib rename to modules/v4d/doc/v4d.bib diff --git a/modules/viz2d/doc/vector_graphics.png b/modules/v4d/doc/vector_graphics.png similarity index 100% rename from modules/viz2d/doc/vector_graphics.png rename to modules/v4d/doc/vector_graphics.png diff --git a/modules/viz2d/doc/vector_graphics_and_fb.png b/modules/v4d/doc/vector_graphics_and_fb.png similarity index 100% rename from modules/viz2d/doc/vector_graphics_and_fb.png rename to modules/v4d/doc/vector_graphics_and_fb.png diff --git a/modules/viz2d/doc/video_editing.png b/modules/v4d/doc/video_editing.png similarity index 100% rename from modules/viz2d/doc/video_editing.png rename to modules/v4d/doc/video_editing.png diff --git a/modules/viz2d/include/opencv2/viz2d/cxxpool.hpp b/modules/v4d/include/opencv2/v4d/cxxpool.hpp similarity index 100% rename from modules/viz2d/include/opencv2/viz2d/cxxpool.hpp rename to modules/v4d/include/opencv2/v4d/cxxpool.hpp diff --git a/modules/viz2d/include/opencv2/viz2d/dialog.hpp b/modules/v4d/include/opencv2/v4d/dialog.hpp similarity index 85% rename from modules/viz2d/include/opencv2/viz2d/dialog.hpp rename to modules/v4d/include/opencv2/v4d/dialog.hpp index 257722468..f6b6b6993 100644 --- a/modules/viz2d/include/opencv2/viz2d/dialog.hpp +++ b/modules/v4d/include/opencv2/v4d/dialog.hpp @@ -3,13 +3,13 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_DIALOG_HPP_ -#define SRC_OPENCV_VIZ2D_DIALOG_HPP_ +#ifndef SRC_OPENCV_V4D_DIALOG_HPP_ +#define SRC_OPENCV_V4D_DIALOG_HPP_ #ifdef __EMSCRIPTEN__ -#define VIZ2D_USE_ES3 1 +#define V4D_USE_ES3 1 #endif -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 #define NANOGUI_USE_OPENGL #else #define NANOGUI_USE_GLES @@ -33,8 +33,8 @@ using std::string; */ class CV_EXPORTS Dialog: public nanogui::Window { private: - static std::function viz2DWin_Xcomparator; - static std::set all_windows_xsorted_; + static std::function v4dWin_Xcomparator; + static std::set all_windows_xsorted_; nanogui::Screen* screen_; nanogui::Vector2i lastDragPos_; nanogui::Vector2i maximizedPos_; @@ -68,4 +68,4 @@ public: } /* namespace viz */ } /* namespace cv */ -#endif /* SRC_OPENCV_VIZ2D_DIALOG_HPP_ */ +#endif /* SRC_OPENCV_V4D_DIALOG_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/formhelper.hpp b/modules/v4d/include/opencv2/v4d/formhelper.hpp similarity index 97% rename from modules/viz2d/include/opencv2/viz2d/formhelper.hpp rename to modules/v4d/include/opencv2/v4d/formhelper.hpp index d477f4fb0..a7fc03666 100644 --- a/modules/viz2d/include/opencv2/viz2d/formhelper.hpp +++ b/modules/v4d/include/opencv2/v4d/formhelper.hpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_FORMHELPER_HPP_ -#define SRC_OPENCV_VIZ2D_FORMHELPER_HPP_ +#ifndef SRC_OPENCV_V4D_FORMHELPER_HPP_ +#define SRC_OPENCV_V4D_FORMHELPER_HPP_ #include "dialog.hpp" #include @@ -126,4 +126,4 @@ public: } /* namespace viz */ } /* namespace cv */ -#endif /* SRC_OPENCV_VIZ2D_FORMHELPER_HPP_ */ +#endif /* SRC_OPENCV_V4D_FORMHELPER_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/nvg.hpp b/modules/v4d/include/opencv2/v4d/nvg.hpp similarity index 99% rename from modules/viz2d/include/opencv2/viz2d/nvg.hpp rename to modules/v4d/include/opencv2/v4d/nvg.hpp index 9ab5e9509..87d471cd1 100644 --- a/modules/viz2d/include/opencv2/viz2d/nvg.hpp +++ b/modules/v4d/include/opencv2/v4d/nvg.hpp @@ -3,10 +3,10 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_NVG_HPP_ -#define SRC_OPENCV_VIZ2D_NVG_HPP_ +#ifndef SRC_OPENCV_V4D_NVG_HPP_ +#define SRC_OPENCV_V4D_NVG_HPP_ -#include "viz2d.hpp" +#include "v4d.hpp" #ifndef __EMSCRIPTEN__ #define NANOGUI_USE_OPENGL #else @@ -84,7 +84,7 @@ namespace detail { */ class NVG { private: - friend class Viz2D; + friend class V4D; static NVG* nvg_instance_; NVGcontext* ctx_ = nullptr; NVG(NVGcontext* ctx) : @@ -517,4 +517,4 @@ CV_EXPORTS void resetScissor(); } } -#endif /* SRC_OPENCV_VIZ2D_NVG_HPP_ */ +#endif /* SRC_OPENCV_V4D_NVG_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/sink.hpp b/modules/v4d/include/opencv2/v4d/sink.hpp similarity index 86% rename from modules/viz2d/include/opencv2/viz2d/sink.hpp rename to modules/v4d/include/opencv2/v4d/sink.hpp index 330fc98d0..8bf34ba3b 100644 --- a/modules/viz2d/include/opencv2/viz2d/sink.hpp +++ b/modules/v4d/include/opencv2/v4d/sink.hpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_SINK_HPP_ -#define SRC_OPENCV_VIZ2D_SINK_HPP_ +#ifndef SRC_OPENCV_V4D_SINK_HPP_ +#define SRC_OPENCV_V4D_SINK_HPP_ #include #include @@ -14,7 +14,7 @@ namespace cv { namespace viz { /*! - * A Sink object represents a way to write data produced by Viz2D (e.g. a video-file). + * A Sink object represents a way to write data produced by V4D (e.g. a video-file). */ class CV_EXPORTS Sink { bool open_ = true; @@ -50,7 +50,7 @@ public: CV_EXPORTS void operator()(const cv::UMat& frame); }; -} /* namespace viz2d */ +} /* namespace v4d */ } /* namespace kb */ -#endif /* SRC_OPENCV_VIZ2D_SINK_HPP_ */ +#endif /* SRC_OPENCV_V4D_SINK_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/source.hpp b/modules/v4d/include/opencv2/v4d/source.hpp similarity index 88% rename from modules/viz2d/include/opencv2/viz2d/source.hpp rename to modules/v4d/include/opencv2/v4d/source.hpp index 801832a86..ed215dad9 100644 --- a/modules/viz2d/include/opencv2/viz2d/source.hpp +++ b/modules/v4d/include/opencv2/v4d/source.hpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_SOURCE_HPP_ -#define SRC_OPENCV_VIZ2D_SOURCE_HPP_ +#ifndef SRC_OPENCV_V4D_SOURCE_HPP_ +#define SRC_OPENCV_V4D_SOURCE_HPP_ #include #include @@ -14,7 +14,7 @@ namespace cv { namespace viz { /*! - * A Source object represents a way to provide data to Viz2D by using + * A Source object represents a way to provide data to V4D by using * a generator functor. */ class CV_EXPORTS Source { @@ -27,7 +27,7 @@ public: /*! * Constructs the Source object from a generator functor. * @param generator A function object that accepts a reference to a UMat frame - * that it manipulates. This is ultimatively used to provide video data to #cv::viz::Viz2D + * that it manipulates. This is ultimatively used to provide video data to #cv::viz::V4D * @param fps The fps the Source object provides data with. */ CV_EXPORTS Source(std::function generator, float fps); @@ -62,7 +62,7 @@ public: CV_EXPORTS std::pair operator()(); }; -} /* namespace viz2d */ +} /* namespace v4d */ } /* namespace kb */ -#endif /* SRC_OPENCV_VIZ2D_SOURCE_HPP_ */ +#endif /* SRC_OPENCV_V4D_SOURCE_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/util.hpp b/modules/v4d/include/opencv2/v4d/util.hpp similarity index 88% rename from modules/viz2d/include/opencv2/viz2d/util.hpp rename to modules/v4d/include/opencv2/v4d/util.hpp index b9841c930..845d66fc6 100644 --- a/modules/viz2d/include/opencv2/viz2d/util.hpp +++ b/modules/v4d/include/opencv2/v4d/util.hpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_UTIL_HPP_ -#define SRC_OPENCV_VIZ2D_UTIL_HPP_ +#ifndef SRC_OPENCV_V4D_UTIL_HPP_ +#define SRC_OPENCV_V4D_UTIL_HPP_ #include "source.hpp" #include "sink.hpp" @@ -22,7 +22,7 @@ namespace cv { namespace viz { using std::string; -class Viz2D; +class V4D; /*! * Returns the OpenGL Version information. * @return a string object with the OpenGL version information @@ -56,14 +56,14 @@ CV_EXPORTS bool keepRunning(); /*! * Little helper function to keep track of FPS and optionally display it using NanoVG - * @param v2d The Viz2D object to operate on + * @param v2d The V4D object to operate on * @param graphical if this parameter is true the FPS drawn on display */ -CV_EXPORTS void updateFps(cv::Ptr v2d, bool graphical); +CV_EXPORTS void updateFps(cv::Ptr v2d, bool graphical); #ifndef __EMSCRIPTEN__ /*! - * Creates an Intel VAAPI enabled VideoWriter sink object to use in conjunction with #Viz2D::setSink(). + * Creates an Intel VAAPI enabled VideoWriter sink object to use in conjunction with #V4D::setSink(). * Usually you would call #makeWriterSink() and let it automatically decide if VAAPI is available. * @param outputFilename The filename to write the video to. * @param fourcc The fourcc code of the codec to use. @@ -75,7 +75,7 @@ CV_EXPORTS void updateFps(cv::Ptr v2d, bool graphical); CV_EXPORTS Sink makeVaSink(const string& outputFilename, const int fourcc, const float fps, const cv::Size& frameSize, const int vaDeviceIndex); /*! - * Creates an Intel VAAPI enabled VideoCapture source object to use in conjunction with #Viz2D::setSource(). + * Creates an Intel VAAPI enabled VideoCapture source object to use in conjunction with #V4D::setSource(). * Usually you would call #makeCaptureSource() and let it automatically decide if VAAPI is available. * @param inputFilename The file to read from. * @param vaDeviceIndex The VAAPI device index to use. @@ -83,7 +83,7 @@ CV_EXPORTS Sink makeVaSink(const string& outputFilename, const int fourcc, const */ CV_EXPORTS Source makeVaSource(const string& inputFilename, const int vaDeviceIndex); /*! - * Creates a VideoWriter sink object to use in conjunction with #Viz2D::setSink(). + * Creates a VideoWriter sink object to use in conjunction with #V4D::setSink(). * This function automatically determines if Intel VAAPI is available and enables it if so. * @param outputFilename The filename to write the video to. * @param fourcc The fourcc code of the codec to use. @@ -94,7 +94,7 @@ CV_EXPORTS Source makeVaSource(const string& inputFilename, const int vaDeviceIn CV_EXPORTS Sink makeWriterSink(const string& outputFilename, const int fourcc, const float fps, const cv::Size& frameSize); /*! - * Creates a VideoCapture source object to use in conjunction with #Viz2D::setSource(). + * Creates a VideoCapture source object to use in conjunction with #V4D::setSource(). * This function automatically determines if Intel VAAPI is available and enables it if so. * @param inputFilename The file to read from. * @return A (optionally VAAPI enabled) VideoCapture enabled source object. @@ -102,10 +102,10 @@ CV_EXPORTS Sink makeWriterSink(const string& outputFilename, const int fourcc, c CV_EXPORTS Source makeCaptureSource(const string& inputFilename); #else /*! - * Creates a WebCam source object to use in conjunction with #Viz2D::setSource(). + * Creates a WebCam source object to use in conjunction with #V4D::setSource(). * In the background it uses emscripten's file system implementation to transfer frames from the camera to the source object - * @param width The frame width to capture (usually the initial width of the Viz2D object) - * @param height The frame height to capture (usually the initial height of the Viz2D object) + * @param width The frame width to capture (usually the initial width of the V4D object) + * @param height The frame height to capture (usually the initial height of the V4D object) * @return A WebCam source object. */ CV_EXPORTS Source makeCaptureSource(int width, int height); @@ -114,4 +114,4 @@ CV_EXPORTS Source makeCaptureSource(int width, int height); } } -#endif /* SRC_OPENCV_VIZ2D_UTIL_HPP_ */ +#endif /* SRC_OPENCV_V4D_UTIL_HPP_ */ diff --git a/modules/viz2d/include/opencv2/viz2d/viz2d.hpp b/modules/v4d/include/opencv2/v4d/v4d.hpp similarity index 93% rename from modules/viz2d/include/opencv2/viz2d/viz2d.hpp rename to modules/v4d/include/opencv2/v4d/v4d.hpp index bae070b5c..b6c960277 100644 --- a/modules/viz2d/include/opencv2/viz2d/viz2d.hpp +++ b/modules/v4d/include/opencv2/v4d/v4d.hpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#ifndef SRC_OPENCV_VIZ2D_VIZ2D_HPP_ -#define SRC_OPENCV_VIZ2D_VIZ2D_HPP_ +#ifndef SRC_OPENCV_V4D_V4D_HPP_ +#define SRC_OPENCV_V4D_V4D_HPP_ #include "source.hpp" #include "sink.hpp" @@ -21,18 +21,18 @@ #include "cxxpool.hpp" #ifdef __EMSCRIPTEN__ -#define VIZ2D_USE_ES3 1 +#define V4D_USE_ES3 1 #include #endif -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 #define NANOGUI_USE_OPENGL #else #define NANOGUI_USE_GLES #define NANOGUI_GLES_VERSION 3 #endif #include -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 #include #else #include @@ -118,7 +118,7 @@ using namespace cv::viz::detail; class NVG; -class CV_EXPORTS Viz2D { +class CV_EXPORTS V4D { friend class NanoVGContext; const cv::Size initialSize_; cv::Size frameBufferSize_; @@ -160,16 +160,16 @@ class CV_EXPORTS Viz2D { std::function keyEventCb_; public: /*! - * Creates a Viz2D object which is the central object to perform visualizations with. + * Creates a V4D object which is the central object to perform visualizations with. * @param size The window and framebuffer size * @param title The window title. * @param debug Create a debug OpenGL context. */ - CV_EXPORTS static cv::Ptr make(const cv::Size& size, const string& title, bool debug = + CV_EXPORTS static cv::Ptr make(const cv::Size& size, const string& title, bool debug = false); /*! - * Creates a Viz2D object which is the central object to perform visualizations with. + * Creates a V4D object which is the central object to perform visualizations with. * @param initialSize The initial size of the heavy-weight window. * @param frameBufferSize The initial size of the framebuffer backing the window (needs to be equal or greate then initial size). * @param offscreen Don't create a window and rather render offscreen. @@ -179,21 +179,21 @@ public: * @param samples MSAA samples. * @param debug Create a debug OpenGL context. */ - CV_EXPORTS static cv::Ptr make(const cv::Size& initialSize, + CV_EXPORTS static cv::Ptr make(const cv::Size& initialSize, const cv::Size& frameBufferSize, bool offscreen, const string& title, int major = 3, int minor = 2, bool compat = true, int samples = 0, bool debug = false); /*! * Default destructor */ - CV_EXPORTS virtual ~Viz2D(); + CV_EXPORTS virtual ~V4D(); /*! - * In case several Viz2D objects are in use all objects not in use have to + * In case several V4D objects are in use all objects not in use have to * call #makeNoneCurrent() and only the one to be active call #makeCurrent(). */ CV_EXPORTS void makeCurrent(); /*! - * To make it possible for other Viz2D objects to become current all other - * Viz2d instances have to become non-current. + * To make it possible for other V4D objects to become current all other + * V4D instances have to become non-current. */ CV_EXPORTS void makeNoneCurrent(); @@ -250,7 +250,7 @@ public: */ CV_EXPORTS void feed(cv::InputArray& in); /*! - * Called to capture to the framebuffer from a #cv::viz::Source object provided via #Viz2D::setSource(). + * Called to capture to the framebuffer from a #cv::viz::Source object provided via #V4D::setSource(). * @return true if successful. */ CV_EXPORTS bool capture(); @@ -263,7 +263,7 @@ public: */ CV_EXPORTS bool capture(std::function fn); /*! - * Called to write the framebuffer to a #cv::viz::Sink object provided via #Viz2D::setSink() + * Called to write the framebuffer to a #cv::viz::Sink object provided via #V4D::setSink() */ CV_EXPORTS void write(); /*! @@ -429,7 +429,7 @@ public: CV_EXPORTS bool display(); private: /*! - * Creates a Viz2D object which is the central object to perform visualizations with. + * Creates a V4D object which is the central object to perform visualizations with. * @param initialSize The initial size of the heavy-weight window. * @param frameBufferSize The initial size of the framebuffer backing the window (needs to be equal or greate then initial size). * @param offscreen Don't create a window and rather render offscreen. @@ -439,7 +439,7 @@ private: * @param samples MSAA samples. * @param debug Create a debug OpenGL context. */ - CV_EXPORTS Viz2D(const cv::Size& initialSize, const cv::Size& frameBufferSize, bool offscreen, + CV_EXPORTS V4D(const cv::Size& initialSize, const cv::Size& frameBufferSize, bool offscreen, const string& title, int major = 3, int minor = 2, bool compat = true, int samples = 0, bool debug = false); void setDefaultKeyboardEventCallback(); void setKeyboardEventCallback( @@ -461,4 +461,4 @@ private: } } /* namespace kb */ -#endif /* SRC_OPENCV_VIZ2D_VIZ2D_HPP_ */ +#endif /* SRC_OPENCV_V4D_V4D_HPP_ */ diff --git a/modules/viz2d/samples/cpp/Makefile b/modules/v4d/samples/cpp/Makefile similarity index 99% rename from modules/viz2d/samples/cpp/Makefile rename to modules/v4d/samples/cpp/Makefile index 8b62ee6f0..a6cc821af 100644 --- a/modules/viz2d/samples/cpp/Makefile +++ b/modules/v4d/samples/cpp/Makefile @@ -4,7 +4,7 @@ ifdef EMSDK LDFLAGS := -flto -L/usr/local/lib/ -L../common LIBS := -lopencv_core -lopencv_imgproc -lnanogui else -#CXXFLAGS += -DVIZ2D_USE_ES3=1 +#CXXFLAGS += -DV4D_USE_ES3=1 LDFLAGS := -L/opt/local/lib -flto -L/usr/local/lib64 -L../common/ -L/usr/local/lib LIBS := -lnanogui endif diff --git a/modules/viz2d/samples/cpp/assets b/modules/v4d/samples/cpp/assets similarity index 100% rename from modules/viz2d/samples/cpp/assets rename to modules/v4d/samples/cpp/assets diff --git a/modules/viz2d/samples/cpp/beauty/Makefile b/modules/v4d/samples/cpp/beauty/Makefile similarity index 97% rename from modules/viz2d/samples/cpp/beauty/Makefile rename to modules/v4d/samples/cpp/beauty/Makefile index 6659befd8..27db9f2f3 100644 --- a/modules/viz2d/samples/cpp/beauty/Makefile +++ b/modules/v4d/samples/cpp/beauty/Makefile @@ -15,7 +15,7 @@ CXXFLAGS += -fpic ifdef EMSDK LDFLAGS += --preload-file assets/ endif -LIBS += -lm -lopencv_dnn -lopencv_face -lopencv_objdetect -lopencv_stitching -lopencv_viz2d +LIBS += -lm -lopencv_dnn -lopencv_face -lopencv_objdetect -lopencv_stitching -lopencv_v4d ifndef EMSDK LIBS += -lOpenCL else diff --git a/modules/viz2d/samples/cpp/beauty/assets b/modules/v4d/samples/cpp/beauty/assets similarity index 100% rename from modules/viz2d/samples/cpp/beauty/assets rename to modules/v4d/samples/cpp/beauty/assets diff --git a/modules/viz2d/samples/cpp/beauty/beauty-demo.cpp b/modules/v4d/samples/cpp/beauty/beauty-demo.cpp similarity index 98% rename from modules/viz2d/samples/cpp/beauty/beauty-demo.cpp rename to modules/v4d/samples/cpp/beauty/beauty-demo.cpp index 058bc60a4..3bc314af2 100644 --- a/modules/viz2d/samples/cpp/beauty/beauty-demo.cpp +++ b/modules/v4d/samples/cpp/beauty/beauty-demo.cpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" #include #include @@ -47,7 +47,7 @@ bool side_by_side = false; bool stretch = false; #endif -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Beauty Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Beauty Demo"); static cv::Ptr facemark = cv::face::createFacemarkLBF(); //Face landmark detection #ifdef USE_TRACKER static cv::Ptr tracker = cv::TrackerKCF::create(); //Instead of continues face detection we can use a tracker @@ -192,7 +192,7 @@ void adjust_saturation(const cv::UMat &srcBGR, cv::UMat &dstBGR, float factor) { } //Setup the gui -void setup_gui(cv::Ptr v2d) { +void setup_gui(cv::Ptr v2d) { v2d->nanogui([&](cv::viz::FormHelper& form){ form.makeDialog(5, 30, "Effect"); diff --git a/modules/viz2d/samples/cpp/beauty/beauty.html b/modules/v4d/samples/cpp/beauty/beauty.html similarity index 99% rename from modules/viz2d/samples/cpp/beauty/beauty.html rename to modules/v4d/samples/cpp/beauty/beauty.html index f3840ec54..19996f057 100644 --- a/modules/viz2d/samples/cpp/beauty/beauty.html +++ b/modules/v4d/samples/cpp/beauty/beauty.html @@ -215,7 +215,7 @@ let ctx = cameraCanvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(videoElement, 0, 0, cameraCanvas.width, cameraCanvas.height); var imageData = ctx.getImageData(0, 0, cameraCanvas.width, cameraCanvas.height); - let filename = 'viz2d_rgba_canvas.raw'; + let filename = 'v4d_rgba_canvas.raw'; let stream = FS.open(filename, 'w+'); if(imageData) { FS.write(stream, imageData.data, 0, imageData.data.length, 0); diff --git a/modules/viz2d/samples/cpp/beauty/get.php b/modules/v4d/samples/cpp/beauty/get.php similarity index 100% rename from modules/viz2d/samples/cpp/beauty/get.php rename to modules/v4d/samples/cpp/beauty/get.php diff --git a/modules/viz2d/samples/cpp/beauty/index.php b/modules/v4d/samples/cpp/beauty/index.php similarity index 100% rename from modules/viz2d/samples/cpp/beauty/index.php rename to modules/v4d/samples/cpp/beauty/index.php diff --git a/modules/viz2d/samples/cpp/custom_source_and_sink.cpp b/modules/v4d/samples/cpp/custom_source_and_sink.cpp similarity index 92% rename from modules/viz2d/samples/cpp/custom_source_and_sink.cpp rename to modules/v4d/samples/cpp/custom_source_and_sink.cpp index 8ff0aa47f..56dc7b372 100644 --- a/modules/viz2d/samples/cpp/custom_source_and_sink.cpp +++ b/modules/v4d/samples/cpp/custom_source_and_sink.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include using namespace cv; @@ -10,7 +10,7 @@ constexpr int HEIGHT = 720; int main(int argc, char** argv) { string hr = "Hello Rainbow!"; - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Video Editing"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Video Editing"); //Make a Source that generates rainbow frames. Source src([=](cv::UMat& frame){ static long cnt = 0; diff --git a/modules/viz2d/samples/cpp/display_image.cpp b/modules/v4d/samples/cpp/display_image.cpp similarity index 66% rename from modules/viz2d/samples/cpp/display_image.cpp rename to modules/v4d/samples/cpp/display_image.cpp index da6ee3a6a..09c4e09e0 100644 --- a/modules/viz2d/samples/cpp/display_image.cpp +++ b/modules/v4d/samples/cpp/display_image.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace cv; using namespace cv::viz; @@ -7,15 +7,15 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main() { - //Creates a Viz2D object for on screen rendering - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Show image"); + //Creates a V4D object for on screen rendering + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Show image"); //An image Mat image = imread(samples::findFile("lena.jpg")); //Feeds the image to the video pipeline v2d->feed(image); //Display the framebuffer in the native window in an endless loop. - //Viz2D::run() though it takes a functor is not a context. It is simply an abstraction + //V4D::run() though it takes a functor is not a context. It is simply an abstraction //of a run loop for portability reasons and executes the functor until the application //terminates or the functor returns false. v2d->run(v2d->display); diff --git a/modules/viz2d/samples/cpp/display_image_fb.cpp b/modules/v4d/samples/cpp/display_image_fb.cpp similarity index 79% rename from modules/viz2d/samples/cpp/display_image_fb.cpp rename to modules/v4d/samples/cpp/display_image_fb.cpp index 0d576c477..f3bc5aff1 100644 --- a/modules/viz2d/samples/cpp/display_image_fb.cpp +++ b/modules/v4d/samples/cpp/display_image_fb.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace cv; using namespace cv::viz; @@ -7,8 +7,8 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main() { - //Creates a Viz2D object for on screen rendering - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Show image"); + //Creates a V4D object for on screen rendering + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Show image"); //Read an image as UMat UMat image = imread(samples::findFile("lena.jpg")).getUMat(ACCESS_READ); UMat resized; diff --git a/modules/viz2d/samples/cpp/font/Makefile b/modules/v4d/samples/cpp/font/Makefile similarity index 96% rename from modules/viz2d/samples/cpp/font/Makefile rename to modules/v4d/samples/cpp/font/Makefile index 790d3ffe0..aaa6ad490 100644 --- a/modules/viz2d/samples/cpp/font/Makefile +++ b/modules/v4d/samples/cpp/font/Makefile @@ -12,7 +12,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lopencv_viz2d +LIBS += -lm -lopencv_v4d .PHONY: all release debug clean distclean diff --git a/modules/viz2d/samples/cpp/font/font-demo.cpp b/modules/v4d/samples/cpp/font/font-demo.cpp similarity index 97% rename from modules/viz2d/samples/cpp/font/font-demo.cpp rename to modules/v4d/samples/cpp/font/font-demo.cpp index 395931832..38f93443f 100644 --- a/modules/viz2d/samples/cpp/font/font-demo.cpp +++ b/modules/v4d/samples/cpp/font/font-demo.cpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" #include #include @@ -45,12 +45,12 @@ using std::string; using std::vector; using std::istringstream; -cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Font Demo"); +cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Font Demo"); vector lines; bool update_stars = true; bool update_perspective = true; -void setup_gui(cv::Ptr v2d) { +void setup_gui(cv::Ptr v2d) { v2d->nanogui([&](cv::viz::FormHelper& form){ form.makeDialog(5, 30, "Effect"); form.makeGroup("Text Crawl"); diff --git a/modules/viz2d/samples/cpp/font/font.html b/modules/v4d/samples/cpp/font/font.html similarity index 100% rename from modules/viz2d/samples/cpp/font/font.html rename to modules/v4d/samples/cpp/font/font.html diff --git a/modules/viz2d/samples/cpp/font/get.php b/modules/v4d/samples/cpp/font/get.php similarity index 100% rename from modules/viz2d/samples/cpp/font/get.php rename to modules/v4d/samples/cpp/font/get.php diff --git a/modules/viz2d/samples/cpp/font/index.php b/modules/v4d/samples/cpp/font/index.php similarity index 100% rename from modules/viz2d/samples/cpp/font/index.php rename to modules/v4d/samples/cpp/font/index.php diff --git a/modules/viz2d/samples/cpp/font_rendering.cpp b/modules/v4d/samples/cpp/font_rendering.cpp similarity index 82% rename from modules/viz2d/samples/cpp/font_rendering.cpp rename to modules/v4d/samples/cpp/font_rendering.cpp index 81125c36a..15214da0f 100644 --- a/modules/viz2d/samples/cpp/font_rendering.cpp +++ b/modules/v4d/samples/cpp/font_rendering.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include using namespace cv; using namespace cv::viz; @@ -8,7 +8,7 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main(int argc, char** argv) { - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Font Rendering"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Font Rendering"); //The text to render string hw = "Hello World"; diff --git a/modules/viz2d/samples/cpp/font_with_gui.cpp b/modules/v4d/samples/cpp/font_with_gui.cpp similarity index 89% rename from modules/viz2d/samples/cpp/font_with_gui.cpp rename to modules/v4d/samples/cpp/font_with_gui.cpp index dcaa87fb3..8bbebdf55 100644 --- a/modules/viz2d/samples/cpp/font_with_gui.cpp +++ b/modules/v4d/samples/cpp/font_with_gui.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include using namespace cv; using namespace cv::viz; @@ -8,7 +8,7 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main(int argc, char** argv) { - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Font Rendering with GUI"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Font Rendering with GUI"); //The text color. NanoGUI uses rgba with floating point nanogui::Color textColor = {0.0f, 0.0f, 1.0f, 1.0f}; //The font size diff --git a/modules/viz2d/samples/cpp/nanovg/Makefile b/modules/v4d/samples/cpp/nanovg/Makefile similarity index 96% rename from modules/viz2d/samples/cpp/nanovg/Makefile rename to modules/v4d/samples/cpp/nanovg/Makefile index db6711f89..add8507e8 100644 --- a/modules/viz2d/samples/cpp/nanovg/Makefile +++ b/modules/v4d/samples/cpp/nanovg/Makefile @@ -9,7 +9,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lopencv_viz2d +LIBS += -lm -lopencv_v4d .PHONY: all release debug clean distclean all: release diff --git a/modules/viz2d/samples/cpp/nanovg/nanovg-demo.cpp b/modules/v4d/samples/cpp/nanovg/nanovg-demo.cpp similarity index 96% rename from modules/viz2d/samples/cpp/nanovg/nanovg-demo.cpp rename to modules/v4d/samples/cpp/nanovg/nanovg-demo.cpp index 3d9543cc8..70cf80017 100644 --- a/modules/viz2d/samples/cpp/nanovg/nanovg-demo.cpp +++ b/modules/v4d/samples/cpp/nanovg/nanovg-demo.cpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" constexpr unsigned int WIDTH = 1920; constexpr unsigned int HEIGHT = 1080; @@ -14,7 +14,7 @@ constexpr const char *OUTPUT_FILENAME = "nanovg-demo.mkv"; using std::cerr; using std::endl; -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "NanoVG Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "NanoVG Demo"); void draw_color_wheel(float x, float y, float w, float h, float hue) { //color wheel drawing code taken from https://github.com/memononen/nanovg/blob/master/example/demo.c diff --git a/modules/viz2d/samples/cpp/optflow/Makefile b/modules/v4d/samples/cpp/optflow/Makefile similarity index 97% rename from modules/viz2d/samples/cpp/optflow/Makefile rename to modules/v4d/samples/cpp/optflow/Makefile index dfb784b32..5c0a9bdf0 100644 --- a/modules/viz2d/samples/cpp/optflow/Makefile +++ b/modules/v4d/samples/cpp/optflow/Makefile @@ -12,7 +12,7 @@ OBJS := ${SRCS:.cpp=.o} DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic -LIBS += -lm -lopencv_optflow -lopencv_video -lopencv_features2d -lopencv_viz2d -lz +LIBS += -lm -lopencv_optflow -lopencv_video -lopencv_features2d -lopencv_v4d -lz ifndef EMSDK LIBS += -lOpenCL endif diff --git a/modules/viz2d/samples/cpp/optflow/get.php b/modules/v4d/samples/cpp/optflow/get.php similarity index 100% rename from modules/viz2d/samples/cpp/optflow/get.php rename to modules/v4d/samples/cpp/optflow/get.php diff --git a/modules/viz2d/samples/cpp/optflow/index.php b/modules/v4d/samples/cpp/optflow/index.php similarity index 100% rename from modules/viz2d/samples/cpp/optflow/index.php rename to modules/v4d/samples/cpp/optflow/index.php diff --git a/modules/viz2d/samples/cpp/optflow/local.html b/modules/v4d/samples/cpp/optflow/local.html similarity index 99% rename from modules/viz2d/samples/cpp/optflow/local.html rename to modules/v4d/samples/cpp/optflow/local.html index 56257f2c6..a5df548c1 100644 --- a/modules/viz2d/samples/cpp/optflow/local.html +++ b/modules/v4d/samples/cpp/optflow/local.html @@ -214,7 +214,7 @@ let ctx = cameraCanvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(videoElement, 0, 0, cameraCanvas.width, cameraCanvas.height); var imageData = ctx.getImageData(0, 0, cameraCanvas.width, cameraCanvas.height); - let filename = 'viz2d_rgba_canvas.raw'; + let filename = 'v4d_rgba_canvas.raw'; let stream = FS.open(filename, 'w+'); if(imageData) { FS.write(stream, imageData.data, 0, imageData.data.length, 0); diff --git a/modules/viz2d/samples/cpp/optflow/optflow-demo.cpp b/modules/v4d/samples/cpp/optflow/optflow-demo.cpp similarity index 97% rename from modules/viz2d/samples/cpp/optflow/optflow-demo.cpp rename to modules/v4d/samples/cpp/optflow/optflow-demo.cpp index b7e1f7879..722a2e58b 100644 --- a/modules/viz2d/samples/cpp/optflow/optflow-demo.cpp +++ b/modules/v4d/samples/cpp/optflow/optflow-demo.cpp @@ -3,8 +3,8 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" #include #include @@ -46,9 +46,9 @@ const unsigned long DIAG = hypot(double(WIDTH), double(HEIGHT)); constexpr const char* OUTPUT_FILENAME = "optflow-demo.mkv"; constexpr bool OFFSCREEN = false; -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Sparse Optical Flow Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Sparse Optical Flow Demo"); #ifndef __EMSCRIPTEN__ -static cv::Ptr v2dMenu = cv::viz::Viz2D::make(cv::Size(240, 360), cv::Size(240,360), false, "Display Settings"); +static cv::Ptr v2dMenu = cv::viz::V4D::make(cv::Size(240, 360), cv::Size(240,360), false, "Display Settings"); #endif /** Visualization parameters **/ @@ -305,7 +305,7 @@ void composite_layers(cv::UMat& background, const cv::UMat& foreground, const cv cv::add(background, post, dst); } -void setup_gui(cv::Ptr v2d, cv::Ptr v2dMenu) { +void setup_gui(cv::Ptr v2d, cv::Ptr v2dMenu) { v2d->nanogui([&](cv::viz::FormHelper& form){ form.makeDialog(5, 30, "Effects"); diff --git a/modules/viz2d/samples/cpp/optflow/optflow.html b/modules/v4d/samples/cpp/optflow/optflow.html similarity index 99% rename from modules/viz2d/samples/cpp/optflow/optflow.html rename to modules/v4d/samples/cpp/optflow/optflow.html index c8374c346..0007ea555 100644 --- a/modules/viz2d/samples/cpp/optflow/optflow.html +++ b/modules/v4d/samples/cpp/optflow/optflow.html @@ -215,7 +215,7 @@ let ctx = cameraCanvas.getContext('2d', { willReadFrequently: true }); ctx.drawImage(videoElement, 0, 0, cameraCanvas.width, cameraCanvas.height); var imageData = ctx.getImageData(0, 0, cameraCanvas.width, cameraCanvas.height); - let filename = 'viz2d_rgba_canvas.raw'; + let filename = 'v4d_rgba_canvas.raw'; let stream = FS.open(filename, 'w+'); if(imageData) { FS.write(stream, imageData.data, 0, imageData.data.length, 0); diff --git a/modules/viz2d/samples/cpp/pedestrian/Makefile b/modules/v4d/samples/cpp/pedestrian/Makefile similarity index 95% rename from modules/viz2d/samples/cpp/pedestrian/Makefile rename to modules/v4d/samples/cpp/pedestrian/Makefile index 3dc608885..324f8a75e 100644 --- a/modules/viz2d/samples/cpp/pedestrian/Makefile +++ b/modules/v4d/samples/cpp/pedestrian/Makefile @@ -9,7 +9,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lOpenCL -lopencv_viz2d +LIBS += -lm -lOpenCL -lopencv_v4d .PHONY: all release debug clean distclean all: release diff --git a/modules/viz2d/samples/cpp/pedestrian/pedestrian-demo.cpp b/modules/v4d/samples/cpp/pedestrian/pedestrian-demo.cpp similarity index 97% rename from modules/viz2d/samples/cpp/pedestrian/pedestrian-demo.cpp rename to modules/v4d/samples/cpp/pedestrian/pedestrian-demo.cpp index 358cc9bd3..26713a087 100644 --- a/modules/viz2d/samples/cpp/pedestrian/pedestrian-demo.cpp +++ b/modules/v4d/samples/cpp/pedestrian/pedestrian-demo.cpp @@ -3,9 +3,9 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" -#include "opencv2/viz2d/util.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" +#include "opencv2/v4d/util.hpp" #include @@ -30,7 +30,7 @@ using std::endl; using std::vector; using std::string; -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Beauty Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Beauty Demo"); static cv::HOGDescriptor hog; //adapted from cv::dnn_objdetect::InferBbox diff --git a/modules/viz2d/samples/cpp/render_opengl.cpp b/modules/v4d/samples/cpp/render_opengl.cpp similarity index 92% rename from modules/viz2d/samples/cpp/render_opengl.cpp rename to modules/v4d/samples/cpp/render_opengl.cpp index 26e9e36eb..d739028ea 100644 --- a/modules/viz2d/samples/cpp/render_opengl.cpp +++ b/modules/v4d/samples/cpp/render_opengl.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace cv; using namespace cv::viz; @@ -7,7 +7,7 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main(int argc, char** argv) { - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "GL Tetrahedron"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "GL Tetrahedron"); v2d->gl([](const Size sz) { //Initialize the OpenGL scene diff --git a/modules/viz2d/samples/cpp/shader/Makefile b/modules/v4d/samples/cpp/shader/Makefile similarity index 96% rename from modules/viz2d/samples/cpp/shader/Makefile rename to modules/v4d/samples/cpp/shader/Makefile index 010e13550..8f3154a43 100644 --- a/modules/viz2d/samples/cpp/shader/Makefile +++ b/modules/v4d/samples/cpp/shader/Makefile @@ -12,7 +12,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lopencv_viz2d +LIBS += -lm -lopencv_v4d .PHONY: all release debug clean distclean all: release diff --git a/modules/viz2d/samples/cpp/shader/get.php b/modules/v4d/samples/cpp/shader/get.php similarity index 100% rename from modules/viz2d/samples/cpp/shader/get.php rename to modules/v4d/samples/cpp/shader/get.php diff --git a/modules/viz2d/samples/cpp/shader/index.php b/modules/v4d/samples/cpp/shader/index.php similarity index 100% rename from modules/viz2d/samples/cpp/shader/index.php rename to modules/v4d/samples/cpp/shader/index.php diff --git a/modules/viz2d/samples/cpp/shader/shader-demo.cpp b/modules/v4d/samples/cpp/shader/shader-demo.cpp similarity index 97% rename from modules/viz2d/samples/cpp/shader/shader-demo.cpp rename to modules/v4d/samples/cpp/shader/shader-demo.cpp index 01635b758..564025615 100644 --- a/modules/viz2d/samples/cpp/shader/shader-demo.cpp +++ b/modules/v4d/samples/cpp/shader/shader-demo.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/v4d.hpp" using std::cerr; using std::endl; @@ -44,7 +44,7 @@ GLint zoom_hdl; /** shader and program handle **/ GLuint shader_program_hdl; -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 //vertex array GLuint VAO; #endif @@ -71,7 +71,7 @@ unsigned int indices[] = void load_buffer_data(){ -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 glGenVertexArrays(1, &VAO); glBindVertexArray(VAO); #endif @@ -89,7 +89,7 @@ void load_buffer_data(){ glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 glBindVertexArray(0); #endif } @@ -141,7 +141,7 @@ GLuint init_shader(const char* vShader, const char* fShader, const char* outputA glAttachShader( program, shader ); } -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 /* Link output */ glBindFragDataLocation(program, 0, outputAttributeName); #endif @@ -170,7 +170,7 @@ GLuint init_shader(const char* vShader, const char* fShader, const char* outputA //mandelbrot shader code adapted from my own project: https://github.com/kallaballa/FractalDive#after void load_shader(){ -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 const string shaderVersion = "330"; #else const string shaderVersion = "300 es"; @@ -293,7 +293,7 @@ void render_scene(const cv::Size& sz) { glUniform1f(zoom_hdl, zoom); } -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 glBindVertexArray(VAO); #endif glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); @@ -321,9 +321,9 @@ void glow_effect(const cv::UMat &src, cv::UMat &dst, const int ksize) { cv::bitwise_not(dst, dst); } -cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Shader Demo"); +cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Shader Demo"); -void setup_gui(cv::Ptr v2d) { +void setup_gui(cv::Ptr v2d) { v2d->nanogui([](cv::viz::FormHelper& form){ form.makeDialog(5, 30, "Fractal"); diff --git a/modules/viz2d/samples/cpp/shader/shader.html b/modules/v4d/samples/cpp/shader/shader.html similarity index 100% rename from modules/viz2d/samples/cpp/shader/shader.html rename to modules/v4d/samples/cpp/shader/shader.html diff --git a/modules/viz2d/samples/cpp/tetra/Makefile b/modules/v4d/samples/cpp/tetra/Makefile similarity index 96% rename from modules/viz2d/samples/cpp/tetra/Makefile rename to modules/v4d/samples/cpp/tetra/Makefile index 9ecd781db..d03b20c25 100644 --- a/modules/viz2d/samples/cpp/tetra/Makefile +++ b/modules/v4d/samples/cpp/tetra/Makefile @@ -9,7 +9,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lopencv_viz2d -lEGL +LIBS += -lm -lopencv_v4d -lEGL .PHONY: all release debug clean distclean all: release diff --git a/modules/viz2d/samples/cpp/tetra/tetra-demo.cpp b/modules/v4d/samples/cpp/tetra/tetra-demo.cpp similarity index 94% rename from modules/viz2d/samples/cpp/tetra/tetra-demo.cpp rename to modules/v4d/samples/cpp/tetra/tetra-demo.cpp index 6e4361b75..e1dc2b5c1 100644 --- a/modules/viz2d/samples/cpp/tetra/tetra-demo.cpp +++ b/modules/v4d/samples/cpp/tetra/tetra-demo.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include +#include constexpr long unsigned int WIDTH = 1920; constexpr long unsigned int HEIGHT = 1080; @@ -17,10 +17,10 @@ constexpr int GLOW_KERNEL_SIZE = std::max(int(DIAG / 138 % 2 == 0 ? DIAG / 138 + using std::cerr; using std::endl; -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Tetra Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Tetra Demo"); void init_scene(const cv::Size& sz) { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 //Initialize the OpenGL scene glViewport(0, 0, sz.width, sz.height); glColor3f(1.0, 1.0, 1.0); @@ -41,7 +41,7 @@ void init_scene(const cv::Size& sz) { } void render_scene(const cv::Size& sz) { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 //Render a tetrahedron using immediate mode because the code is more concise for a demo glViewport(0, 0, sz.width, sz.height); glRotatef(1, 0, 1, 0); diff --git a/modules/viz2d/samples/cpp/vector_graphics.cpp b/modules/v4d/samples/cpp/vector_graphics.cpp similarity index 83% rename from modules/viz2d/samples/cpp/vector_graphics.cpp rename to modules/v4d/samples/cpp/vector_graphics.cpp index 668c5ac46..dceb21d06 100644 --- a/modules/viz2d/samples/cpp/vector_graphics.cpp +++ b/modules/v4d/samples/cpp/vector_graphics.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include using namespace cv; using namespace cv::viz; @@ -8,7 +8,7 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main(int argc, char** argv) { - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Vector Graphics"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Vector Graphics"); //Creates a NanoVG context and draws a cross-hair on the framebuffer v2d->nvg([](const Size& sz) { //Calls from this namespace may only be used inside a nvg context diff --git a/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp b/modules/v4d/samples/cpp/vector_graphics_and_fb.cpp similarity index 85% rename from modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp rename to modules/v4d/samples/cpp/vector_graphics_and_fb.cpp index e1a3b15e2..883d431c6 100644 --- a/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp +++ b/modules/v4d/samples/cpp/vector_graphics_and_fb.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include using namespace cv; using namespace cv::viz; @@ -8,7 +8,7 @@ constexpr int WIDTH = 1280; constexpr int HEIGHT = 720; int main(int argc, char** argv) { - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Vector Graphics and Framebuffer"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Vector Graphics and Framebuffer"); //Creates a NanoVG context and draws a cross-hair on the framebuffer v2d->nvg([](const Size& sz) { //Calls from this namespace may only be used inside a nvg context diff --git a/modules/viz2d/samples/cpp/video/Makefile b/modules/v4d/samples/cpp/video/Makefile similarity index 94% rename from modules/viz2d/samples/cpp/video/Makefile rename to modules/v4d/samples/cpp/video/Makefile index b865ce6b1..03c858f85 100644 --- a/modules/viz2d/samples/cpp/video/Makefile +++ b/modules/v4d/samples/cpp/video/Makefile @@ -9,7 +9,7 @@ DEPS := ${SRCS:.cpp=.dep} CXXFLAGS += -fpic LDFLAGS += -LIBS += -lm -lopencv_viz2d -lopencv_viz2d +LIBS += -lm -lopencv_v4d -lopencv_v4d .PHONY: all release debug clean distclean all: release diff --git a/modules/viz2d/samples/cpp/video/video-demo.cpp b/modules/v4d/samples/cpp/video/video-demo.cpp similarity index 94% rename from modules/viz2d/samples/cpp/video/video-demo.cpp rename to modules/v4d/samples/cpp/video/video-demo.cpp index 1c24ff5bd..a37a8be1a 100644 --- a/modules/viz2d/samples/cpp/video/video-demo.cpp +++ b/modules/v4d/samples/cpp/video/video-demo.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/v4d.hpp" #include @@ -18,10 +18,10 @@ using std::cerr; using std::endl; using std::string; -static cv::Ptr v2d = cv::viz::Viz2D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Video Demo"); +static cv::Ptr v2d = cv::viz::V4D::make(cv::Size(WIDTH, HEIGHT), cv::Size(WIDTH, HEIGHT), OFFSCREEN, "Video Demo"); void init_scene(const cv::Size& sz) { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 //Initialize the OpenGL scene glViewport(0, 0, sz.width, sz.height); glColor3f(1.0, 1.0, 1.0); @@ -42,7 +42,7 @@ void init_scene(const cv::Size& sz) { } void render_scene(const cv::Size& sz) { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 //Render a tetrahedron using immediate mode because the code is more concise for a demo glViewport(0, 0, sz.width, sz.height); glRotatef(1, 0, 1, 0); diff --git a/modules/viz2d/samples/cpp/video_editing.cpp b/modules/v4d/samples/cpp/video_editing.cpp similarity index 87% rename from modules/viz2d/samples/cpp/video_editing.cpp rename to modules/v4d/samples/cpp/video_editing.cpp index 9a9ed02b2..e2b987de4 100644 --- a/modules/viz2d/samples/cpp/video_editing.cpp +++ b/modules/v4d/samples/cpp/video_editing.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include using namespace cv; using namespace cv::viz; @@ -9,7 +9,7 @@ constexpr int HEIGHT = 720; int main(int argc, char** argv) { string hv = "Hello Video!"; - Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Video Editing"); + Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "Video Editing"); //Make the video source Source src = makeCaptureSource(argv[1]); //Make the video sink diff --git a/modules/viz2d/src/detail/clvacontext.cpp b/modules/v4d/src/detail/clvacontext.cpp similarity index 98% rename from modules/viz2d/src/detail/clvacontext.cpp rename to modules/v4d/src/detail/clvacontext.cpp index 4485f1174..abd9fea16 100644 --- a/modules/viz2d/src/detail/clvacontext.cpp +++ b/modules/v4d/src/detail/clvacontext.cpp @@ -5,7 +5,7 @@ #include "clvacontext.hpp" -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/v4d.hpp" namespace cv { namespace viz { diff --git a/modules/viz2d/src/detail/clvacontext.hpp b/modules/v4d/src/detail/clvacontext.hpp similarity index 97% rename from modules/viz2d/src/detail/clvacontext.hpp rename to modules/v4d/src/detail/clvacontext.hpp index 77992781c..84e373f54 100644 --- a/modules/viz2d/src/detail/clvacontext.hpp +++ b/modules/v4d/src/detail/clvacontext.hpp @@ -10,14 +10,14 @@ namespace cv { namespace viz { -class Viz2D; +class V4D; namespace detail { /*! * Provides a context for OpenCL-VAAPI sharing */ class CLVAContext { - friend class cv::viz::Viz2D; + friend class cv::viz::V4D; CLExecContext_t context_; FrameBufferContext& clglContext_; cv::UMat videoFrame_; diff --git a/modules/viz2d/src/detail/framebuffercontext.cpp b/modules/v4d/src/detail/framebuffercontext.cpp similarity index 98% rename from modules/viz2d/src/detail/framebuffercontext.cpp rename to modules/v4d/src/detail/framebuffercontext.cpp index d87b114be..8e0948797 100644 --- a/modules/viz2d/src/detail/framebuffercontext.cpp +++ b/modules/v4d/src/detail/framebuffercontext.cpp @@ -5,10 +5,10 @@ #include "framebuffercontext.hpp" -#include "opencv2/viz2d/util.hpp" -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/util.hpp" +#include "opencv2/v4d/v4d.hpp" -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 #include #endif @@ -19,7 +19,7 @@ namespace detail { //FIXME use cv::ogl FrameBufferContext::FrameBufferContext(const cv::Size& frameBufferSize) : frameBufferSize_(frameBufferSize) { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 glewExperimental = true; glewInit(); try { diff --git a/modules/viz2d/src/detail/framebuffercontext.hpp b/modules/v4d/src/detail/framebuffercontext.hpp similarity index 97% rename from modules/viz2d/src/detail/framebuffercontext.hpp rename to modules/v4d/src/detail/framebuffercontext.hpp index 67049a68f..fd967dbda 100644 --- a/modules/viz2d/src/detail/framebuffercontext.hpp +++ b/modules/v4d/src/detail/framebuffercontext.hpp @@ -10,9 +10,9 @@ #include #include #else -#define VIZ2D_USE_ES3 1 +#define V4D_USE_ES3 1 #endif -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 # include # define GLFW_INCLUDE_GLCOREARB #else @@ -24,11 +24,11 @@ #include #include -#include "opencv2/viz2d/util.hpp" +#include "opencv2/v4d/util.hpp" namespace cv { namespace viz { -class Viz2D; +class V4D; namespace detail { typedef cv::ocl::OpenCLExecutionContext CLExecContext_t; typedef cv::ocl::OpenCLExecutionContextScope CLExecScope_t; @@ -39,7 +39,7 @@ typedef cv::ocl::OpenCLExecutionContextScope CLExecScope_t; class FrameBufferContext { friend class CLVAContext; friend class NanoVGContext; - friend class cv::viz::Viz2D; + friend class cv::viz::V4D; bool clglSharing_ = true; GLuint frameBufferID_ = 0; GLuint textureID_ = 0; diff --git a/modules/viz2d/src/detail/nanovgcontext.cpp b/modules/v4d/src/detail/nanovgcontext.cpp similarity index 92% rename from modules/viz2d/src/detail/nanovgcontext.cpp rename to modules/v4d/src/detail/nanovgcontext.cpp index 07b553607..4eedc9350 100644 --- a/modules/viz2d/src/detail/nanovgcontext.cpp +++ b/modules/v4d/src/detail/nanovgcontext.cpp @@ -5,12 +5,12 @@ #include "nanovgcontext.hpp" -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/v4d.hpp" namespace cv { namespace viz { namespace detail { -NanoVGContext::NanoVGContext(Viz2D& v2d, NVGcontext* context, FrameBufferContext& fbContext) : +NanoVGContext::NanoVGContext(V4D& v2d, NVGcontext* context, FrameBufferContext& fbContext) : v2d_(v2d), context_(context), clglContext_(fbContext) { //FIXME workaround for first frame color glitch cv::UMat tmp; @@ -27,7 +27,7 @@ void NanoVGContext::render(std::function fn) { } void push() { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 GL_CHECK(glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS)); GL_CHECK(glPushAttrib(GL_ALL_ATTRIB_BITS)); GL_CHECK(glMatrixMode(GL_MODELVIEW)); @@ -40,7 +40,7 @@ void push() { } void pop() { -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 GL_CHECK(glMatrixMode(GL_TEXTURE)); GL_CHECK(glPopMatrix()); GL_CHECK(glMatrixMode(GL_PROJECTION)); diff --git a/modules/viz2d/src/detail/nanovgcontext.hpp b/modules/v4d/src/detail/nanovgcontext.hpp similarity index 87% rename from modules/viz2d/src/detail/nanovgcontext.hpp rename to modules/v4d/src/detail/nanovgcontext.hpp index e14a5ebfa..2f85a9f7c 100644 --- a/modules/viz2d/src/detail/nanovgcontext.hpp +++ b/modules/v4d/src/detail/nanovgcontext.hpp @@ -6,10 +6,10 @@ #ifndef SRC_COMMON_NANOVGCONTEXT_HPP_ #define SRC_COMMON_NANOVGCONTEXT_HPP_ #ifdef __EMSCRIPTEN__ -#define VIZ2D_USE_ES3 1 +#define V4D_USE_ES3 1 #endif -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 #define NANOGUI_USE_OPENGL #else #define NANOGUI_USE_GLES @@ -18,8 +18,8 @@ #include "framebuffercontext.hpp" #include #include -#include "opencv2/viz2d/util.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/util.hpp" +#include "opencv2/v4d/nvg.hpp" namespace cv { namespace viz { @@ -28,7 +28,7 @@ namespace detail { * Used to setup a nanovg context */ class NanoVGContext { - Viz2D& v2d_; + V4D& v2d_; NVGcontext* context_; FrameBufferContext& clglContext_; public: @@ -55,11 +55,11 @@ public: }; /*! * Creates a NanoVGContext - * @param v2d The Viz2D object used in conjunction with this context + * @param v2d The V4D object used in conjunction with this context * @param context The native NVGContext * @param fbContext The framebuffer context */ - NanoVGContext(Viz2D& v2d, NVGcontext* context, FrameBufferContext& fbContext); + NanoVGContext(V4D& v2d, NVGcontext* context, FrameBufferContext& fbContext); /*! * Execute function object fn inside a nanovg context. * The context takes care of setting up opengl and nanovg states. diff --git a/modules/viz2d/src/dialog.cpp b/modules/v4d/src/dialog.cpp similarity index 93% rename from modules/viz2d/src/dialog.cpp rename to modules/v4d/src/dialog.cpp index ca5927a0a..f9047b993 100644 --- a/modules/viz2d/src/dialog.cpp +++ b/modules/v4d/src/dialog.cpp @@ -3,12 +3,12 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/dialog.hpp" +#include "opencv2/v4d/dialog.hpp" #include #ifdef __EMSCRIPTEN__ -#define VIZ2D_USE_ES3 1 +#define V4D_USE_ES3 1 #endif -#ifndef VIZ2D_USE_ES3 +#ifndef V4D_USE_ES3 # include # define GLFW_INCLUDE_GLCOREARB #else @@ -20,11 +20,11 @@ namespace cv { namespace viz { -std::function Dialog::viz2DWin_Xcomparator([](Dialog* lhs, Dialog* rhs) { +std::function Dialog::v4dWin_Xcomparator([](Dialog* lhs, Dialog* rhs) { return lhs->position()[0] < rhs->position()[0]; }); -std::set Dialog::all_windows_xsorted_( - viz2DWin_Xcomparator); +std::set Dialog::all_windows_xsorted_( + v4dWin_Xcomparator); Dialog::Dialog(nanogui::Screen* screen, int x, int y, const string& title) : Window(screen, title), screen_(screen), lastDragPos_(x, y) { diff --git a/modules/viz2d/src/formhelper.cpp b/modules/v4d/src/formhelper.cpp similarity index 97% rename from modules/viz2d/src/formhelper.cpp rename to modules/v4d/src/formhelper.cpp index b01bde9cd..39e3f4545 100644 --- a/modules/viz2d/src/formhelper.cpp +++ b/modules/v4d/src/formhelper.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/formhelper.hpp" +#include "opencv2/v4d/formhelper.hpp" namespace cv { namespace viz { diff --git a/modules/viz2d/src/nvg.cpp b/modules/v4d/src/nvg.cpp similarity index 99% rename from modules/viz2d/src/nvg.cpp rename to modules/v4d/src/nvg.cpp index 244e757f5..ca7d9a033 100644 --- a/modules/viz2d/src/nvg.cpp +++ b/modules/v4d/src/nvg.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/nvg.hpp" namespace cv { namespace viz { diff --git a/modules/viz2d/src/sink.cpp b/modules/v4d/src/sink.cpp similarity index 91% rename from modules/viz2d/src/sink.cpp rename to modules/v4d/src/sink.cpp index 364a84ef4..4c809b753 100644 --- a/modules/viz2d/src/sink.cpp +++ b/modules/v4d/src/sink.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/sink.hpp" +#include "opencv2/v4d/sink.hpp" namespace cv { namespace viz { @@ -32,5 +32,5 @@ bool Sink::isOpen() { void Sink::operator()(const cv::UMat& frame) { open_ = consumer_(frame); } -} /* namespace viz2d */ +} /* namespace v4d */ } /* namespace kb */ diff --git a/modules/viz2d/src/source.cpp b/modules/v4d/src/source.cpp similarity index 93% rename from modules/viz2d/src/source.cpp rename to modules/v4d/src/source.cpp index 11178d292..ff0b2b682 100644 --- a/modules/viz2d/src/source.cpp +++ b/modules/v4d/src/source.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/source.hpp" +#include "opencv2/v4d/source.hpp" namespace cv { namespace viz { @@ -38,5 +38,5 @@ std::pair Source::operator()() { open_ = generator_(frame_); return {count_++, frame_}; } -} /* namespace viz2d */ +} /* namespace v4d */ } /* namespace kb */ diff --git a/modules/viz2d/src/util.cpp b/modules/v4d/src/util.cpp similarity index 96% rename from modules/viz2d/src/util.cpp rename to modules/v4d/src/util.cpp index 3a573adbc..82ca6a720 100644 --- a/modules/viz2d/src/util.cpp +++ b/modules/v4d/src/util.cpp @@ -3,10 +3,10 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/util.hpp" +#include "opencv2/v4d/util.hpp" -#include "opencv2/viz2d/viz2d.hpp" -#include "opencv2/viz2d/nvg.hpp" +#include "opencv2/v4d/v4d.hpp" +#include "opencv2/v4d/nvg.hpp" #ifdef __EMSCRIPTEN__ # include @@ -134,10 +134,10 @@ bool keepRunning() { /*! * Little helper function to keep track of FPS and optionally display it using NanoVG - * @param v2d The Viz2D object to operate on + * @param v2d The V4D object to operate on * @param graphical if this parameter is true the FPS drawn on display */ -void updateFps(cv::Ptr v2d, bool graphical) { +void updateFps(cv::Ptr v2d, bool graphical) { static uint64_t cnt = 0; static cv::TickMeter tick; static float fps; @@ -258,7 +258,7 @@ Source makeCaptureSource(int width, int height) { cv::UMat frame = array.getUMat(); if (frame.empty()) frame.create(cv::Size(width, height), CV_8UC3); - std::ifstream fs("viz2d_rgba_canvas.raw", std::fstream::in | std::fstream::binary); + std::ifstream fs("v4d_rgba_canvas.raw", std::fstream::in | std::fstream::binary); fs.seekg(0, std::ios::end); auto length = fs.tellg(); fs.seekg(0, std::ios::beg); diff --git a/modules/viz2d/src/viz2d.cpp b/modules/v4d/src/v4d.cpp similarity index 83% rename from modules/viz2d/src/viz2d.cpp rename to modules/v4d/src/v4d.cpp index bb7c5b884..c3f869f4f 100644 --- a/modules/viz2d/src/viz2d.cpp +++ b/modules/v4d/src/v4d.cpp @@ -3,7 +3,7 @@ // of this distribution and at http://opencv.org/license.html. // Copyright Amir Hassan (kallaballa) -#include "opencv2/viz2d/viz2d.hpp" +#include "opencv2/v4d/v4d.hpp" #include "detail/clvacontext.hpp" #include "detail/framebuffercontext.hpp" #include "detail/nanovgcontext.hpp" @@ -65,18 +65,18 @@ void resizeKeepAspectRatio(const cv::UMat& src, cv::UMat& output, const cv::Size cv::copyMakeBorder(output, output, top, down, left, right, cv::BORDER_CONSTANT, bgcolor); } -cv::Ptr Viz2D::make(const cv::Size& size, const string& title, bool debug) { - cv::Ptr v2d = new Viz2D(size, size, false, title, 4, 6, true, 0, debug); +cv::Ptr V4D::make(const cv::Size& size, const string& title, bool debug) { + cv::Ptr v2d = new V4D(size, size, false, title, 4, 6, true, 0, debug); v2d->setVisible(true); return v2d; } -cv::Ptr Viz2D::make(const cv::Size& initialSize, const cv::Size& frameBufferSize, +cv::Ptr V4D::make(const cv::Size& initialSize, const cv::Size& frameBufferSize, bool offscreen, const string& title, int major, int minor, bool compat, int samples, bool debug) { - return new Viz2D(initialSize, frameBufferSize, offscreen, title, major, minor, compat, samples, debug); + return new V4D(initialSize, frameBufferSize, offscreen, title, major, minor, compat, samples, debug); } -Viz2D::Viz2D(const cv::Size& size, const cv::Size& frameBufferSize, bool offscreen, +V4D::V4D(const cv::Size& size, const cv::Size& frameBufferSize, bool offscreen, const string& title, int major, int minor, bool compat, int samples, bool debug) : initialSize_(size), frameBufferSize_(frameBufferSize), viewport_(0, 0, frameBufferSize.width, frameBufferSize.height), scale_(1), mousePos_(0, 0), offscreen_( @@ -89,7 +89,7 @@ Viz2D::Viz2D(const cv::Size& size, const cv::Size& frameBufferSize, bool offscre initializeWindowing(); } -Viz2D::~Viz2D() { +V4D::~V4D() { //don't delete form_. it is autmatically cleaned up by the base class (nanogui::Screen) if (screen_) delete screen_; @@ -105,7 +105,7 @@ Viz2D::~Viz2D() { delete clglContext_; } -bool Viz2D::initializeWindowing() { +bool V4D::initializeWindowing() { if (glfwInit() != GLFW_TRUE) return false; @@ -124,7 +124,7 @@ bool Viz2D::initializeWindowing() { glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); -#elif defined(VIZ2D_USE_ES3) +#elif defined(V4D_USE_ES3) glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); @@ -172,7 +172,7 @@ bool Viz2D::initializeWindowing() { glfwSetWindowUserPointer(getGLFWWindow(), this); glfwSetCursorPosCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, double x, double y) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().cursor_pos_callback_event(x, y); auto cursor = v2d->getMousePosition(); auto diff = cursor - cv::Vec2f(x, y); @@ -184,7 +184,7 @@ bool Viz2D::initializeWindowing() { ); glfwSetMouseButtonCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, int button, int action, int modifiers) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().mouse_button_callback_event(button, action, modifiers); if (button == GLFW_MOUSE_BUTTON_RIGHT) { v2d->setMouseDrag(action == GLFW_PRESS); @@ -193,23 +193,23 @@ bool Viz2D::initializeWindowing() { ); glfwSetKeyCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, int key, int scancode, int action, int mods) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().key_callback_event(key, scancode, action, mods); } ); glfwSetCharCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, unsigned int codepoint) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().char_callback_event(codepoint); } ); glfwSetDropCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, int count, const char** filenames) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().drop_callback_event(count, filenames); } ); glfwSetScrollCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, double x, double y) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); std::vector widgets; find_widgets(&v2d->screen(), widgets); for (auto* w : widgets) { @@ -231,7 +231,7 @@ bool Viz2D::initializeWindowing() { // ); glfwSetFramebufferSizeCallback(getGLFWWindow(), [](GLFWwindow* glfwWin, int width, int height) { - Viz2D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); + V4D* v2d = reinterpret_cast(glfwGetWindowUserPointer(glfwWin)); v2d->screen().resize_callback_event(width, height); }); @@ -241,54 +241,54 @@ bool Viz2D::initializeWindowing() { return true; } -cv::ogl::Texture2D& Viz2D::texture() { +cv::ogl::Texture2D& V4D::texture() { return clglContext_->getTexture2D(); } -FormHelper& Viz2D::form() { +FormHelper& V4D::form() { return *form_; } -void Viz2D::setKeyboardEventCallback( +void V4D::setKeyboardEventCallback( std::function fn) { keyEventCb_ = fn; } -bool Viz2D::keyboard_event(int key, int scancode, int action, int modifiers) { +bool V4D::keyboard_event(int key, int scancode, int action, int modifiers) { if (keyEventCb_) return keyEventCb_(key, scancode, action, modifiers); return screen().keyboard_event(key, scancode, action, modifiers); } -FrameBufferContext& Viz2D::fb() { +FrameBufferContext& V4D::fb() { assert(clglContext_ != nullptr); makeCurrent(); return *clglContext_; } -CLVAContext& Viz2D::clva() { +CLVAContext& V4D::clva() { assert(clvaContext_ != nullptr); return *clvaContext_; } -NanoVGContext& Viz2D::nvg() { +NanoVGContext& V4D::nvg() { assert(nvgContext_ != nullptr); makeCurrent(); return *nvgContext_; } -nanogui::Screen& Viz2D::screen() { +nanogui::Screen& V4D::screen() { assert(screen_ != nullptr); makeCurrent(); return *screen_; } -cv::Size Viz2D::getVideoFrameSize() { +cv::Size V4D::getVideoFrameSize() { return clva().getVideoFrameSize(); } -void Viz2D::gl(std::function fn) { +void V4D::gl(std::function fn) { auto fbSize = getFrameBufferSize(); #ifndef __EMSCRIPTEN__ detail::CLExecScope_t scope(fb().getCLExecContext()); @@ -297,21 +297,21 @@ void Viz2D::gl(std::function fn) { fn(fbSize); } -void Viz2D::fb(std::function fn) { +void V4D::fb(std::function fn) { fb().execute(fn); } -void Viz2D::nvg(std::function fn) { +void V4D::nvg(std::function fn) { nvg().render(fn); } -void Viz2D::nanogui(std::function fn) { +void V4D::nanogui(std::function fn) { fn(form()); screen().set_visible(true); screen().perform_layout(); } -void Viz2D::run(std::function fn) { +void V4D::run(std::function fn) { #ifndef __EMSCRIPTEN__ while (keepRunning() && fn()) ; @@ -320,26 +320,26 @@ void Viz2D::run(std::function fn) { #endif } -void Viz2D::setSource(const Source& src) { +void V4D::setSource(const Source& src) { if (!clva().hasContext()) clva().copyContext(); source_ = src; } -void Viz2D::feed(cv::InputArray& in) { +void V4D::feed(cv::InputArray& in) { this->capture([&](cv::OutputArray& videoFrame) { in.getUMat().copyTo(videoFrame); }); } -bool Viz2D::capture() { +bool V4D::capture() { return this->capture([&](cv::UMat& videoFrame) { if (source_.isReady()) source_().second.copyTo(videoFrame); }); } -bool Viz2D::capture(std::function fn) { +bool V4D::capture(std::function fn) { if(futureReader_.valid()) if(!futureReader_.get()) return false; @@ -363,24 +363,24 @@ bool Viz2D::capture(std::function fn) { return captureSuccessful_; } -bool Viz2D::isSourceReady() { +bool V4D::isSourceReady() { return source_.isReady(); } -void Viz2D::setSink(const Sink& sink) { +void V4D::setSink(const Sink& sink) { if (!clva().hasContext()) clva().copyContext(); sink_ = sink; } -void Viz2D::write() { +void V4D::write() { this->write([&](const cv::UMat& videoFrame) { if (sink_.isReady()) sink_(videoFrame); }); } -void Viz2D::write(std::function fn) { +void V4D::write(std::function fn) { if(futureWriter_.valid()) futureWriter_.get(); @@ -395,19 +395,19 @@ void Viz2D::write(std::function fn) { }); } -bool Viz2D::isSinkReady() { +bool V4D::isSinkReady() { return sink_.isReady(); } -void Viz2D::makeCurrent() { +void V4D::makeCurrent() { glfwMakeContextCurrent(getGLFWWindow()); } -void Viz2D::makeNoneCurrent() { +void V4D::makeNoneCurrent() { glfwMakeContextCurrent(nullptr); } -void Viz2D::clear(const cv::Scalar& bgra) { +void V4D::clear(const cv::Scalar& bgra) { const float& b = bgra[0] / 255.0f; const float& g = bgra[1] / 255.0f; const float& r = bgra[2] / 255.0f; @@ -416,27 +416,27 @@ void Viz2D::clear(const cv::Scalar& bgra) { GL_CHECK(glClear(GL_COLOR_BUFFER_BIT)); } -void Viz2D::showGui(bool s) { +void V4D::showGui(bool s) { auto children = screen().children(); for (auto* child : children) { child->set_visible(s); } } -void Viz2D::setMouseDrag(bool d) { +void V4D::setMouseDrag(bool d) { mouseDrag_ = d; } -bool Viz2D::isMouseDrag() { +bool V4D::isMouseDrag() { return mouseDrag_; } -void Viz2D::pan(int x, int y) { +void V4D::pan(int x, int y) { viewport_.x += x * scale_; viewport_.y += y * scale_; } -void Viz2D::zoom(float factor) { +void V4D::zoom(float factor) { if (scale_ == 1 && viewport_.x == 0 && viewport_.y == 0 && factor > 1) return; @@ -501,52 +501,52 @@ void Viz2D::zoom(float factor) { } } -cv::Vec2f Viz2D::getPosition() { +cv::Vec2f V4D::getPosition() { makeCurrent(); int x, y; glfwGetWindowPos(getGLFWWindow(), &x, &y); return {float(x), float(y)}; } -cv::Vec2f Viz2D::getMousePosition() { +cv::Vec2f V4D::getMousePosition() { return mousePos_; } -void Viz2D::setMousePosition(int x, int y) { +void V4D::setMousePosition(int x, int y) { mousePos_ = { float(x), float(y) }; } -float Viz2D::getScale() { +float V4D::getScale() { return scale_; } -cv::Rect Viz2D::getViewport() { +cv::Rect V4D::getViewport() { return viewport_; } -cv::Size Viz2D::getNativeFrameBufferSize() { +cv::Size V4D::getNativeFrameBufferSize() { makeCurrent(); int w, h; glfwGetFramebufferSize(getGLFWWindow(), &w, &h); return {w, h}; } -cv::Size Viz2D::getFrameBufferSize() { +cv::Size V4D::getFrameBufferSize() { return frameBufferSize_; } -cv::Size Viz2D::getWindowSize() { +cv::Size V4D::getWindowSize() { makeCurrent(); int w, h; glfwGetWindowSize(getGLFWWindow(), &w, &h); return {w, h}; } -cv::Size Viz2D::getInitialSize() { +cv::Size V4D::getInitialSize() { return initialSize_; } -float Viz2D::getXPixelRatio() { +float V4D::getXPixelRatio() { makeCurrent(); #ifdef __EMSCRIPTEN__ return emscripten_get_device_pixel_ratio(); @@ -557,7 +557,7 @@ float Viz2D::getXPixelRatio() { #endif } -float Viz2D::getYPixelRatio() { +float V4D::getYPixelRatio() { makeCurrent(); #ifdef __EMSCRIPTEN__ return emscripten_get_device_pixel_ratio(); @@ -568,17 +568,17 @@ float Viz2D::getYPixelRatio() { #endif } -void Viz2D::setWindowSize(const cv::Size& sz) { +void V4D::setWindowSize(const cv::Size& sz) { makeCurrent(); screen().set_size(nanogui::Vector2i(sz.width / getXPixelRatio(), sz.height / getYPixelRatio())); } -bool Viz2D::isFullscreen() { +bool V4D::isFullscreen() { makeCurrent(); return glfwGetWindowMonitor(getGLFWWindow()) != nullptr; } -void Viz2D::setFullscreen(bool f) { +void V4D::setFullscreen(bool f) { makeCurrent(); auto monitor = glfwGetPrimaryMonitor(); const GLFWvidmode* mode = glfwGetVideoMode(monitor); @@ -593,46 +593,46 @@ void Viz2D::setFullscreen(bool f) { } } -bool Viz2D::isResizable() { +bool V4D::isResizable() { makeCurrent(); return glfwGetWindowAttrib(getGLFWWindow(), GLFW_RESIZABLE) == GLFW_TRUE; } -void Viz2D::setResizable(bool r) { +void V4D::setResizable(bool r) { makeCurrent(); glfwWindowHint(GLFW_RESIZABLE, r ? GLFW_TRUE : GLFW_FALSE); } -bool Viz2D::isVisible() { +bool V4D::isVisible() { makeCurrent(); return glfwGetWindowAttrib(getGLFWWindow(), GLFW_VISIBLE) == GLFW_TRUE; } -void Viz2D::setVisible(bool v) { +void V4D::setVisible(bool v) { makeCurrent(); glfwWindowHint(GLFW_VISIBLE, v ? GLFW_TRUE : GLFW_FALSE); screen().set_visible(v); screen().perform_layout(); } -bool Viz2D::isOffscreen() { +bool V4D::isOffscreen() { return offscreen_; } -void Viz2D::setOffscreen(bool o) { +void V4D::setOffscreen(bool o) { offscreen_ = o; setVisible(!o); } -void Viz2D::setStretching(bool s) { +void V4D::setStretching(bool s) { stretch_ = s; } -bool Viz2D::isStretching() { +bool V4D::isStretching() { return stretch_; } -void Viz2D::setDefaultKeyboardEventCallback() { +void V4D::setDefaultKeyboardEventCallback() { setKeyboardEventCallback([&](int key, int scancode, int action, int modifiers) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) { setOffscreen(!isOffscreen()); @@ -649,7 +649,7 @@ void Viz2D::setDefaultKeyboardEventCallback() { }); } -bool Viz2D::display() { +bool V4D::display() { bool result = true; if (!offscreen_) { makeCurrent(); @@ -668,20 +668,20 @@ bool Viz2D::display() { return result; } -bool Viz2D::isClosed() { +bool V4D::isClosed() { return closed_; } -void Viz2D::close() { +void V4D::close() { setVisible(false); closed_ = true; } -GLFWwindow* Viz2D::getGLFWWindow() { +GLFWwindow* V4D::getGLFWWindow() { return glfwWindow_; } -NVGcontext* Viz2D::getNVGcontext() { +NVGcontext* V4D::getNVGcontext() { return screen().nvg_context(); } } diff --git a/modules/viz2d/third/nanogui b/modules/v4d/third/nanogui similarity index 100% rename from modules/viz2d/third/nanogui rename to modules/v4d/third/nanogui diff --git a/modules/viz2d/tutorials/00-intro.markdown b/modules/v4d/tutorials/00-intro.markdown similarity index 60% rename from modules/viz2d/tutorials/00-intro.markdown rename to modules/v4d/tutorials/00-intro.markdown index 60860131c..5da9586f1 100644 --- a/modules/viz2d/tutorials/00-intro.markdown +++ b/modules/v4d/tutorials/00-intro.markdown @@ -1,4 +1,4 @@ -# Viz2D {#viz2d} +# V4D {#v4d} [TOC] @@ -7,15 +7,15 @@ | Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | -# What is Viz2D? -Viz2D offers a way of writing graphical (on- and offscreen) high performance applications with OpenCV. It is light-weight and unencumbered by QT or GTK licenses. It features vector graphics using [NanoVG](https://github.com/inniyah/nanovg) a GUI based on [NanoGUI](https://github.com/mitsuba-renderer/nanogui) and (on supported systems) OpenCL/OpenGL and OpenCL/VAAPI interoperability. It should be included in [OpenCV-contrib](https://github.com/opencv/opencv_contrib) once it is ready. +# What is V4D? +V4D offers a way of writing graphical (on- and offscreen) high performance applications with OpenCV. It is light-weight and unencumbered by QT or GTK licenses. It features vector graphics using [NanoVG](https://github.com/inniyah/nanovg) a GUI based on [NanoGUI](https://github.com/mitsuba-renderer/nanogui) and (on supported systems) OpenCL/OpenGL and OpenCL/VAAPI interoperability. It should be included in [OpenCV-contrib](https://github.com/opencv/opencv_contrib) once it is ready. # Showcase Please note that all renderings and videos were created on an Intel Tigerlake CPU and an Intel Iris Xe iGPU. Also the demos in the videos might run slower for various reasons (better implementation by now, screen capturing, etc.) than they would normally do. @youtube{yYnWkkZSK7Q} -# Why Viz2D? +# Why V4D? Please refer to the online demos in the following section to see at a glance what it can do for you. * **OpenGL**: Easy access to OpenGL. @@ -36,16 +36,16 @@ Please note that the following online demos are slower and/or have less features * https://viel-zu.org/opencv/beauty # Design Notes -* Viz2D is not thread safe. Though it is possible to have several Viz2D objects in one or more threads and synchronize them using ```Viz2D::makeNonCurrent()``` and ```Viz2D::makeCurrent()```. This is a limitation of GLFW3. That said, OpenCV algorithms are multi-threaded as usual. -* Viz2D uses InputArray/OutputArray/InputOutputArray which gives you the option to work with Mat, std::vector and UMat. Anyway, you should prefer to use UMat whenever possible to automatically use hardware capabilities where available. +* V4D is not thread safe. Though it is possible to have several V4D objects in one or more threads and synchronize them using ```V4D::makeNonCurrent()``` and ```V4D::makeCurrent()```. This is a limitation of GLFW3. That said, OpenCV algorithms are multi-threaded as usual. +* V4D uses InputArray/OutputArray/InputOutputArray which gives you the option to work with Mat, std::vector and UMat. Anyway, you should prefer to use UMat whenever possible to automatically use hardware capabilities where available. * Access to different subsystems (opengl, framebuffer, nanovg and nanogui) is provided through "contexts". A context is simply a function that takes a functor, sets up the subsystem, executes the functor and tears-down the subsystem. -* ```Viz2D::run``` is not a context. It is an abstraction of a run loop that takes a functor and runs until the application terminates or the functor returns false. This is necessary for portability reasons. +* ```V4D::run``` is not a context. It is an abstraction of a run loop that takes a functor and runs until the application terminates or the functor returns false. This is necessary for portability reasons. * Contexts ***may not*** be nested. For example, to create an OpenGL context and set the GL viewport: @code{.cpp} -//Creates a Viz2D object for on screen rendering -Ptr v2d = Viz2D::make(Size(WIDTH, HEIGHT), "GL viewport"); +//Creates a V4D object for on screen rendering +Ptr v2d = V4D::make(Size(WIDTH, HEIGHT), "GL viewport"); //Takes care of OpenGL states in the background v2d->gl([](const Size sz) { @@ -73,45 +73,45 @@ v2d->gl([](const Size sz) { * If you want CL-GL sharing on a recent Intel Platform (Gen8 - Gen12) you currently **need to build** [compute-runtime](https://github.com/intel/compute-runtime) and [my OpenCV 4.x fork](https://github.com/kallaballa/opencv/tree/GCV) # Tutorials -The tutorials are designed to be read one after the other to give you a good overview over the key concepts of Viz2D. After that you can move on to the samples. +The tutorials are designed to be read one after the other to give you a good overview over the key concepts of V4D. After that you can move on to the samples. -* \ref viz2d_display_image -* \ref viz2d_vector_graphics -* \ref viz2d_render_opengl -* \ref viz2d_font_rendering -* \ref viz2d_video_editing -* \ref viz2d_custom_source_and_sink -* \ref viz2d_font_with_gui +* \ref v4d_display_image +* \ref v4d_vector_graphics +* \ref v4d_render_opengl +* \ref v4d_font_rendering +* \ref v4d_video_editing +* \ref v4d_custom_source_and_sink +* \ref v4d_font_with_gui # Samples -The goal of the samples is to show how to use Viz2D to the fullest. Also they show how to use Viz2D to create programs that run mostly (the part the matters) on the GPU (when driver capabilities allow). They are also a good starting point for your own applications because they touch many key aspects and algorithms of OpenCV. +The goal of the samples is to show how to use V4D to the fullest. Also they show how to use V4D to create programs that run mostly (the part the matters) on the GPU (when driver capabilities allow). They are also a good starting point for your own applications because they touch many key aspects and algorithms of OpenCV. -* \ref viz2d_tetra -* \ref viz2d_video -* \ref viz2d_nanovg -* \ref viz2d_shader -* \ref viz2d_font -* \ref viz2d_pedestrian -* \ref viz2d_optflow -* \ref viz2d_beauty +* \ref v4d_tetra +* \ref v4d_video +* \ref v4d_nanovg +* \ref v4d_shader +* \ref v4d_font +* \ref v4d_pedestrian +* \ref v4d_optflow +* \ref v4d_beauty # Instructions for Ubuntu 22.04.2 LTS -You need to build OpenCV with Viz2D +You need to build OpenCV with V4D ## Install required packages ```bash apt install vainfo clinfo libqt5opengl5-dev freeglut3-dev ocl-icd-opencl-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev libglfw3-dev libstb-dev libglew-dev cmake make git-core build-essential opencl-clhpp-headers pkg-config zlib1g-dev doxygen libxinerama-dev libxcursor-dev libxi-dev libva-dev ``` -## Build OpenCV with Viz2D +## Build OpenCV with V4D ```bash git clone --branch 4.x https://github.com/opencv/opencv.git -git clone https://github.com/kallaballa/Viz2D.git +git clone https://github.com/kallaballa/V4D.git mkdir opencv/build cd opencv/build -cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_opencv_viz2d=ON -DBUILD_opencv_python_tests=OFF -DBUILD_opencv_js_bindings_generator=OFF -DBUILD_opencv_python_bindings_generator=OFF -DBUILD_opencv_python3=OFF -DOPENCV_ENABLE_GLX=ON -DOPENCV_FFMPEG_ENABLE_LIBAVDEVICE=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DWITH_FFMPEG=ON -DOPENCV_FFMPEG_SKIP_BUILD_CHECK=ON -DWITH_VA=ON -DWITH_VA_INTEL=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DOPENCV_EXTRA_MODULES_PATH=../../Viz2D/modules/ .. +cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_opencv_v4d=ON -DBUILD_opencv_python_tests=OFF -DBUILD_opencv_js_bindings_generator=OFF -DBUILD_opencv_python_bindings_generator=OFF -DBUILD_opencv_python3=OFF -DOPENCV_ENABLE_GLX=ON -DOPENCV_FFMPEG_ENABLE_LIBAVDEVICE=ON -DWITH_OPENGL=ON -DWITH_QT=ON -DWITH_FFMPEG=ON -DOPENCV_FFMPEG_SKIP_BUILD_CHECK=ON -DWITH_VA=ON -DWITH_VA_INTEL=ON -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DOPENCV_EXTRA_MODULES_PATH=../../V4D/modules/ .. make -j8 sudo make install ``` @@ -130,7 +130,7 @@ sudo make install ### Make the samples ```bash -cd Viz2D/modules/viz2d/samples/cpp +cd V4D/modules/v4d/samples/cpp make -j ``` @@ -142,28 +142,28 @@ wget -O bunny.webm https://upload.wikimedia.org/wikipedia/commons/transcoded/f/f ### Run the samples ```bash -modules/viz2d/samples/cpp/tetra/tetra-demo +modules/v4d/samples/cpp/tetra/tetra-demo ``` ```bash -modules/viz2d/samples/cpp/video/video-demo bunny.webm +modules/v4d/samples/cpp/video/video-demo bunny.webm ``` ```bash -modules/viz2d/samples/cpp/shader/shader-demo bunny.webm +modules/v4d/samples/cpp/shader/shader-demo bunny.webm ``` ```bash -modules/viz2d/samples/cpp/nanovg/nanovg-demo bunny.webm +modules/v4d/samples/cpp/nanovg/nanovg-demo bunny.webm ``` ```bash -modules/viz2d/samples/cpp/font/font-demo +modules/v4d/samples/cpp/font/font-demo ``` ```bash -modules/viz2d/samples/cpp/optflow/optflow-demo bunny.webm +modules/v4d/samples/cpp/optflow/optflow-demo bunny.webm ``` ```bash -modules/viz2d/samples/cpp/pedestrian/pedestrian-demo bunny.webm +modules/v4d/samples/cpp/pedestrian/pedestrian-demo bunny.webm ``` ```bash -modules/viz2d/samples/cpp/beauty/beauty-demo bunny.webm +modules/v4d/samples/cpp/beauty/beauty-demo bunny.webm ``` # Attribution diff --git a/modules/viz2d/tutorials/01-dislay_image.markdown b/modules/v4d/tutorials/01-dislay_image.markdown similarity index 57% rename from modules/viz2d/tutorials/01-dislay_image.markdown rename to modules/v4d/tutorials/01-dislay_image.markdown index e1e79a6f7..a5c02c88f 100644 --- a/modules/viz2d/tutorials/01-dislay_image.markdown +++ b/modules/v4d/tutorials/01-dislay_image.markdown @@ -1,7 +1,7 @@ -# Display an Image {#viz2d_display_image} +# Display an Image {#v4d_display_image} -@prev_tutorial{viz2d} -@next_tutorial{viz2d_vector_graphics} +@prev_tutorial{v4d} +@next_tutorial{v4d_vector_graphics} | | | | -: | :- | @@ -9,7 +9,7 @@ | Compatibility | OpenCV >= 4.7 | ## Using the video pipeline -Actually there are two ways to display an image using Viz2D. The most convenient way is to use the video pipeline to feed an image to Viz2D. That has the advantage that the image is automatically resized (preserving aspect ratio) to framebuffer size and color converted (the framebuffer is BGRA). +Actually there are two ways to display an image using V4D. The most convenient way is to use the video pipeline to feed an image to V4D. That has the advantage that the image is automatically resized (preserving aspect ratio) to framebuffer size and color converted (the framebuffer is BGRA). @include samples/cpp/display_image.cpp diff --git a/modules/viz2d/tutorials/02-vector_graphics.markdown b/modules/v4d/tutorials/02-vector_graphics.markdown similarity index 84% rename from modules/viz2d/tutorials/02-vector_graphics.markdown rename to modules/v4d/tutorials/02-vector_graphics.markdown index f8e043df3..c6ed7b647 100644 --- a/modules/viz2d/tutorials/02-vector_graphics.markdown +++ b/modules/v4d/tutorials/02-vector_graphics.markdown @@ -1,7 +1,7 @@ -# Render vector graphics {#viz2d_vector_graphics} +# Render vector graphics {#v4d_vector_graphics} -@prev_tutorial{viz2d_display_image} -@next_tutorial{viz2d_render_opengl} +@prev_tutorial{v4d_display_image} +@next_tutorial{v4d_render_opengl} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/03-render_opengl.markdown b/modules/v4d/tutorials/03-render_opengl.markdown similarity index 72% rename from modules/viz2d/tutorials/03-render_opengl.markdown rename to modules/v4d/tutorials/03-render_opengl.markdown index d4640112c..29dd701e8 100644 --- a/modules/viz2d/tutorials/03-render_opengl.markdown +++ b/modules/v4d/tutorials/03-render_opengl.markdown @@ -1,7 +1,7 @@ -# OpenGL Rendering {#viz2d_render_opengl} +# OpenGL Rendering {#v4d_render_opengl} -@prev_tutorial{viz2d_vector_graphics} -@next_tutorial{viz2d_font_rendering} +@prev_tutorial{v4d_vector_graphics} +@next_tutorial{v4d_font_rendering} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/04-font_rendering.markdown b/modules/v4d/tutorials/04-font_rendering.markdown similarity index 70% rename from modules/viz2d/tutorials/04-font_rendering.markdown rename to modules/v4d/tutorials/04-font_rendering.markdown index 503f901cc..e857e4aeb 100644 --- a/modules/viz2d/tutorials/04-font_rendering.markdown +++ b/modules/v4d/tutorials/04-font_rendering.markdown @@ -1,7 +1,7 @@ -# Font rendering {#viz2d_font_rendering} +# Font rendering {#v4d_font_rendering} -@prev_tutorial{viz2d_render_opengl} -@next_tutorial{viz2d_video_editing} +@prev_tutorial{v4d_render_opengl} +@next_tutorial{v4d_video_editing} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/05-video_editing.markdown b/modules/v4d/tutorials/05-video_editing.markdown similarity index 79% rename from modules/viz2d/tutorials/05-video_editing.markdown rename to modules/v4d/tutorials/05-video_editing.markdown index f49f65c33..2e029fe73 100644 --- a/modules/viz2d/tutorials/05-video_editing.markdown +++ b/modules/v4d/tutorials/05-video_editing.markdown @@ -1,7 +1,7 @@ -# Video editing {#viz2d_video_editing} +# Video editing {#v4d_video_editing} -@prev_tutorial{viz2d_font_rendering} -@next_tutorial{viz2d_custom_source_and_sink} +@prev_tutorial{v4d_font_rendering} +@next_tutorial{v4d_custom_source_and_sink} | | | | -: | :- | diff --git a/modules/v4d/tutorials/06-custom_source_and_sink.markdown b/modules/v4d/tutorials/06-custom_source_and_sink.markdown new file mode 100644 index 000000000..803be4e6b --- /dev/null +++ b/modules/v4d/tutorials/06-custom_source_and_sink.markdown @@ -0,0 +1,17 @@ +# Custom Source and Sink {#v4d_custom_source_and_sink} + +@prev_tutorial{v4d_video_editing} +@next_tutorial{v4d_font_with_gui} + +| | | +| -: | :- | +| Original author | Amir Hassan (kallaballa) | +| Compatibility | OpenCV >= 4.7 | + +## Reading and writing to V4D using custom Sources and Sinks +In the previous tutorial we used a default video source and a video sink to stream a video through V4D which can be manipulated using OpenGL, NanoVG or OpenCV. In this example we are creating a custom Source that generates rainbow frames. For each time the Source is invoked the frame is colored a slightly different color. Additionally the custom Sink saves individual images instead of a video. + +@include samples/cpp/custom_source_and_sink.cpp + +![The result](doc/custom_source_and_sink.png) + diff --git a/modules/viz2d/tutorials/07-font_with_gui.markdown b/modules/v4d/tutorials/07-font_with_gui.markdown similarity index 80% rename from modules/viz2d/tutorials/07-font_with_gui.markdown rename to modules/v4d/tutorials/07-font_with_gui.markdown index a54391484..d8ab474b4 100644 --- a/modules/viz2d/tutorials/07-font_with_gui.markdown +++ b/modules/v4d/tutorials/07-font_with_gui.markdown @@ -1,6 +1,6 @@ -# Form based GUI {#viz2d_font_with_gui} +# Form based GUI {#v4d_font_with_gui} -@prev_tutorial{viz2d_custom_source_and_sink} +@prev_tutorial{v4d_custom_source_and_sink} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/10-tetra.markdown b/modules/v4d/tutorials/10-tetra.markdown similarity index 81% rename from modules/viz2d/tutorials/10-tetra.markdown rename to modules/v4d/tutorials/10-tetra.markdown index 803ec9692..886a944db 100644 --- a/modules/viz2d/tutorials/10-tetra.markdown +++ b/modules/v4d/tutorials/10-tetra.markdown @@ -1,7 +1,7 @@ -# Tetra-Demo {#viz2d_tetra} +# Tetra-Demo {#v4d_tetra} -@prev_tutorial{viz2d} -@next_tutorial{viz2d_video} +@prev_tutorial{v4d} +@next_tutorial{v4d_video} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/11-video.markdown b/modules/v4d/tutorials/11-video.markdown similarity index 80% rename from modules/viz2d/tutorials/11-video.markdown rename to modules/v4d/tutorials/11-video.markdown index d99884e33..e97e8be04 100644 --- a/modules/viz2d/tutorials/11-video.markdown +++ b/modules/v4d/tutorials/11-video.markdown @@ -1,7 +1,7 @@ -# Video-Demo {#viz2d_video} +# Video-Demo {#v4d_video} -@prev_tutorial{viz2d_tetra} -@next_tutorial{viz2d_nanovg} +@prev_tutorial{v4d_tetra} +@next_tutorial{v4d_nanovg} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/12-nanovg.markdown b/modules/v4d/tutorials/12-nanovg.markdown similarity index 80% rename from modules/viz2d/tutorials/12-nanovg.markdown rename to modules/v4d/tutorials/12-nanovg.markdown index 83ac6654e..aad11b2dc 100644 --- a/modules/viz2d/tutorials/12-nanovg.markdown +++ b/modules/v4d/tutorials/12-nanovg.markdown @@ -1,7 +1,7 @@ -# Nanovg-Demo {#viz2d_nanovg} +# Nanovg-Demo {#v4d_nanovg} -@prev_tutorial{viz2d_video} -@next_tutorial{viz2d_shader} +@prev_tutorial{v4d_video} +@next_tutorial{v4d_shader} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/13-shader.markdown b/modules/v4d/tutorials/13-shader.markdown similarity index 76% rename from modules/viz2d/tutorials/13-shader.markdown rename to modules/v4d/tutorials/13-shader.markdown index 613f81a73..a67ff5820 100644 --- a/modules/viz2d/tutorials/13-shader.markdown +++ b/modules/v4d/tutorials/13-shader.markdown @@ -1,7 +1,7 @@ -# Shader-Demo {#viz2d_shader} +# Shader-Demo {#v4d_shader} -@prev_tutorial{viz2d_nanovg} -@next_tutorial{viz2d_font} +@prev_tutorial{v4d_nanovg} +@next_tutorial{v4d_font} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/14-font.markdown b/modules/v4d/tutorials/14-font.markdown similarity index 78% rename from modules/viz2d/tutorials/14-font.markdown rename to modules/v4d/tutorials/14-font.markdown index adbf71225..79dd94a91 100644 --- a/modules/viz2d/tutorials/14-font.markdown +++ b/modules/v4d/tutorials/14-font.markdown @@ -1,7 +1,7 @@ -# Font-Demo {#viz2d_font} +# Font-Demo {#v4d_font} -@prev_tutorial{viz2d_shader} -@next_tutorial{viz2d_pedestrian} +@prev_tutorial{v4d_shader} +@next_tutorial{v4d_pedestrian} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/15-pedestrian.markdown b/modules/v4d/tutorials/15-pedestrian.markdown similarity index 83% rename from modules/viz2d/tutorials/15-pedestrian.markdown rename to modules/v4d/tutorials/15-pedestrian.markdown index 308588bf9..449d0eef6 100644 --- a/modules/viz2d/tutorials/15-pedestrian.markdown +++ b/modules/v4d/tutorials/15-pedestrian.markdown @@ -1,7 +1,7 @@ -# Pedestrian-Demo {#viz2d_pedestrian} +# Pedestrian-Demo {#v4d_pedestrian} -@prev_tutorial{viz2d_font} -@next_tutorial{viz2d_optflow} +@prev_tutorial{v4d_font} +@next_tutorial{v4d_optflow} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/16-optflow.markdown b/modules/v4d/tutorials/16-optflow.markdown similarity index 84% rename from modules/viz2d/tutorials/16-optflow.markdown rename to modules/v4d/tutorials/16-optflow.markdown index e39a0c831..ef31163c0 100644 --- a/modules/viz2d/tutorials/16-optflow.markdown +++ b/modules/v4d/tutorials/16-optflow.markdown @@ -1,7 +1,7 @@ -# Optflow-Demo {#viz2d_optflow} +# Optflow-Demo {#v4d_optflow} -@prev_tutorial{viz2d_pedestrian} -@next_tutorial{viz2d_beauty} +@prev_tutorial{v4d_pedestrian} +@next_tutorial{v4d_beauty} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/17-beauty.markdown b/modules/v4d/tutorials/17-beauty.markdown similarity index 85% rename from modules/viz2d/tutorials/17-beauty.markdown rename to modules/v4d/tutorials/17-beauty.markdown index 6974f2406..832e85be3 100644 --- a/modules/viz2d/tutorials/17-beauty.markdown +++ b/modules/v4d/tutorials/17-beauty.markdown @@ -1,6 +1,6 @@ -# Beauty-Demo {#viz2d_beauty} +# Beauty-Demo {#v4d_beauty} -@prev_tutorial{viz2d_optflow} +@prev_tutorial{v4d_optflow} | | | | -: | :- | diff --git a/modules/viz2d/tutorials/06-custom_source_and_sink.markdown b/modules/viz2d/tutorials/06-custom_source_and_sink.markdown deleted file mode 100644 index 799840f25..000000000 --- a/modules/viz2d/tutorials/06-custom_source_and_sink.markdown +++ /dev/null @@ -1,17 +0,0 @@ -# Custom Source and Sink {#viz2d_custom_source_and_sink} - -@prev_tutorial{viz2d_video_editing} -@next_tutorial{viz2d_font_with_gui} - -| | | -| -: | :- | -| Original author | Amir Hassan (kallaballa) | -| Compatibility | OpenCV >= 4.7 | - -## Reading and writing to Viz2D using custom Sources and Sinks -In the previous tutorial we used a default video source and a video sink to stream a video through Viz2D which can be manipulated using OpenGL, NanoVG or OpenCV. In this example we are creating a custom Source that generates rainbow frames. For each time the Source is invoked the frame is colored a slightly different color. Additionally the custom Sink saves individual images instead of a video. - -@include samples/cpp/custom_source_and_sink.cpp - -![The result](doc/custom_source_and_sink.png) -