--- /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 __MV_INFERENCE_FACE_SERVICE_H__
+#define __MV_INFERENCE_FACE_SERVICE_H__
+
+#include <memory>
+#include "IInferenceFaceService.h"
+#include "MvFaceTaskManager.h"
+
+using namespace singleo::inference::backends;
+
+namespace singleo
+{
+namespace inference
+{
+class MvInferenceFaceService : public IInferenceFaceService
+{
+private:
+ std::shared_ptr<MvFaceTaskManager> _taskManager;
+ FaceResult _result;
+
+public:
+ MvInferenceFaceService(std::vector<inference::TaskType> &tasks);
+ virtual ~MvInferenceFaceService() {};
+ void configure() override;
+ void prepare() override;
+ void invoke(BaseDataType &input) override;
+ FaceResult &result() override;
+};
+
+} // inference
+} // singleo
+
+#endif
\ No newline at end of file
--- /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.
+ */
+
+#include "SingleoCommonTypes.h"
+#include "MvInferenceFaceService.h"
+#include "MvFaceDetectionTask.h"
+#include "MvFaceLandmarkDetectionTask.h"
+#include <opencv2/core.hpp>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/imgproc.hpp>
+
+using namespace std;
+
+namespace singleo
+{
+namespace inference
+{
+MvInferenceFaceService::MvInferenceFaceService(std::vector<inference::TaskType> &tasks)
+{
+ for (auto &task : tasks) {
+ switch (task) {
+ case TaskType::FACE_DETECTION:
+ {
+ if (_taskManager.use_count() > 0)
+ _taskManager->setNext(std::make_shared<MvFaceDetectionTask>());
+ else
+ _taskManager = std::make_shared<MvFaceDetectionTask>();
+ }
+ break;
+ case TaskType::FACE_LANDMARK_DETECTION:
+ {
+ if (_taskManager.use_count() > 0)
+ _taskManager->setNext(std::make_shared<MvFaceLandmarkDetectionTask>());
+ else
+ _taskManager = std::make_shared<MvFaceLandmarkDetectionTask>();
+ }
+ break;
+ default:
+ SINGLEO_LOGE("Not supported task type %d", tasks[0]);
+ break;
+ }
+ }
+}
+
+void MvInferenceFaceService::configure()
+{
+
+}
+
+void MvInferenceFaceService::prepare()
+{
+
+}
+
+void MvInferenceFaceService::invoke(BaseDataType &input)
+{
+ if (input._data_type != DataType::IMAGE) {
+ SINGLEO_LOGE("Invalid input type.");
+ throw invalid_argument("Input type not support.");
+ }
+
+ ImageDataType &data = dynamic_cast<ImageDataType &>(input);
+ _result = _taskManager->handle(data.ptr, data.width, data.height, data.byte_per_pixel, _result);
+
+ cv::Mat _dump(cv::Size(data.width, data.height),CV_MAKE_TYPE(CV_8U, data.byte_per_pixel), data.ptr);
+
+ int id = 0;
+ for (auto &rect : _result._rects) {
+ cv::rectangle(_dump, cv::Rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), cv::Scalar(0, 255, 0), 2);
+ auto &points = _result._landmarks[id];
+ for (auto &point : points)
+ cv::circle(_dump, cv::Point(point.x, point.y), 2, cv::Scalar(255, 255, 0), 2);
+ id++;
+ }
+
+ cv::cvtColor(_dump, _dump, cv::COLOR_RGB2BGR);
+ cv::imwrite("dump_face.jpg",_dump);
+}
+
+FaceResult& MvInferenceFaceService::result()
+{
+ return _result;
+}
+} // inference
+} // singleo
\ No newline at end of file
+++ /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 __MV_INFERENCE_FACE_SERVICE_H__
-#define __MV_INFERENCE_FACE_SERVICE_H__
-
-#include <memory>
-#include "IInferenceFaceService.h"
-#include "MvFaceTaskManager.h"
-
-using namespace singleo::inference::backends;
-
-namespace singleo
-{
-namespace inference
-{
-class MvInferenceFaceService : public IInferenceFaceService
-{
-private:
- std::shared_ptr<MvFaceTaskManager> _taskManager;
- FaceResult _result;
-
-public:
- MvInferenceFaceService(std::vector<inference::TaskType> &tasks);
- virtual ~MvInferenceFaceService() {};
- void configure() override;
- void prepare() override;
- void invoke(BaseDataType &input) override;
- FaceResult &result() override;
-};
-
-} // inference
-} // singleo
-
-#endif
\ No newline at end of file
+++ /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.
- */
-
-#include "SingleoCommonTypes.h"
-#include "MvInferenceFaceService.h"
-#include "MvFaceDetectionTask.h"
-#include "MvFaceLandmarkDetectionTask.h"
-#include <opencv2/core.hpp>
-#include <opencv2/imgcodecs.hpp>
-#include <opencv2/imgproc.hpp>
-
-using namespace std;
-
-namespace singleo
-{
-namespace inference
-{
-MvInferenceFaceService::MvInferenceFaceService(std::vector<inference::TaskType> &tasks)
-{
- for (auto &task : tasks) {
- switch (task) {
- case TaskType::FACE_DETECTION:
- {
- if (_taskManager.use_count() > 0)
- _taskManager->setNext(std::make_shared<MvFaceDetectionTask>());
- else
- _taskManager = std::make_shared<MvFaceDetectionTask>();
- }
- break;
- case TaskType::FACE_LANDMARK_DETECTION:
- {
- if (_taskManager.use_count() > 0)
- _taskManager->setNext(std::make_shared<MvFaceLandmarkDetectionTask>());
- else
- _taskManager = std::make_shared<MvFaceLandmarkDetectionTask>();
- }
- break;
- default:
- SINGLEO_LOGE("Not supported task type %d", tasks[0]);
- break;
- }
- }
-}
-
-void MvInferenceFaceService::configure()
-{
-
-}
-
-void MvInferenceFaceService::prepare()
-{
-
-}
-
-void MvInferenceFaceService::invoke(BaseDataType &input)
-{
- if (input._data_type != DataType::IMAGE) {
- SINGLEO_LOGE("Invalid input type.");
- throw invalid_argument("Input type not support.");
- }
-
- ImageDataType &data = dynamic_cast<ImageDataType &>(input);
- _result = _taskManager->handle(data.ptr, data.width, data.height, data.byte_per_pixel, _result);
-
- cv::Mat _dump(cv::Size(data.width, data.height),CV_MAKE_TYPE(CV_8U, data.byte_per_pixel), data.ptr);
-
- int id = 0;
- for (auto &rect : _result._rects) {
- cv::rectangle(_dump, cv::Rect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top), cv::Scalar(0, 255, 0), 2);
- auto &points = _result._landmarks[id];
- for (auto &point : points)
- cv::circle(_dump, cv::Point(point.x, point.y), 2, cv::Scalar(255, 255, 0), 2);
- id++;
- }
-
- cv::cvtColor(_dump, _dump, cv::COLOR_RGB2BGR);
- cv::imwrite("dump_face.jpg",_dump);
-}
-
-FaceResult& MvInferenceFaceService::result()
-{
- return _result;
-}
-} // inference
-} // singleo
\ No newline at end of file