-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetectordrawer.cpp
26 lines (22 loc) · 1.07 KB
/
detectordrawer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include "detectordrawer.h"
DetectorDrawer::DetectorDrawer(StringConv text, cv::Scalar textColor, cv::Scalar rectColor)
: Drawer(text, textColor, rectColor){}
DetectorDrawer::DetectorDrawer(const DetectorDrawer& dd) : Drawer(dd){}
void DetectorDrawer::drawFaces(cv::Mat& img, std::vector<cv::Rect>& faces) {
std::cout << "INFO: Отрисовка лиц на изображении" << std::endl;
for (auto face : faces) {
cv::Rect rect;
rect.x = face.x - 10;
rect.y = face.y - 10;
rect.width = face.width + 20;
rect.height = face.height + 20;
cv::rectangle(img, rect, getRectColor(), (int)face.width / 50);
}
std::cout << "SUCCESS: Отрисовка лиц завершена!" << std::endl;
}
void DetectorDrawer::setTextInImage(cv::Mat& img, cv::Point pt) {
std::cout << "INFO: Отрисовка текста на изображении" << std::endl;
cv::putText(img, this -> getText().cpp_str(), pt,
cv::FONT_HERSHEY_DUPLEX, img.rows / 500, this -> getTextColor(), 5);
}