ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
cvx_text.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <opencv2/opencv.hpp>
3
4
#include <map>
5
#include <string>
6
#include <vector>
7
8
// FreeType headers
9
#include <ft2build.h>
10
#include FT_FREETYPE_H
11
12
namespace
reusex::vision::osd
{
13
20
class
CvxText
{
21
public
:
26
explicit
CvxText
(
const
char
*font_path);
27
28
virtual
~CvxText
();
29
36
void
putText
(cv::Mat &img,
const
std::string &text, cv::Point org,
37
cv::Scalar color,
int
font_size);
38
47
void
getTextSize
(
const
std::string &text,
int
font_size,
int
*w,
int
*h,
48
int
*baseline);
49
50
private
:
51
CvxText
(
const
CvxText
&) =
delete
;
52
CvxText
&operator=(
const
CvxText
&) =
delete
;
53
55
FT_Face getFace(
const
char
*font_path);
56
58
void
utf8_to_ucs4(
const
std::string &str, std::vector<long> &ucs4);
59
60
private
:
61
FT_Library m_library;
62
std::map<std::string, FT_Face> m_faces;
63
};
64
65
}
// namespace reusex::vision::osd
reusex::vision::osd::CvxText::getTextSize
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.
reusex::vision::osd::CvxText::CvxText
CvxText(const char *font_path)
Load the primary font face from the given file path.
reusex::vision::osd::CvxText::~CvxText
virtual ~CvxText()
reusex::vision::osd::CvxText::putText
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.
reusex::vision::osd
Definition
cvx_text.hpp:12
libs
reusex
include
vision
osd
cvx_text.hpp
Generated by
1.17.0