Internal change
PiperOrigin-RevId: 477863040
This commit is contained in:
committed by
Sebastian Schmidt
parent
e7acc0a857
commit
8af4cca413
@@ -552,6 +552,16 @@ void AnnotationRenderer::DrawText(const RenderAnnotation& annotation) {
|
||||
origin.y += text_size.height / 2;
|
||||
}
|
||||
|
||||
if (text.outline_thickness() > 0.0) {
|
||||
const int background_thickness = ClampThickness(
|
||||
round((annotation.thickness() + 2.0 * text.outline_thickness()) *
|
||||
scale_factor_));
|
||||
const cv::Scalar outline_color =
|
||||
MediapipeColorToOpenCVColor(text.outline_color());
|
||||
cv::putText(mat_image_, text.display_text(), origin, font_face, font_scale,
|
||||
outline_color, background_thickness, /*lineType=*/8,
|
||||
/*bottomLeftOrigin=*/flip_text_vertically_);
|
||||
}
|
||||
cv::putText(mat_image_, text.display_text(), origin, font_face, font_scale,
|
||||
color, thickness, /*lineType=*/8,
|
||||
/*bottomLeftOrigin=*/flip_text_vertically_);
|
||||
|
||||
@@ -168,6 +168,12 @@ message RenderAnnotation {
|
||||
// [left, baseline] represent [center_x, center_y].
|
||||
optional bool center_horizontally = 7 [default = false];
|
||||
optional bool center_vertically = 8 [default = false];
|
||||
|
||||
// Thickness of the text outline.
|
||||
optional double outline_thickness = 11 [default = 0.0];
|
||||
|
||||
// Color of the text outline.
|
||||
optional Color outline_color = 12;
|
||||
}
|
||||
|
||||
// The RenderAnnotation can be one of the below formats.
|
||||
|
||||
Reference in New Issue
Block a user