summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2020-09-14 17:07:16 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2020-09-16 09:43:03 +0900
commitb1f4fc0688cb3c64d6fd71bdb7e556406a37b02d (patch)
tree94fc5283ffe3409ec98168c66de6fc21b833fca3
parent1f638e0f656a1058eb594c2efc2d5c1fc01aafbc (diff)
downloadmediavision-b1f4fc0688cb3c64d6fd71bdb7e556406a37b02d.tar.gz
mediavision-b1f4fc0688cb3c64d6fd71bdb7e556406a37b02d.tar.bz2
mediavision-b1f4fc0688cb3c64d6fd71bdb7e556406a37b02d.zip
Remove label parameter from mv_inference_pose_landmark_detected_cb
and add mv_inference_pose_get_label() In the callback, the label paramter is a type of integer which is for only one pose. But, depending on models, it can detect multi poses and provide multi labels for corresponding poses. So, remove the parameter. Instead, provide new api mv_inference_pose_get_label(). Change-Id: Ifa1aa2d1c3782c6cefc58560eb08226189a449ea Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r--include/mv_inference.h28
-rw-r--r--mv_inference/inference/include/mv_inference_open.h24
-rw-r--r--mv_inference/inference/src/Posture.cpp1
-rw-r--r--mv_inference/inference/src/mv_inference.c22
-rw-r--r--mv_inference/inference/src/mv_inference_open.cpp19
-rw-r--r--packaging/capi-media-vision.spec2
-rw-r--r--test/testsuites/inference/inference_test_suite.c2
7 files changed, 90 insertions, 8 deletions
diff --git a/include/mv_inference.h b/include/mv_inference.h
index 5edb09e9..2d674bbd 100644
--- a/include/mv_inference.h
+++ b/include/mv_inference.h
@@ -693,9 +693,6 @@ int mv_inference_facial_landmark_detect(
* It should be released by calling mv_destroy_source()
* when it's not needed anymore.
* @param[in] locations Locations of the detected pose landmarks.
- * @param[in] label Label indicating pose of the landmark. If a label is provided by
- * a model, a value larger than or equal to 0 is provided.
- * Otherwise, -1 is provided.
* @param[in] user_data The user data passed from callback invoking code
*
* @see mv_inference_pose_landmark_detect()
@@ -703,7 +700,6 @@ int mv_inference_facial_landmark_detect(
typedef void (*mv_inference_pose_landmark_detected_cb)(
mv_source_h source,
mv_inference_pose_result_h locations,
- int label,
void *user_data);
/**
@@ -814,6 +810,30 @@ int mv_inference_pose_get_landmark(
mv_inference_pose_result_h result, int pose_index, int pose_part, mv_point_s *location, float *score);
/**
+ * @brief Gets a label of a pose.
+ *
+ * @since_tizen 6.0
+ *
+ * @param[in] result The handle to inference result
+ * @param[in] pose_index The pose index between 0 and
+ * the number of poses which can be gotten by
+ * mv_inference_pose_get_number_of_poses()
+ * @param[in,out] label The label of a pose
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see mv_inference_pose_get_number_of_poses()
+ * @see mv_inference_pose_get_number_of_landmarks()
+ * @see mv_inference_pose_landmark_detected_cb()
+ * @see mv_inference_pose_result_h
+ */
+int mv_inference_pose_get_label(
+ mv_inference_pose_result_h result, int pose_index, int *label);
+
+/**
* @brief Creates pose handle.
* @details Use this function to create a pose.
*
diff --git a/mv_inference/inference/include/mv_inference_open.h b/mv_inference/inference/include/mv_inference_open.h
index e72aaa26..215217e2 100644
--- a/mv_inference/inference/include/mv_inference_open.h
+++ b/mv_inference/inference/include/mv_inference_open.h
@@ -584,6 +584,30 @@ int mv_inference_pose_get_landmark_open(
mv_inference_pose_result_h result, int pose_index, int part_index, mv_point_s *location, float *score);
/**
+ * @brief Gets a label of a pose.
+ *
+ * @since_tizen 6.0
+ *
+ * @param[in] result The handle to inference result
+ * @param[in] pose_index The pose index between 0 and
+ * the number of poses which can be gotten by
+ * mv_inference_pose_get_number_of_poses()
+ * @param[in,out] label The label of a pose
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see mv_inference_pose_get_number_of_poses()
+ * @see mv_inference_pose_get_number_of_landmarks()
+ * @see mv_inference_pose_landmark_detected_cb()
+ * @see mv_inference_pose_result_h
+ */
+ int mv_inference_pose_get_label_open(
+ mv_inference_pose_result_h result, int pose_index, int *label);
+
+ /**
* @brief Creates pose handle.
* @details Use this function to create a pose.
*
diff --git a/mv_inference/inference/src/Posture.cpp b/mv_inference/inference/src/Posture.cpp
index 3fd54d35..065bd29b 100644
--- a/mv_inference/inference/src/Posture.cpp
+++ b/mv_inference/inference/src/Posture.cpp
@@ -337,7 +337,6 @@ float Posture::getSimilarity(int parts,
LOGD("score: %1.3f", score);
return score;
-
}
int Posture::compare(int parts, std::vector<std::pair<bool, cv::Point>> action, float* score)
diff --git a/mv_inference/inference/src/mv_inference.c b/mv_inference/inference/src/mv_inference.c
index 7f7eb935..c161138d 100644
--- a/mv_inference/inference/src/mv_inference.c
+++ b/mv_inference/inference/src/mv_inference.c
@@ -415,6 +415,28 @@ int mv_inference_pose_get_landmark(mv_inference_pose_result_h result,
return ret;
}
+int mv_inference_pose_get_label(mv_inference_pose_result_h result, int pose_index, int *label)
+{
+ MEDIA_VISION_SUPPORT_CHECK(
+ __mv_inference_check_system_info_feature_supported());
+ MEDIA_VISION_INSTANCE_CHECK(result);
+
+ MEDIA_VISION_NULL_ARG_CHECK(label);
+
+ if (pose_index < 0)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ int ret = MEDIA_VISION_ERROR_NONE;
+
+ ret = mv_inference_pose_get_label_open(result, pose_index, label);
+
+ MEDIA_VISION_FUNCTION_LEAVE();
+
+ return ret;
+}
+
int mv_pose_create(mv_pose_h *pose)
{
diff --git a/mv_inference/inference/src/mv_inference_open.cpp b/mv_inference/inference/src/mv_inference_open.cpp
index 514f630a..9a645555 100644
--- a/mv_inference/inference/src/mv_inference_open.cpp
+++ b/mv_inference/inference/src/mv_inference_open.cpp
@@ -839,7 +839,7 @@ int mv_inference_pose_landmark_detect_open(
}
}
- detected_cb(source, result, -1, user_data);
+ detected_cb(source, result, user_data);
return ret;
}
@@ -894,6 +894,23 @@ int mv_inference_pose_get_landmark_open(
return MEDIA_VISION_ERROR_NONE;
}
+int mv_inference_pose_get_label_open(
+ mv_inference_pose_result_h result,
+ int pose_index,
+ int *label)
+{
+ mv_inference_pose_s *handle = static_cast<mv_inference_pose_s *>(result);
+
+ if (pose_index < 0 || pose_index >= handle->number_of_poses)
+ return MEDIA_VISION_ERROR_INVALID_PARAMETER;
+
+ *label = handle->landmarks[0].label;
+
+ LOGI("[%d]: label(%d)", pose_index, *label);
+
+ return MEDIA_VISION_ERROR_NONE;
+}
+
int mv_pose_create_open(mv_pose_h *pose)
{
if (pose == NULL) {
diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec
index 9b55e5e8..8eee2841 100644
--- a/packaging/capi-media-vision.spec
+++ b/packaging/capi-media-vision.spec
@@ -1,7 +1,7 @@
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
Version: 0.6.0
-Release: 3
+Release: 4
Group: Multimedia/Framework
License: Apache-2.0 and BSD-3-Clause
Source0: %{name}-%{version}.tar.gz
diff --git a/test/testsuites/inference/inference_test_suite.c b/test/testsuites/inference/inference_test_suite.c
index 9b21c45d..9904dcf7 100644
--- a/test/testsuites/inference/inference_test_suite.c
+++ b/test/testsuites/inference/inference_test_suite.c
@@ -173,7 +173,7 @@ void _facial_landmark_detected_cb(mv_source_h source,
}
void _pose_landmark_detected_cb(mv_source_h source,
- mv_inference_pose_result_h pose, int label, void *user_data)
+ mv_inference_pose_result_h pose, void *user_data)
{
int cb_number_of_poses = 0;
int cb_number_of_landmarks = 0;