Add IInferenceHandGestureService and its PrivateInferenceHandGestureService
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 28 May 2024 05:15:06 +0000 (14:15 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 28 May 2024 05:16:02 +0000 (14:16 +0900)
PrivateInferenceHandGestureService has a dummy implementation.
MvInferenceHandGestureService isn't implemented and
createInferenceHandGestureService() will throw runtime_error.

Change-Id: If34b238424a1417590c85068f71129c6410f40a1
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
inference/backends/CMakeLists.txt
inference/backends/private/include/PrivateInferenceHandGestureService.h [new file with mode: 0644]
inference/backends/private/src/PrivateInferenceHandGestureService.cpp [new file with mode: 0644]
inference/include/HandGestureResult.h [new file with mode: 0644]
inference/include/IInferenceHandGestureService.h [new file with mode: 0644]
inference/include/IInferenceServiceFactory.h
inference/include/MvInferenceServiceFactory.h
inference/include/PrivateInferenceServiceFactory.h
inference/src/MvInferenceServiceFactory.cpp
inference/src/PrivateInferenceServiceFactory.cpp
packaging/singleo.spec

index d91f00c7d998c1b5a37f46baef81d7d18f346b5d..47ad6c104827933686bf2010347d65f0ced892b0 100644 (file)
@@ -11,7 +11,7 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${BACKEND_SOURCE_FILES})
 FIND_PACKAGE(PkgConfig REQUIRED)
 PKG_CHECK_MODULES(${PROJECT_NAME}_DEP REQUIRED capi-media-vision opencv facedetection)
 
-TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ../include ../../common/include ../../log/include mediavision/include /usr/include/media private/include /usr/include/facedetection)
+TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE ../include ../../common/include ../../log/include mediavision/include /usr/include/media private/include /usr/include/facedetection /usr/include/mediapipe)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE mv_common singleo_log ${${PROJECT_NAME}_DEP_LIBRARIES} )
 
 # Install the library  
diff --git a/inference/backends/private/include/PrivateInferenceHandGestureService.h b/inference/backends/private/include/PrivateInferenceHandGestureService.h
new file mode 100644 (file)
index 0000000..0cbf65f
--- /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 __PRIVATE_INFERENCE_HAND_GESTURE_SERVICE_H__
+#define __PRIVATE_INFERENCE_HAND_GESTURE_SERVICE_H__
+
+#include <memory>
+#include <vector>
+#include <opencv2/core.hpp>
+#include "IInferenceHandGestureService.h"
+
+namespace singleo
+{
+namespace inference
+{
+class PrivateInferenceHandGestureService : public IInferenceHandGestureService
+{
+private:    
+    
+       HandGestureResult _result;
+
+public:
+       PrivateInferenceHandGestureService(std::vector<inference::TaskType> &tasks);
+       virtual ~PrivateInferenceHandGestureService();
+       void configure() override;
+       void prepare() override;
+       void invoke(BaseDataType &input) override;
+       HandGestureResult &result() override;
+};
+
+} // inference
+} // singleo
+
+#endif
\ No newline at end of file
diff --git a/inference/backends/private/src/PrivateInferenceHandGestureService.cpp b/inference/backends/private/src/PrivateInferenceHandGestureService.cpp
new file mode 100644 (file)
index 0000000..9ed71fd
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * 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 "SingleoLog.h"
+#include "PrivateInferenceHandGestureService.h"
+#include "SingleoTimer.h"
+
+#include <opencv2/core.hpp>
+#include <opencv2/imgcodecs.hpp>
+#include <opencv2/imgproc.hpp>
+#include "IHand.h"
+
+using namespace std;
+#define DETECT_BUFFER_SIZE 0x9000
+namespace singleo
+{
+namespace inference
+{
+
+
+PrivateInferenceHandGestureService::PrivateInferenceHandGestureService(std::vector<inference::TaskType> &tasks)
+{
+    
+}
+
+PrivateInferenceHandGestureService::~PrivateInferenceHandGestureService()
+{
+
+}
+
+void PrivateInferenceHandGestureService::configure()
+{
+
+}
+
+void PrivateInferenceHandGestureService::prepare()
+{
+    
+}
+
+void PrivateInferenceHandGestureService::invoke(BaseDataType &input)
+{
+
+}
+
+HandGestureResult& PrivateInferenceHandGestureService::result()
+{
+    return _result;
+}
+} // inference
+} // singleo
\ No newline at end of file
diff --git a/inference/include/HandGestureResult.h b/inference/include/HandGestureResult.h
new file mode 100644 (file)
index 0000000..272ac5e
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * 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 __INFERENCE_SERVICE_HAND_GESTURE_RESULT_H__
+#define __INFERENCE_SERVICE_HAND_GESTURE_RESULT_H__
+
+#include "SingleoCommonTypes.h"
+
+namespace singleo
+{
+namespace inference
+{
+using Points = std::vector<Point>;
+struct HandGestureResult {
+    unsigned int _frame_number {};
+    int _gestureId;
+};
+} // inference
+} // singleo
+
+#endif
diff --git a/inference/include/IInferenceHandGestureService.h b/inference/include/IInferenceHandGestureService.h
new file mode 100644 (file)
index 0000000..92ebeb4
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * 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 __IINFERENCE_HAND_GESTURE_SERVICE_H__
+#define __IINFERENCE_HAND_GESTURE_SERVICE_H__
+
+#include "HandGestureResult.h"
+#include "SingleoInferenceTypes.h"
+#include "FaceShapeComponents.h"
+
+namespace singleo
+{
+namespace inference
+{
+class IInferenceHandGestureService
+{
+public:
+       virtual ~IInferenceHandGestureService() {};
+
+       virtual void configure() = 0;
+       virtual void prepare() = 0;
+       virtual void invoke(BaseDataType &input) = 0;
+       virtual HandGestureResult &result() = 0;
+};
+
+} // inference
+} // singleo
+
+#endif
\ No newline at end of file
index b24cad3399420f445d803f12e387866ac9841972..082d3c505d9f066c86da82238f17a7aed5439754 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <memory>
 #include "IInferenceFaceService.h"
+#include "IInferenceHandGestureService.h"
 #include "SingleoInferenceTypes.h"
 
 namespace singleo
@@ -29,6 +30,7 @@ class IInferenceServiceFactory
 {
 public:
        virtual std::unique_ptr<IInferenceFaceService> createInferenceFaceService(std::vector<inference::TaskType> &tasks) = 0;
+       virtual std::unique_ptr<IInferenceHandGestureService> createInferenceHandGestureService(std::vector<inference::TaskType> &tasks) = 0;
 };
 
 } // inference
index 1db0e997d45bc7ead89a57f13cfa2a89e67f9767..c09ee6fa66fe7bf17251ddd41a7678e02a24df7b 100644 (file)
@@ -27,6 +27,7 @@ class MvInferenceServiceFactory : public IInferenceServiceFactory
 {
 public:
        std::unique_ptr<IInferenceFaceService> createInferenceFaceService(std::vector<inference::TaskType> &tasks) override;
+       std::unique_ptr<IInferenceHandGestureService> createInferenceHandGestureService(std::vector<inference::TaskType> &tasks) override;
 };
 
 } // inference
index c07503b33e17c10a30d2665b0435bf44abb9130b..aba7499e49fecf6fa04247d6b3c4c078718f15ba 100644 (file)
@@ -27,6 +27,7 @@ class PrivateInferenceServiceFactory : public IInferenceServiceFactory
 {
 public:
        std::unique_ptr<IInferenceFaceService> createInferenceFaceService(std::vector<inference::TaskType> &tasks) override;
+       std::unique_ptr<IInferenceHandGestureService> createInferenceHandGestureService(std::vector<inference::TaskType> &tasks) override;
 };
 
 } // inference
index b7f2967ee6c5b68561e37be5e87f901aea582115..225b8f988e80f8917760cb1648af3e39e8b76756 100644 (file)
@@ -27,5 +27,9 @@ unique_ptr<IInferenceFaceService> MvInferenceServiceFactory::createInferenceFace
 {
     return make_unique<MvInferenceFaceService>(tasks);
 }
+unique_ptr<IInferenceHandGestureService> MvInferenceServiceFactory::createInferenceHandGestureService(std::vector<inference::TaskType> &tasks)
+{
+    throw runtime_error("Not implemented");
+}
 } // inference
 } // singleo
\ No newline at end of file
index 906d716f031dee1b77a563e9b84f96567e7616fa..c456d71294fd6363b1f527abfd5a493fba036f87 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "PrivateInferenceServiceFactory.h"
 #include "PrivateInferenceFaceService.h"
+#include "PrivateInferenceHandGestureService.h"
 
 using namespace std;
 
@@ -27,5 +28,9 @@ unique_ptr<IInferenceFaceService> PrivateInferenceServiceFactory::createInferenc
 {
     return make_unique<PrivateInferenceFaceService>(tasks);
 }
+unique_ptr<IInferenceHandGestureService> PrivateInferenceServiceFactory::createInferenceHandGestureService(std::vector<inference::TaskType> &tasks)
+{
+    return make_unique<PrivateInferenceHandGestureService>(tasks);
+}
 } // inference
 } // singleo
\ No newline at end of file
index 40b90f29539bf76b03e64e7422861a51750e4109..54ff2793d9dce15c86e119e5b01eb305bc6e0b41 100644 (file)
@@ -18,6 +18,8 @@ BuildRequires: pkgconfig(protobuf)
 BuildRequires: pkgconfig(grpc++)
 BuildRequires: pkgconfig(re2)
 BuildRequires: pkgconfig(facedetection)
+BuildRequires: mediapipe-devel
+# BuildRequires: mediapipe-image-segmentation
 
 %define enable_autozoom_api 0
 %define enable_smartpointer 1