Add _gesture_recognizer of HandGestureRecognizer to SmartPointer as a
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 28 May 2024 06:06:17 +0000 (15:06 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 28 May 2024 06:07:21 +0000 (15:07 +0900)
member variable

Change-Id: I03a6e1af77db9b3e77d47b37716b6364266b49e0
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
inference/include/SingleoInferenceTypes.h
services/smart_pointer/CMakeLists.txt
services/smart_pointer/include/HandGestureRecognizer.h [new file with mode: 0644]
services/smart_pointer/include/SmartPointer.h
services/smart_pointer/src/HandGestureRecognizer.cpp [new file with mode: 0644]
services/smart_pointer/src/SmartPointer.cpp

index 668af21213a6545d14a48f32372d8654bc8ca98a..03343817c8d5fa2e6073eca9aa0babee6993f6d6 100644 (file)
@@ -23,7 +23,7 @@ namespace singleo
 {
 namespace inference
 {
-enum class TaskType { NONE, IMAGE_CLASSIFICATION, OBJECT_DETECTION, FACE_DETECTION, FACE_LANDMARK_DETECTION };
+enum class TaskType { NONE, IMAGE_CLASSIFICATION, OBJECT_DETECTION, FACE_DETECTION, FACE_LANDMARK_DETECTION, HAND_GESTURE};
 
 } // inference
 } // singleo
index 63cb629cb81d27a91047b3dda51affd469949d11..c96f09b758d4dee2753520172b1d264984126691 100644 (file)
@@ -2,6 +2,7 @@ SET(SINGLEO_SERVICE_SOURCE_FILES
     ${SINGLEO_SERVICE_SOURCE_FILES}
     smart_pointer/src/SmartPointer.cpp
     smart_pointer/src/GazeEstimator.cpp
+    smart_pointer/src/HandGestureRecognizer.cpp
     smart_pointer/src/FaceShapeModelManager.cpp
     smart_pointer/src/HeadPoseEstimator.cpp
     smart_pointer/src/CameraParamManager.cpp
diff --git a/services/smart_pointer/include/HandGestureRecognizer.h b/services/smart_pointer/include/HandGestureRecognizer.h
new file mode 100644 (file)
index 0000000..f0f6493
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+ * 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 __HAND_GESTURE_RECOGNIZER_H__
+#define __HAND_GESTURE_RECOGNIZER_H__
+
+#include <memory>
+#include "IInferenceHandGestureService.h"
+#include "IInputService.h"
+#include "SingleoInferenceTypes.h"
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+class HandGestureRecognizer
+{
+private:
+    std::unique_ptr<singleo::inference::IInferenceHandGestureService> _recognizer;
+    std::vector<inference::TaskType> _tasks { inference::TaskType::HAND_GESTURE};
+
+public:
+    explicit HandGestureRecognizer(input::InputConfigBase &config);
+    ~HandGestureRecognizer();
+    int recognizeGesture(BaseDataType &input);
+
+};
+} // smartpointer
+} // services 
+} // singleo
+
+#endif
index 77e203421e7a66e1d828a58d0e2e963578847342..a9c5a7ee116f01c3cbc022c8976dcb9decdcbe4f 100644 (file)
@@ -22,6 +22,7 @@
 #include "InputTypes.h"
 #include "SingleoInputManager.h"
 #include "GazeEstimator.h"
+#include "HandGestureRecognizer.h"
 #include "InputCamera.h"
 #include "AsyncManager.h"
 #include "SmartPointerDataType.h"
@@ -36,6 +37,7 @@ class SmartPointer : public IService
 {
 private:
     std::unique_ptr<GazeEstimator> _gaze_estimator;
+       std::unique_ptr<HandGestureRecognizer> _gesture_recognizer;
        std::unique_ptr<singleo::input::IInputService> _data_feeder;
     SingleoInputManager _input_image_data;
     PoseVector _head_pose;
diff --git a/services/smart_pointer/src/HandGestureRecognizer.cpp b/services/smart_pointer/src/HandGestureRecognizer.cpp
new file mode 100644 (file)
index 0000000..5ed6066
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+ * 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 "HandGestureRecognizer.h"
+#include "PrivateInferenceServiceFactory.h"
+#include "InputCamera.h"
+#include "SingleoLog.h"
+
+
+using namespace std;
+using namespace singleo::inference;
+using namespace singleo::input;
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+HandGestureRecognizer::HandGestureRecognizer(InputConfigBase& config)
+{
+    // MvInferenceServiceFactory factory;
+    PrivateInferenceServiceFactory factory;
+    _recognizer = factory.createInferenceHandGestureService(_tasks);
+
+    _recognizer->configure();
+       _recognizer->prepare();
+}
+
+HandGestureRecognizer::~HandGestureRecognizer()
+{
+
+}
+
+int HandGestureRecognizer::recognizeGesture(BaseDataType &input)
+{
+    SINGLEO_LOGD("HandGestureRecognizer->recognizeGesture");
+    return -1;
+    //  _recognizer->invoke(input);
+    //  auto &result = _recognizer->result();
+}
+
+} // smartpointer
+} // services
+} // singleo
index 0213bbacc9dbd39d1f9c906cf70dc6639162fe4f..4baf0e6274fb3fa45d41c6fd0ad55e0e21082240 100644 (file)
@@ -38,6 +38,7 @@ REGISTER_SERVICE(SmartPointer)
 SmartPointer::SmartPointer(InputConfigBase& config)
 {
     _gaze_estimator = make_unique<GazeEstimator>(config);
+       _gesture_recognizer = make_unique<HandGestureRecognizer>(config);
        if (config._input_feed_type == InputFeedType::CAMERA) {
                _data_feeder = make_unique<InputCamera>(dynamic_cast<CameraConfig &>(config));
                _data_feeder->setUserCb(internalDataFeederCb, static_cast<void *>(this));
@@ -111,6 +112,8 @@ void SmartPointer::perform()
                _data_feeder->capture(input_data);
                preprocessor.update(input_data);
                _head_pose = _gaze_estimator->estimateHeadpose(preprocessor.getData());
+               auto gestureResult = _gesture_recognizer->recognizeGesture(preprocessor.getData());
+
                updateResult(_head_pose);
                if (_user_cb) {
                        SINGLEO_LOGD("user callback in perform()");