|
ReUseX
0.0.1
3D Point Cloud Processing for Building Reuse
|
FreeType-based text renderer for OpenCV images. More...
#include <cvx_text.hpp>
Public Member Functions | |
| CvxText (const char *font_path) | |
| Load the primary font face from the given file path. | |
| virtual | ~CvxText () |
| void | putText (cv::Mat &img, const std::string &text, cv::Point org, cv::Scalar color, int font_size) |
| Render a UTF-8 string onto an OpenCV image. | |
| void | getTextSize (const std::string &text, int font_size, int *w, int *h, int *baseline) |
| Compute the approximate bounding-box dimensions of a rendered string. | |
FreeType-based text renderer for OpenCV images.
CvxText renders UTF-8 encoded strings onto cv::Mat images using a TrueType font loaded via the FreeType library. Multiple font faces can be managed through a single instance — the first call to putText or getTextSize for a given font path will load and cache the face automatically.
Definition at line 19 of file cvx_text.hpp.
|
explicit |
Load the primary font face from the given file path.
| font_path | Path to a TrueType (.ttf) or OpenType font file. |
| std::runtime_error | if the FreeType library or face cannot be initialized. |
Referenced by getTextSize().
|
virtual |
| void ReUseX::vision::osd::CvxText::getTextSize | ( | const std::string & | text, |
| int | font_size, | ||
| int * | w, | ||
| int * | h, | ||
| int * | baseline ) |
Compute the approximate bounding-box dimensions of a rendered string.
| text | UTF-8 string to measure. | |
| font_size | Glyph height in pixels. | |
| [out] | w | Approximate rendered width in pixels. |
| [out] | h | Approximate rendered height (ascent) in pixels. |
| [out] | baseline | Distance from the baseline to the bottom of the bounding box. |
References CvxText().
| void ReUseX::vision::osd::CvxText::putText | ( | cv::Mat & | img, |
| const std::string & | text, | ||
| cv::Point | org, | ||
| cv::Scalar | color, | ||
| int | font_size ) |
Render a UTF-8 string onto an OpenCV image.
| img | Destination image (modified in-place). |
| text | UTF-8 string to render. |
| org | Top-left drawing origin in image coordinates. |
| color | BGR text color. |
| font_size | Glyph height in pixels. |