From: Tae-Young Chung Date: Tue, 28 May 2024 06:06:17 +0000 (+0900) Subject: Add _gesture_recognizer of HandGestureRecognizer to SmartPointer as a X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ecd619b8bc09a017d809090913a4a1fa5740d4b;p=platform%2Fcore%2Fapi%2Fsingleo.git Add _gesture_recognizer of HandGestureRecognizer to SmartPointer as a member variable Change-Id: I03a6e1af77db9b3e77d47b37716b6364266b49e0 Signed-off-by: Tae-Young Chung --- diff --git a/inference/include/SingleoInferenceTypes.h b/inference/include/SingleoInferenceTypes.h index 668af21..0334381 100644 --- a/inference/include/SingleoInferenceTypes.h +++ b/inference/include/SingleoInferenceTypes.h @@ -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 diff --git a/services/smart_pointer/CMakeLists.txt b/services/smart_pointer/CMakeLists.txt index 63cb629..c96f09b 100644 --- a/services/smart_pointer/CMakeLists.txt +++ b/services/smart_pointer/CMakeLists.txt @@ -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 index 0000000..f0f6493 --- /dev/null +++ b/services/smart_pointer/include/HandGestureRecognizer.h @@ -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 +#include "IInferenceHandGestureService.h" +#include "IInputService.h" +#include "SingleoInferenceTypes.h" + +namespace singleo +{ +namespace services +{ +namespace smartpointer +{ +class HandGestureRecognizer +{ +private: + std::unique_ptr _recognizer; + std::vector _tasks { inference::TaskType::HAND_GESTURE}; + +public: + explicit HandGestureRecognizer(input::InputConfigBase &config); + ~HandGestureRecognizer(); + int recognizeGesture(BaseDataType &input); + +}; +} // smartpointer +} // services +} // singleo + +#endif diff --git a/services/smart_pointer/include/SmartPointer.h b/services/smart_pointer/include/SmartPointer.h index 77e2034..a9c5a7e 100644 --- a/services/smart_pointer/include/SmartPointer.h +++ b/services/smart_pointer/include/SmartPointer.h @@ -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 _gaze_estimator; + std::unique_ptr _gesture_recognizer; std::unique_ptr _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 index 0000000..5ed6066 --- /dev/null +++ b/services/smart_pointer/src/HandGestureRecognizer.cpp @@ -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 diff --git a/services/smart_pointer/src/SmartPointer.cpp b/services/smart_pointer/src/SmartPointer.cpp index 0213bba..4baf0e6 100644 --- a/services/smart_pointer/src/SmartPointer.cpp +++ b/services/smart_pointer/src/SmartPointer.cpp @@ -38,6 +38,7 @@ REGISTER_SERVICE(SmartPointer) SmartPointer::SmartPointer(InputConfigBase& config) { _gaze_estimator = make_unique(config); + _gesture_recognizer = make_unique(config); if (config._input_feed_type == InputFeedType::CAMERA) { _data_feeder = make_unique(dynamic_cast(config)); _data_feeder->setUserCb(internalDataFeederCb, static_cast(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()");