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;
//The text to render
string hw_ = "Hello World";
public:
//Render the text at the center of the screen. Note that you can load you own fonts.
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);
str.c_str() + str.size());
}, win->fbSize(), hw_);
}
};
int main() {
cv::Ptr<V4D> window = V4D::make(960, 960, "Font Rendering");
window->run<FontRenderingPlan>(0);
}
Definition: v4d.hpp:68
Definition: nvg.hpp:20
Definition: backend.hpp:15
"black box" representation of the file storage associated with a file on disk.
Definition: core.hpp:106