diff --git a/modules/viz2d/samples/cpp/display_image.cpp b/modules/viz2d/samples/cpp/display_image.cpp index b7f9c0434..9ed4d1636 100644 --- a/modules/viz2d/samples/cpp/display_image.cpp +++ b/modules/viz2d/samples/cpp/display_image.cpp @@ -14,7 +14,7 @@ int main() { Mat image = imread(samples::findFile("lena.jpg")); //Feeds the image to the video pipeline v2d->feed(image); - //Display the framebuffer in the native window - while(v2d->display()); + //Display the framebuffer in the native window in an endless loop + v2d->run(v2d->display); } diff --git a/modules/viz2d/samples/cpp/display_image_fb.cpp b/modules/viz2d/samples/cpp/display_image_fb.cpp index d181e8cb5..b56c52c3c 100644 --- a/modules/viz2d/samples/cpp/display_image_fb.cpp +++ b/modules/viz2d/samples/cpp/display_image_fb.cpp @@ -19,7 +19,7 @@ int main() { //Color convert the resized UMat. The framebuffer has alpha. cvtColor(resized, framebuffer, COLOR_RGB2BGRA); }); - //Display the framebuffer in the native window - while(v2d->display()); + //Display the framebuffer in the native window in an endless loop + v2d->run(v2d->display); } diff --git a/modules/viz2d/samples/cpp/font_rendering.cpp b/modules/viz2d/samples/cpp/font_rendering.cpp index 9e56c21a1..2acf20863 100644 --- a/modules/viz2d/samples/cpp/font_rendering.cpp +++ b/modules/viz2d/samples/cpp/font_rendering.cpp @@ -24,6 +24,7 @@ int main(int argc, char** argv) { text(WIDTH / 2.0, HEIGHT / 2.0, hw.c_str(), hw.c_str() + hw.size()); }); - while(v2d->display()); + //Display the framebuffer in the native window in an endless loop + v2d->run(v2d->display); } diff --git a/modules/viz2d/samples/cpp/vector_graphics.cpp b/modules/viz2d/samples/cpp/vector_graphics.cpp index e02437dd2..d500a2524 100644 --- a/modules/viz2d/samples/cpp/vector_graphics.cpp +++ b/modules/viz2d/samples/cpp/vector_graphics.cpp @@ -24,6 +24,7 @@ int main(int argc, char** argv) { stroke(); }); - while(v2d->display()); + //Display the framebuffer in the native window in an endless loop + v2d->run(v2d->display); } diff --git a/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp b/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp index 3d58c38d9..4f111df43 100644 --- a/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp +++ b/modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp @@ -28,6 +28,7 @@ int main(int argc, char** argv) { //Heavily blurs the crosshair using a cheap boxFilter boxFilter(framebuffer, framebuffer, -1, Size(15, 15), Point(-1,-1), true, BORDER_REPLICATE); }); - while(v2d->display()); + //Display the framebuffer in the native window in an endless loop + v2d->run(v2d->display); } diff --git a/modules/viz2d/tutorials/00-intro.markdown b/modules/viz2d/tutorials/00-intro.markdown index aa39fdd8f..c3caf6c04 100644 --- a/modules/viz2d/tutorials/00-intro.markdown +++ b/modules/viz2d/tutorials/00-intro.markdown @@ -2,20 +2,25 @@ [TOC] +| | | +| -: | :- | +| 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. # Why Viz2D? Please refer to the following 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. -* Vector graphics: Elegant and fast vector graphics through NanoVG. -* Font rendering: Loading of TTF-fonts and sophisticated rendering options. -* Video pipeline: Through a simple Source/Sink system videos can be displayed, edited and saved. -* Hardware acceleration: Automatic hardware acceleration usage where possible. (e.g. cl-gl sharing and VAAPI). Actually it is possible to write programs that run almost entirely on the GPU, given driver-features are available. -* No more highgui with it's heavy dependencies, licenses and limitations. -* WebAssembly support. +* **OpenGL**: Easy access to OpenGL. +* **GUI**: Simple yet powerful user interfaces through NanoGUI. +* **Vector graphics**: Elegant and fast vector graphics through NanoVG. +* **Font rendering**: Loading of TTF-fonts and sophisticated rendering options. +* **Video pipeline**: Through a simple Source/Sink system videos can be displayed, edited and saved. +* **Hardware acceleration**: Automatic hardware acceleration usage where possible. (e.g. CL-GL sharing and VAAPI). Actually it is possible to write programs that run almost entirely on the GPU, given driver-features are available. +* **No more highgui** with it's heavy dependencies, licenses and limitations. +* **WebAssembly support**. # Online Demos @@ -49,7 +54,7 @@ v2d->gl([](const Size sz) { # Optional requirements * Support for OpenCL 1.2 * Support for cl_khr_gl_sharing and cl_intel_va_api_media_sharing OpenCL extensions. -* If you want cl-gl sharing on a recent Intel Platform (Gen8 - Gen12) you currently **need to install** [compute-runtime](https://github.com/intel/compute-runtime) from source and [my OpenCV fork](https://github.com/kallaballa/opencv) +* If you want CL-GL sharing on a recent Intel Platform (Gen8 - Gen12) you currently **need to install** [compute-runtime](https://github.com/intel/compute-runtime) from source and [my OpenCV fork](https://github.com/kallaballa/opencv) # Dependencies * [OpenCV 4.x](https://github.com/opencv/opencv) diff --git a/modules/viz2d/tutorials/01-dislay_image.markdown b/modules/viz2d/tutorials/01-dislay_image.markdown index c9d60426b..25cfd4432 100644 --- a/modules/viz2d/tutorials/01-dislay_image.markdown +++ b/modules/viz2d/tutorials/01-dislay_image.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Using the video pipeline diff --git a/modules/viz2d/tutorials/02-vector_graphics.markdown b/modules/viz2d/tutorials/02-vector_graphics.markdown index e7d35d0ea..6b24da6a8 100644 --- a/modules/viz2d/tutorials/02-vector_graphics.markdown +++ b/modules/viz2d/tutorials/02-vector_graphics.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Vector graphics diff --git a/modules/viz2d/tutorials/03-render_opengl.markdown b/modules/viz2d/tutorials/03-render_opengl.markdown index fd1a38aa7..3bd91fd94 100644 --- a/modules/viz2d/tutorials/03-render_opengl.markdown +++ b/modules/viz2d/tutorials/03-render_opengl.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Render a rotating tetrahedron diff --git a/modules/viz2d/tutorials/04-font_rendering.markdown b/modules/viz2d/tutorials/04-font_rendering.markdown index 4a00aa68c..031a671f9 100644 --- a/modules/viz2d/tutorials/04-font_rendering.markdown +++ b/modules/viz2d/tutorials/04-font_rendering.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Render Hello World diff --git a/modules/viz2d/tutorials/05-video_editing.markdown b/modules/viz2d/tutorials/05-video_editing.markdown index 958156a12..954d99172 100644 --- a/modules/viz2d/tutorials/05-video_editing.markdown +++ b/modules/viz2d/tutorials/05-video_editing.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Render text on top of a video diff --git a/modules/viz2d/tutorials/06-font_with_gui.markdown b/modules/viz2d/tutorials/06-font_with_gui.markdown index bbb85f0bd..46f344d54 100644 --- a/modules/viz2d/tutorials/06-font_with_gui.markdown +++ b/modules/viz2d/tutorials/06-font_with_gui.markdown @@ -4,7 +4,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | ## Font rendering with form based GUI diff --git a/modules/viz2d/tutorials/10-tetra.markdown b/modules/viz2d/tutorials/10-tetra.markdown index aa4e52ef7..803ec9692 100644 --- a/modules/viz2d/tutorials/10-tetra.markdown +++ b/modules/viz2d/tutorials/10-tetra.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Renders a rainbow tetrahedron on blue background using OpenGL, applies a glow effect using OpenCV (OpenCL) and encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/11-video.markdown b/modules/viz2d/tutorials/11-video.markdown index f025b86e4..d99884e33 100644 --- a/modules/viz2d/tutorials/11-video.markdown +++ b/modules/viz2d/tutorials/11-video.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Renders a rainbow tetrahedron on top of a input-video using OpenGL, applies a glow effect using OpenCV (OpenCL) and decodes/encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/12-nanovg.markdown b/modules/viz2d/tutorials/12-nanovg.markdown index 9ecf04bdd..83ac6654e 100644 --- a/modules/viz2d/tutorials/12-nanovg.markdown +++ b/modules/viz2d/tutorials/12-nanovg.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Renders a color wheel on top of an input-video using nanovg (OpenGL), does colorspace conversions using OpenCV (OpenCL) and decodes/encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/13-shader.markdown b/modules/viz2d/tutorials/13-shader.markdown index c285cedae..613f81a73 100644 --- a/modules/viz2d/tutorials/13-shader.markdown +++ b/modules/viz2d/tutorials/13-shader.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Renders a mandelbrot fractal zoom. Uses shaders, OpenCL and VAAPI together. diff --git a/modules/viz2d/tutorials/14-font.markdown b/modules/viz2d/tutorials/14-font.markdown index 1ce538416..adbf71225 100644 --- a/modules/viz2d/tutorials/14-font.markdown +++ b/modules/viz2d/tutorials/14-font.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Renders a Star Wars like text crawl using nanovg (OpenGL), uses OpenCV (OpenCL) for a pseudo 3D effect and encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/15-pedestrian.markdown b/modules/viz2d/tutorials/15-pedestrian.markdown index 4a9375770..308588bf9 100644 --- a/modules/viz2d/tutorials/15-pedestrian.markdown +++ b/modules/viz2d/tutorials/15-pedestrian.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Pedestrian detection using HOG with a linear SVM, non-maximal suppression and tracking using KCF. Uses nanovg for rendering (OpenGL), detects using a linear SVM (OpenCV/OpenCL), filters resuls using NMS (CPU) and tracks using KCF (CPU). Decodes/encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/16-optflow.markdown b/modules/viz2d/tutorials/16-optflow.markdown index bbec653aa..e39a0c831 100644 --- a/modules/viz2d/tutorials/16-optflow.markdown +++ b/modules/viz2d/tutorials/16-optflow.markdown @@ -5,7 +5,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Optical flow visualization on top of a video. Uses background subtraction (OpenCV/OpenCL) to isolate areas with motion, detects features to track (OpenCV/OpenCL), calculates the optical flow (OpenCV/OpenCL), uses nanovg for rendering (OpenGL) and post-processes the video (OpenCL). Decodes/encodes on the GPU (VAAPI). diff --git a/modules/viz2d/tutorials/17-beauty.markdown b/modules/viz2d/tutorials/17-beauty.markdown index 1574fddea..6974f2406 100644 --- a/modules/viz2d/tutorials/17-beauty.markdown +++ b/modules/viz2d/tutorials/17-beauty.markdown @@ -4,7 +4,7 @@ | | | | -: | :- | -| Original author | Amir Hassan | +| Original author | Amir Hassan (kallaballa) | | Compatibility | OpenCV >= 4.7 | Face beautification using face landmark detection (OpenCV/OpenCL), nanovg (OpenGL) for drawing masks and multi-band blending (CPU) to put it all together.