Loading...
Searching...
No Matches
Font rendering
Prev Tutorial: OpenGL Rendering
Next Tutorial: Video editing
Original author | Amir Hassan (kallaballa) amir@.nosp@m.viel.nosp@m.-zu.o.nosp@m.rg |
Compatibility | OpenCV >= 4.7 |
Render Hello World
Draws "Hello World" to the screen using NanoVG. Demos some basic font options.
Downloading...
#include <opencv2/v4d/v4d.hpp>
using namespace cv;
using namespace cv::v4d;
int main() {
//The text to render
string hw = "Hello World";
window->run([hw](Ptr<V4D> win){
//Render the text at the center of the screen. Note that you can load you own fonts.
win->nvg([hw](const Size& sz) {
using namespace cv::v4d::nvg;
clear();
fontSize(40.0f);
fontFace("sans-bold");
fillColor(Scalar(255, 0, 0, 255));
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
});
return win->display();
});
}
Definition: nvg.hpp:19
Definition: framebuffercontext.hpp:25
"black box" representation of the file storage associated with a file on disk.
Definition: core.hpp:106