Skip to content

Commit 9cc83bc

Browse files
committed
demos/cpp/common: add const to mat refs
1 parent 323be85 commit 9cc83bc

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

demos/common/cpp/monitors/include/monitors/presenter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class Presenter {
2727
cv::Size graphSize = {150, 60},
2828
std::size_t historySize = 20);
2929
void addRemoveMonitor(MonitorType monitor);
30-
void handleKey(int key); // handles c, d, m, h keys
31-
void drawGraphs(cv::Mat& frame);
30+
void handleKey(int key); // handles C, D, M, H keys
31+
void drawGraphs(const cv::Mat& frame);
3232
std::vector<std::string> reportMeans() const;
3333

3434
const int yPos;

demos/common/cpp/monitors/src/presenter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void Presenter::handleKey(int key) {
111111
}
112112
}
113113

114-
void Presenter::drawGraphs(cv::Mat& frame) {
114+
void Presenter::drawGraphs(const cv::Mat& frame) {
115115
const std::chrono::steady_clock::time_point curTimeStamp = std::chrono::steady_clock::now();
116116
if (curTimeStamp - prevTimeStamp >= std::chrono::milliseconds{1000}) {
117117
prevTimeStamp = curTimeStamp;

demos/common/cpp/utils/include/utils/grid_mat.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class GridMat {
7474
}
7575

7676
void update(const cv::Mat& frame, const size_t sourceID) {
77-
cv::Mat cell = outimg(cv::Rect(points[sourceID], cellSize));
77+
const cv::Mat& cell = outimg(cv::Rect(points[sourceID], cellSize));
7878

7979
if ((cellSize.width == frame.cols) && (cellSize.height == frame.rows)) {
8080
frame.copyTo(cell);

demos/common/cpp/utils/include/utils/performance_metrics.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PerformanceMetrics {
3737

3838
PerformanceMetrics(Duration timeWindow = std::chrono::seconds(1));
3939
void update(TimePoint lastRequestStartTime,
40-
cv::Mat& frame,
40+
const cv::Mat& frame,
4141
cv::Point position = {15, 30},
4242
int fontFace = cv::FONT_HERSHEY_COMPLEX,
4343
double fontScale = 0.75,
@@ -51,7 +51,7 @@ class PerformanceMetrics {
5151
/// @param fontScale font scale
5252
/// @param color font color
5353
/// @param thickness font thickness
54-
void paintMetrics(cv::Mat& frame,
54+
void paintMetrics(const cv::Mat& frame,
5555
cv::Point position = { 15, 30 },
5656
int fontFace = cv::FONT_HERSHEY_COMPLEX,
5757
double fontScale = 0.75,

demos/common/cpp/utils/src/performance_metrics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PerformanceMetrics::PerformanceMetrics(Duration timeWindow)
1313
{}
1414

1515
void PerformanceMetrics::update(TimePoint lastRequestStartTime,
16-
cv::Mat& frame,
16+
const cv::Mat& frame,
1717
cv::Point position,
1818
int fontFace,
1919
double fontScale,
@@ -45,7 +45,7 @@ void PerformanceMetrics::update(TimePoint lastRequestStartTime) {
4545
}
4646
}
4747

48-
void PerformanceMetrics::paintMetrics(cv::Mat & frame, cv::Point position, int fontFace,
48+
void PerformanceMetrics::paintMetrics(const cv::Mat& frame, cv::Point position, int fontFace,
4949
double fontScale, cv::Scalar color, int thickness, MetricTypes metricType) const {
5050
// Draw performance stats over frame
5151
Metrics metrics = getLast();

0 commit comments

Comments
 (0)