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
// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
5
#pragma once
6
#include <opencv2/opencv.hpp>
7
8
#include <map>
9
#include <string>
10
#include <vector>
11
12
// FreeType headers
13
#include <ft2build.h>
14
#include FT_FREETYPE_H
15
16
namespace
reusex::vision::osd
{
17
24
class
CvxText
{
25
public
:
30
explicit
CvxText
(
const
char
*font_path);
31
32
virtual
~CvxText
();
33
40
void
putText
(cv::Mat &img,
const
std::string &text, cv::Point org,
41
cv::Scalar color,
int
font_size);
42
51
void
getTextSize
(
const
std::string &text,
int
font_size,
int
*w,
int
*h,
52
int
*baseline);
53
54
private
:
55
CvxText
(
const
CvxText
&) =
delete
;
56
CvxText
&operator=(
const
CvxText
&) =
delete
;
57
59
FT_Face getFace(
const
char
*font_path);
60
62
void
utf8_to_ucs4(
const
std::string &str, std::vector<long> &ucs4);
63
64
private
:
65
FT_Library m_library;
66
std::map<std::string, FT_Face> m_faces;
67
};
68
69
}
// 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:16
libs
reusex
include
vision
osd
cvx_text.hpp
Generated by
1.17.0