#include <stdexcept>
#include "MvFaceDetectionTask.h"
+#include "SingleoTimer.h"
using namespace std;
{
SINGLEO_LOGD("MvFaceDetectionTask::handle()");
+ Timer timer;
int ret = mv_source_fill_by_buffer(_mv_src, data, width * height * byte_per_pixel, width,
height, MEDIA_VISION_COLORSPACE_RGB888);
if (ret != MEDIA_VISION_ERROR_NONE)
result._rects.push_back(rect);
SINGLEO_LOGD("idx[%2zd]: (%3zd, %3zd, %3zd, %3zd)", idx, rect.left, rect.top, rect.right, rect.bottom);
}
+ SINGLEO_LOGD("MvFaceDectectionTask::handle() takes %d ms", timer.check_ms());
result = MvFaceTaskManager::handle(data, width, height, byte_per_pixel, result);
-
return result;
}
#include <stdexcept>
#include <opencv2/core.hpp>
#include "MvFaceLandmarkDetectionTask.h"
+#include "SingleoTimer.h"
using namespace std;
{
SINGLEO_LOGD("MvFaceLandmarkDetectionTask::handle()");
+ Timer timer;
cv::Mat cvData(cv::Size(width, height), CV_MAKE_TYPE(CV_8U, byte_per_pixel), data);
cv::Mat roiCvData;
result = MvFaceTaskManager::handle(data, width, height, byte_per_pixel, result);
}
}
+ SINGLEO_LOGD("MvFaceLandmarkDetectionTask::handle() takes %d ms", timer.check_ms());
return result;
}
--- /dev/null
+/**
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SINGLEO_TIME_H__
+#define __SINGLEO_TIME_H__
+
+#include <chrono>
+
+using namespace std;
+
+class Timer {
+private:
+ chrono::system_clock::time_point _start;
+
+public:
+ Timer() {
+ _start = chrono::system_clock::now();
+ }
+ void reset() {
+ _start = chrono::system_clock::now();
+ }
+ int64_t check_ms() {
+ return chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now() - _start).count();
+ }
+};
+#endif