Commit b7e7e1d4 authored by Stan Sidel's avatar Stan Sidel

Added white rectangles to settings texts. Issue #10

parent 2c6170cb
......@@ -116,18 +116,33 @@ void FrameProcessor::AddSettingsToImage(cv::Mat& image) const {
void PutMultilineText(const std::string& text, cv::Mat& image) {
std::stringstream ss(text);
std::string temp;
int y = 30;
const int dy = 15;
const int minX = 15;
const int fontFace = cv::FONT_HERSHEY_COMPLEX_SMALL;
const double fontScale = 0.8;
const int fontThickness = 1;
const int margin = 5;
int y = 15;
while (std::getline(ss, temp, '\n')) {
int baseline = 0;
cv::Size textSize = cv::getTextSize(temp, fontFace, fontScale, fontThickness, &baseline);
y += textSize.height;
cv::rectangle(
image,
cv::Point(minX, y - textSize.height),
cv::Point(minX + textSize.width, y),
cv::Scalar(255, 255, 255),
cv::FILLED
);
cv::putText(
image,
temp,
cv::Point(15, y),
cv::FONT_HERSHEY_COMPLEX_SMALL,
0.8,
cv::Scalar(100, 100, 100)
);
y += dy;
cv::Point(minX, y),
fontFace,
fontScale,
cv::Scalar(100, 100, 100),
fontThickness
);
y += margin;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment