--- /dev/null
+{
+ "files.associations": {
+ "*.tcc": "cpp",
+ "algorithm": "cpp",
+ "memory": "cpp",
+ "random": "cpp",
+ "fstream": "cpp",
+ "iosfwd": "cpp",
+ "iostream": "cpp",
+ "istream": "cpp",
+ "ostream": "cpp",
+ "sstream": "cpp",
+ "streambuf": "cpp",
+ "numeric": "cpp",
+ "*.txx": "cpp"
+ }
+}
\ No newline at end of file
BuildRequires: pkgconfig(facedetection)
BuildRequires: mediapipe-devel
BuildRequires: mediapipe-handsolution
+BuildRequires: pkgconfig(capi-ui-efl-util)
%define enable_autozoom_api 0
%define enable_smartpointer 1
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SINGLEO_SERVICE_SOURCE_FILES})
-TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include common/include ../capi/ ../input/include ../log/include ../inference/include ../common/include ${SERVICE_HEADER_LIST})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE opencv_imgcodecs opencv_calib3d singleo_log singleo_input ${SERVICE_LIBRARY_LIST})
+SET(dependents "capi-ui-efl-util")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${PROJECT_NAME}_DEP REQUIRED capi-ui-efl-util)
+
+TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PRIVATE include common/include ../capi/ ../input/include ../log/include ../inference/include ../common/include ${${PROJECT_NAME}_DEP_INCLUDE_DIRS} ${SERVICE_HEADER_LIST})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE opencv_imgcodecs opencv_calib3d singleo_log singleo_input ${${PROJECT_NAME}_DEP_LIBRARIES} ${SERVICE_LIBRARY_LIST} )
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
smart_pointer/src/FaceShapeModelManager.cpp
smart_pointer/src/HeadPoseEstimator.cpp
smart_pointer/src/CameraParamManager.cpp
+ smart_pointer/src/PointerFactory.cpp
+ smart_pointer/src/TizenPointer.cpp
)
LIST(APPEND SERVICE_LIBRARY_LIST singleo_inference)
\ 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 __SMART_POINTER_INTERFACE_POINTER_H_
+#define __SMART_POINTER_INTERFACE_POINTER_H_
+
+#include <memory>
+#include "PointerActionType.h"
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+
+class IPointer
+{
+public:
+ virtual ~IPointer() {};
+ virtual int sendMouseEvent(int x, int y, ActionType type) = 0;
+};
+} // smartpointer
+} // services
+} // 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.
+*/
+
+#ifndef __SMART_POINTER_POINTER_ACTION_TYPE_H_
+#define __SMART_POINTER_POINTER_ACTION_TYPE_H_
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+
+enum class ActionType
+{
+ POINTER_MOVE = 0
+};
+} // smartpointer
+} // services
+} // 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.
+*/
+
+#ifndef __SMART_POINTER_POINTER_FACTORY_H__
+#define __SMART_POINTER_POINTER_FACTORY_H__
+
+#include <memory>
+#include "IPointer.h"
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+
+class PointerFactory
+{
+public:
+ static std::unique_ptr<IPointer> createTizenPointer();
+};
+} // smartpointer
+} // services
+} // singleo
+
+#endif
\ No newline at end of file
#include "InputCamera.h"
#include "AsyncManager.h"
#include "SmartPointerDataType.h"
+#include "IPointer.h"
namespace singleo
{
SingleoInputManager _input_image_data;
PoseVector _head_pose;
PointerPosition _pointerPosition;
+ std::unique_ptr<IPointer> _pointer;
+ Point _cursor;
std::map<std::string, PoseAngle> _result_keys = { { "PITCH", PoseAngle::PITCH },
{ "YAW", PoseAngle::YAW },
{ "ROLL", PoseAngle::ROLL } };
--- /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 __SMART_POINTER_TIZEN_POINTER_H_
+#define __SMART_POINTER_TIZEN_POINTER_H_
+
+#include <memory>
+#include "IPointer.h"
+#include "PointerActionType.h"
+#include "efl_util.h"
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+
+class TizenPointer: public IPointer
+{
+private:
+ efl_util_inputgen_h _pointer;
+
+public:
+ TizenPointer();
+ virtual ~TizenPointer();
+
+ int sendMouseEvent(int x, int y, ActionType type) override;
+};
+} // smartpointer
+} // services
+} // 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 <memory>
+#include "PointerFactory.h"
+#include "TizenPointer.h"
+
+using namespace std;
+
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+unique_ptr<IPointer> PointerFactory::createTizenPointer()
+{
+ return make_unique<TizenPointer>();
+}
+}
+}
+}
\ No newline at end of file
#include "ImagePreprocessor.h"
#include "SmartPointer.h"
#include "GazeEstimator.h"
+#include "PointerFactory.h"
using namespace std;
using namespace singleo::input;
_async_mode = false;
+ _pointer = PointerFactory::createTizenPointer();
+ _cursor.x = 100;
+ _cursor.y = 100;
}
SmartPointer::~SmartPointer()
_data_feeder->capture(input_data);
preprocessor.update(input_data);
_head_pose = _gaze_estimator->estimateHeadpose(preprocessor.getData());
- auto gestureResult = _gesture_recognizer->recognizeGesture(preprocessor.getData());
+ // auto gestureResult = _gesture_recognizer->recognizeGesture(preprocessor.getData());
+ _pointer->sendMouseEvent(_cursor.x++ % 640, _cursor.y++ % 480, ActionType::POINTER_MOVE);
updateResult(_head_pose);
if (_user_cb) {
SINGLEO_LOGD("user callback in perform()");
_user_cb(input_data.ptr, input_data.width, input_data.height, input_data.byte_per_pixel,
static_cast<void *>(&(_pointerPosition.pose._rot_vec)),
- static_cast<void *>(&gestureResult));
+ nullptr /*static_cast<void *>(&gestureResult)*/);
}
}
--- /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 "TizenPointer.h"
+
+using namespace std;
+
+namespace singleo
+{
+namespace services
+{
+namespace smartpointer
+{
+TizenPointer::TizenPointer()
+{
+ _pointer = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_POINTER);
+}
+
+TizenPointer::~TizenPointer()
+{
+ efl_util_input_deinitialize_generator(_pointer);
+}
+
+int TizenPointer::sendMouseEvent(int x, int y, ActionType type)
+{
+ if (type == ActionType::POINTER_MOVE)
+ efl_util_input_generate_pointer(_pointer, 1, EFL_UTIL_INPUT_POINTER_MOVE, x, y);
+ return 0;
+}
+}
+}
+}
\ No newline at end of file
cv::Mat vizData;
cv::cvtColor(result, vizData, cv::COLOR_BGR2RGBA);
- string *gesture_str = static_cast<string *>(gesture);
- cv::putText(vizData, *gesture_str, cv::Point(30, 30), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 255, 0, 255), 2);
-
Point3f *dof3d = static_cast<Point3f *>(headPose);
-
cout << "[Pitch, Yaw, Roll]: [ " << dof3d->x << ", " << dof3d->y << ", " << dof3d->z << " ]" << endl;
- cout << "[Gesture Str]: " << *gesture_str << endl;
+
+ if (gesture) {
+ string *gesture_str = static_cast<string *>(gesture);
+ cv::putText(vizData, *gesture_str, cv::Point(30, 30), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 255, 0, 255), 2);
+ cout << "[Gesture Str]: " << *gesture_str << endl;
+ }
+
singleo_util_visualizer_2d(vizData, NULL);
}