documentation touch-ups

pull/3471/head
kallaballa 2 years ago
parent 1296cd0380
commit 8f8a89644e
  1. 9
      modules/viz2d/samples/cpp/display_image.cpp
  2. 1
      modules/viz2d/samples/cpp/display_image_fb.cpp
  3. 1
      modules/viz2d/samples/cpp/font_with_gui.cpp
  4. 4
      modules/viz2d/samples/cpp/render_opengl.cpp
  5. 2
      modules/viz2d/samples/cpp/vector_graphics.cpp
  6. 2
      modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp
  7. 5
      modules/viz2d/samples/cpp/video_editing.cpp
  8. 9
      modules/viz2d/tutorials/00-intro.markdown
  9. 4
      modules/viz2d/tutorials/01-dislay_image.markdown
  10. 2
      modules/viz2d/tutorials/02-vector_graphics.markdown
  11. 2
      modules/viz2d/tutorials/03-render_opengl.markdown
  12. 2
      modules/viz2d/tutorials/04-font_rendering.markdown
  13. 4
      modules/viz2d/tutorials/05-video_editing.markdown
  14. 2
      modules/viz2d/tutorials/06-font_with_gui.markdown

@ -9,12 +9,15 @@ constexpr int HEIGHT = 720;
int main() {
//Creates a Viz2D object for on screen rendering
Ptr<Viz2D> v2d = Viz2D::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
v2d->run(v2d->display);
//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
//of a run loop for portability reasons and executes the functor until the application
//terminates or the functor returns false.
v2d->run(v2d->display);
}

@ -9,7 +9,6 @@ constexpr int HEIGHT = 720;
int main() {
//Creates a Viz2D object for on screen rendering
Ptr<Viz2D> v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Show image");
//Read an image as UMat
UMat image = imread(samples::findFile("lena.jpg")).getUMat(ACCESS_READ);
UMat resized;

@ -38,6 +38,7 @@ int main(int argc, char** argv) {
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
text(sz.width / 2.0, sz.height / 2.0, hw.c_str(), hw.c_str() + hw.size());
});
//Display the framebuffer in the native window
return v2d->display();
});
}

@ -27,9 +27,7 @@ int main(int argc, char** argv) {
glRotatef(50, 1, 0, 0);
glRotatef(70, 0, 1, 0);
});
//Viz2D::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->gl([](const Size& sz) {
//Render a tetrahedron using immediate mode because the code is more concise

@ -13,6 +13,8 @@ int main(int argc, char** argv) {
v2d->nvg([](const Size& sz) {
//Calls from this namespace may only be used inside a nvg context
using namespace cv::viz::nvg;
//Draws a cross hair
beginPath();
strokeWidth(3.0);
strokeColor(Scalar(0,0,255,255)); //BGRA

@ -13,6 +13,8 @@ int main(int argc, char** argv) {
v2d->nvg([](const Size& sz) {
//Calls from this namespace may only be used inside a nvg context
using namespace cv::viz::nvg;
//Draws a cross-hair
beginPath();
strokeWidth(3.0);
strokeColor(Scalar(0,0,255,255)); //BGRA

@ -20,6 +20,7 @@ int main(int argc, char** argv) {
v2d->setSink(sink);
v2d->run([=]() {
//Capture video from the Source
if(!v2d->capture())
return false; //end of input video
@ -32,8 +33,8 @@ int main(int argc, char** argv) {
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
text(sz.width / 2.0, sz.height / 2.0, hv.c_str(), hv.c_str() + hv.size());
});
v2d->write(); //write the output video
return v2d->display(); //display the framebuffer in the native window
v2d->write(); //Write video to the Sink
return v2d->display(); //Display the framebuffer in the native window
});
}

@ -21,9 +21,9 @@ Please refer to the online demos in the following section to see at a glance wha
* **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.
* **Font rendering**: Loading of fonts and sophisticated rendering options.
* **Video pipeline**: Through a simple Source/Sink system videos can be efficently displayed, edited and saved.
* **Hardware acceleration**: Transparent 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**.
@ -39,6 +39,7 @@ Please note that the following online demos are slower and/or have less features
* 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.
* 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.
* Contexts ***may not*** be nested.
For example, to create an OpenGL context and set the GL viewport:
@ -79,7 +80,7 @@ The tutorials are designed to be read one after the other to give you a good ove
* \ref viz2d_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 in conjunction with interop options to create programs that run mostly (the part the matters) on the GPU. 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 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.
* \ref viz2d_tetra
* \ref viz2d_video

@ -1,4 +1,4 @@
# Display an image using Viz2D {#viz2d_display_image}
# Display an Image {#viz2d_display_image}
@prev_tutorial{viz2d}
@next_tutorial{viz2d_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 system to feed an image into Viz2D. That has the advantage that the image is automatically resized (keeping aspect ratio) to framebuffer size and color converted (The framebuffer is BGRA).
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).
@include samples/cpp/display_image.cpp

@ -1,4 +1,4 @@
# Render vector graphics using Viz2D {#viz2d_vector_graphics}
# Render vector graphics {#viz2d_vector_graphics}
@prev_tutorial{viz2d_display_image}
@next_tutorial{viz2d_render_opengl}

@ -1,4 +1,4 @@
# Render OpenGL using Viz2D {#viz2d_render_opengl}
# OpenGL Rendering {#viz2d_render_opengl}
@prev_tutorial{viz2d_vector_graphics}
@next_tutorial{viz2d_font_rendering}

@ -1,4 +1,4 @@
# Font rendering using Viz2D {#viz2d_font_rendering}
# Font rendering {#viz2d_font_rendering}
@prev_tutorial{viz2d_render_opengl}
@next_tutorial{viz2d_video_editing}

@ -1,4 +1,4 @@
# Video editing using Viz2D {#viz2d_video_editing}
# Video editing {#viz2d_video_editing}
@prev_tutorial{viz2d_font_rendering}
@next_tutorial{viz2d_font_with_gui}
@ -9,7 +9,7 @@
| Compatibility | OpenCV >= 4.7 |
## Render text on top of a video
Through adding a Source and a Sink v2d becomes capable of video editing. Reads a video, renders text on top and writes the result.
Through adding a Source and a Sink v2d becomes capable of video editing. Reads a video, renders text on top and writes the result. Note: Reading and writing of video-data is multi-threaded in the background for performance reasons.
@include samples/cpp/video_editing.cpp

@ -1,4 +1,4 @@
# Form based GUI using Viz2D {#viz2d_font_with_gui}
# Form based GUI {#viz2d_font_with_gui}
@prev_tutorial{viz2d_video_editing}

Loading…
Cancel
Save