[ACR-1848] Publish machine learning APIs 14/312614/1 accepted/tizen/unified/20240618.060058 accepted/tizen/unified/dev/20240620.004157 accepted/tizen/unified/toolchain/20240624.121719 accepted/tizen/unified/x/20240619.013513 accepted/tizen/unified/x/asan/20240625.092955
authorVibhav Aggarwal <v.aggarwal@samsung.com>
Wed, 12 Jun 2024 09:09:43 +0000 (18:09 +0900)
committerVibhav Aggarwal <v.aggarwal@samsung.com>
Wed, 12 Jun 2024 09:09:43 +0000 (18:09 +0900)
Please refer to the following ACR:
https://jira.sec.samsung.net/browse/ACR-1848

Change-Id: I92c053b3cb1d872735ccd548a091ba9e6b29861f
Signed-off-by: Vibhav Aggarwal <v.aggarwal@samsung.com>
40 files changed:
doc/examples/face_detection_async.c [new file with mode: 0644]
doc/examples/face_detection_sync.c [new file with mode: 0644]
doc/examples/facial_landmark_async.c [new file with mode: 0644]
doc/examples/facial_landmark_sync.c [new file with mode: 0644]
doc/examples/image_classification_async.c [new file with mode: 0644]
doc/examples/image_classification_sync.c [new file with mode: 0644]
doc/examples/object_detection_async.c [new file with mode: 0644]
doc/examples/object_detection_sync.c [new file with mode: 0644]
doc/examples/pose_landmark_async.c [new file with mode: 0644]
doc/examples/pose_landmark_sync.c [new file with mode: 0644]
doc/mediavision_doc.h
include/mv_face_detection.h [new file with mode: 0644]
include/mv_face_detection_internal.h
include/mv_face_detection_type.h
include/mv_facial_landmark.h [new file with mode: 0644]
include/mv_facial_landmark_internal.h
include/mv_facial_landmark_type.h
include/mv_image_classification.h [new file with mode: 0644]
include/mv_image_classification_internal.h
include/mv_image_classification_type.h
include/mv_object_detection.h [new file with mode: 0644]
include/mv_object_detection_internal.h
include/mv_object_detection_type.h
include/mv_pose_landmark.h [new file with mode: 0644]
include/mv_pose_landmark_internal.h
mv_machine_learning/image_classification/CMakeLists.txt
mv_machine_learning/image_classification/src/mv_image_classification.cpp
mv_machine_learning/landmark_detection/CMakeLists.txt
mv_machine_learning/landmark_detection/src/mv_facial_landmark.cpp
mv_machine_learning/landmark_detection/src/mv_pose_landmark.cpp
mv_machine_learning/object_detection/CMakeLists.txt
mv_machine_learning/object_detection/src/mv_face_detection.cpp
mv_machine_learning/object_detection/src/mv_object_detection.cpp
packaging/capi-media-vision.spec
test/testsuites/machine_learning/image_classification/test_image_classification.cpp
test/testsuites/machine_learning/image_classification/test_image_classification_async.cpp
test/testsuites/machine_learning/landmark_detection/test_landmark_detection.cpp
test/testsuites/machine_learning/landmark_detection/test_landmark_detection_async.cpp
test/testsuites/machine_learning/object_detection/test_object_detection.cpp
test/testsuites/machine_learning/object_detection/test_object_detection_async.cpp

diff --git a/doc/examples/face_detection_async.c b/doc/examples/face_detection_async.c
new file mode 100644 (file)
index 0000000..cf8db58
--- /dev/null
@@ -0,0 +1,153 @@
+/**
+ * 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 <dlog.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_face_detection.h>
+
+#undef LOG_TAG
+#define LOG_TAG "FACE_DETECTION_ASYNC_EXAMPLE"
+
+#define MAX_INFERENCE_ITERATION 50
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [FD async]
+void face_detection_callback(void *user_data)
+{
+       mv_face_detection_h handle = (mv_face_detection_h) user_data;
+       bool is_loop_exit = false;
+
+       while (!is_loop_exit) {
+               unsigned long frame_number;
+               unsigned int cnt;
+
+               int error_code = mv_face_detection_get_result_count(handle, &frame_number, &cnt);
+               if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+                       break;
+
+               for (unsigned int idx = 0; idx < cnt; ++idx) {
+                       int left, top, right, bottom;
+
+                       int ret = mv_face_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
+                       if (error_code != MEDIA_VISION_ERROR_NONE)
+                               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+                       dlog_print(DLOG_INFO, LOG_TAG,
+                                          "frame = %lu, idx = %u, left = %d, top = %d, "
+                                          "right = %d, bottom = %d",
+                                          frame_number, idx, left, top, right, bottom);
+
+                       if (frame_number > MAX_INFERENCE_ITERATION - 10)
+                               is_loop_exit = true;
+               }
+       }
+}
+
+int main()
+{
+       int error_code = 0;
+       mv_face_detection_h handle;
+
+       error_code = mv_face_detection_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       pthread_t thread_id;
+
+       for (unsigned int iter = 0; iter < MAX_INFERENCE_ITERATION; ++iter) {
+               mv_source_h mv_source = NULL;
+
+               error_code = mv_create_source(&mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               load_image_to_source("/path/to/image", mv_source);
+
+               error_code = mv_face_detection_inference_async(handle, mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               if (iter == 0)
+                       pthread_create(&thread_id, NULL, face_detection_callback, handle);
+
+               error_code = mv_destroy_source(mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+       }
+
+       /* This thread will be exited after inference is performed MAX_INFERENCE_ITERATION times. */
+       pthread_join(thread_id, NULL);
+
+       error_code = mv_face_detection_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [FD async]
\ No newline at end of file
diff --git a/doc/examples/face_detection_sync.c b/doc/examples/face_detection_sync.c
new file mode 100644 (file)
index 0000000..ccc899d
--- /dev/null
@@ -0,0 +1,127 @@
+/**
+ * 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 <dlog.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_face_detection.h>
+
+#undef LOG_TAG
+#define LOG_TAG "FACE_DETECTION_SYNC_EXAMPLE"
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [FD sync]
+int main()
+{
+       int error_code = 0;
+       mv_face_detection_h handle;
+       mv_source_h mv_source = NULL;
+
+       error_code = mv_create_source(&mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       load_image_to_source("/path/to/image", mv_source);
+
+       error_code = mv_face_detection_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_inference(handle, mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       unsigned long frame_number;
+       unsigned int cnt;
+
+       int error_code = mv_face_detection_get_result_count(handle, &frame_number, &cnt);
+       if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+               break;
+
+       for (unsigned int idx = 0; idx < cnt; ++idx) {
+               int left, top, right, bottom;
+
+               int ret = mv_face_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               dlog_print(DLOG_INFO, LOG_TAG,
+                                  "frame = %lu, idx = %u, left = %d, top = %d, "
+                                  "right = %d, bottom = %d",
+                                  frame_number, idx, left, top, right, bottom);
+       }
+
+       error_code = mv_destroy_source(mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_face_detection_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [FD sync]
\ No newline at end of file
diff --git a/doc/examples/facial_landmark_async.c b/doc/examples/facial_landmark_async.c
new file mode 100644 (file)
index 0000000..b2e5aae
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * 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 <dlog.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_facial_landmark.h>
+
+#undef LOG_TAG
+#define LOG_TAG "FACIAL_LANDMARK_ASYNC_EXAMPLE"
+
+#define MAX_INFERENCE_ITERATION 50
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [FLD async]
+void facial_landmark_callback(void *user_data)
+{
+       mv_facial_landmark_h handle = (mv_facial_landmark_h) user_data;
+       bool is_loop_exit = false;
+
+       while (!is_loop_exit) {
+               unsigned long frame_number;
+               unsigned int cnt;
+
+               int error_code = mv_facial_landmark_get_result_count(handle, &frame_number, &cnt);
+               if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+                       break;
+
+               for (unsigned int idx = 0; idx < cnt; ++idx) {
+                       unsigned int pos_x, pos_y;
+
+                       error_code = mv_facial_landmark_get_position(handle, idx, &pos_x, &pos_y);
+                       if (error_code != MEDIA_VISION_ERROR_NONE)
+                               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+                       dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, x = %u, y = %u", frame_number, idx, pos_x, pos_y);
+
+                       if (frame_number > MAX_INFERENCE_ITERATION - 10)
+                               is_loop_exit = true;
+               }
+       }
+}
+
+int main()
+{
+       int error_code = 0;
+       mv_facial_landmark_h handle;
+
+       error_code = mv_facial_landmark_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       pthread_t thread_id;
+
+       for (unsigned int iter = 0; iter < MAX_INFERENCE_ITERATION; ++iter) {
+               mv_source_h mv_source = NULL;
+
+               error_code = mv_create_source(&mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               load_image_to_source("/path/to/image", mv_source);
+
+               error_code = mv_facial_landmark_inference_async(handle, mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               if (iter == 0)
+                       pthread_create(&thread_id, NULL, facial_landmark_callback, handle);
+
+               error_code = mv_destroy_source(mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+       }
+
+       /* This thread will be exited after inference is performed MAX_INFERENCE_ITERATION times. */
+       pthread_join(thread_id, NULL);
+
+       error_code = mv_facial_landmark_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [FLD async]
\ No newline at end of file
diff --git a/doc/examples/facial_landmark_sync.c b/doc/examples/facial_landmark_sync.c
new file mode 100644 (file)
index 0000000..ef2d3ba
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * 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 <dlog.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_facial_landmark.h>
+
+#undef LOG_TAG
+#define LOG_TAG "FACIAL_LANDMARK_SYNC_EXAMPLE"
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [FLD sync]
+int main()
+{
+       int error_code = 0;
+       mv_facial_landmark_h handle;
+       mv_source_h mv_source = NULL;
+
+       error_code = mv_create_source(&mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       load_image_to_source("/path/to/image", mv_source);
+
+       error_code = mv_facial_landmark_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_inference(handle, mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       unsigned long frame_number;
+       unsigned int cnt;
+
+       int error_code = mv_facial_landmark_get_result_count(handle, &frame_number, &cnt);
+       if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+               break;
+
+       for (unsigned int idx = 0; idx < cnt; ++idx) {
+               unsigned int pos_x, pos_y;
+
+               error_code = mv_facial_landmark_get_position(handle, idx, &pos_x, &pos_y);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, x = %u, y = %u", frame_number, idx, pos_x, pos_y);
+       }
+
+       error_code = mv_destroy_source(mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_facial_landmark_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [FLD sync]
\ No newline at end of file
diff --git a/doc/examples/image_classification_async.c b/doc/examples/image_classification_async.c
new file mode 100644 (file)
index 0000000..c02cdf9
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * 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 <dlog.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_image_classification.h>
+
+#undef LOG_TAG
+#define LOG_TAG "IMAGE_CLASSIFICATION_ASYNC_EXAMPLE"
+
+#define MAX_INFERENCE_ITERATION 50
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [IC async]
+void image_classification_callback(void *user_data)
+{
+       mv_image_classification_h handle = (mv_image_classification_h) user_data;
+       bool is_loop_exit = false;
+
+       while (!is_loop_exit) {
+               unsigned long frame_number;
+               unsigned int cnt;
+
+               int error_code = mv_image_classification_get_result_count(handle, &frame_number, &cnt);
+               if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+                       break;
+
+               for (unsigned int idx = 0; idx < cnt; ++idx) {
+                       const char *label = NULL;
+
+                       error_code = mv_image_classification_get_label(handle, idx, &label);
+                       if (error_code != MEDIA_VISION_ERROR_NONE)
+                               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+                       dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, label = %s", frame_number, idx, label);
+
+                       if (frame_number > MAX_INFERENCE_ITERATION - 10)
+                               is_loop_exit = true;
+               }
+       }
+}
+
+int main()
+{
+       int error_code = 0;
+       mv_image_classification_h handle;
+
+       error_code = mv_image_classification_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       pthread_t thread_id;
+
+       for (unsigned int iter = 0; iter < MAX_INFERENCE_ITERATION; ++iter) {
+               mv_source_h mv_source = NULL;
+
+               error_code = mv_create_source(&mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               load_image_to_source("/path/to/image", mv_source);
+
+               error_code = mv_image_classification_inference_async(handle, mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               if (iter == 0)
+                       pthread_create(&thread_id, NULL, image_classification_callback, handle);
+
+               error_code = mv_destroy_source(mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+       }
+
+       /* This thread will be exited after inference is performed MAX_INFERENCE_ITERATION times. */
+       pthread_join(thread_id, NULL);
+
+       error_code = mv_image_classification_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [IC async]
\ No newline at end of file
diff --git a/doc/examples/image_classification_sync.c b/doc/examples/image_classification_sync.c
new file mode 100644 (file)
index 0000000..51117b1
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * 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 <dlog.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_image_classification.h>
+
+#undef LOG_TAG
+#define LOG_TAG "IMAGE_CLASSIFICATION_SYNC_EXAMPLE"
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [IC sync]
+int main()
+{
+       int error_code = 0;
+       mv_image_classification_h handle;
+       mv_source_h mv_source = NULL;
+
+       error_code = mv_create_source(&mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       load_image_to_source("/path/to/image", mv_source);
+
+       error_code = mv_image_classification_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_inference(handle, mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       unsigned long frame_number;
+       unsigned int cnt;
+
+       int error_code = mv_image_classification_get_result_count(handle, &frame_number, &cnt);
+       if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+               break;
+
+       for (unsigned int idx = 0; idx < cnt; ++idx) {
+               const char *label = NULL;
+
+               error_code = mv_image_classification_get_label(handle, idx, &label);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, label = %s", frame_number, idx, label);
+       }
+
+       error_code = mv_destroy_source(mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_image_classification_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [IC sync]
\ No newline at end of file
diff --git a/doc/examples/object_detection_async.c b/doc/examples/object_detection_async.c
new file mode 100644 (file)
index 0000000..990288d
--- /dev/null
@@ -0,0 +1,153 @@
+/**
+ * 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 <dlog.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_object_detection.h>
+
+#undef LOG_TAG
+#define LOG_TAG "OBJECT_DETECTION_ASYNC_EXAMPLE"
+
+#define MAX_INFERENCE_ITERATION 50
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [OD async]
+void object_detection_callback(void *user_data)
+{
+       mv_object_detection_h handle = (mv_object_detection_h) user_data;
+       bool is_loop_exit = false;
+
+       while (!is_loop_exit) {
+               unsigned long frame_number;
+               unsigned int cnt;
+
+               int error_code = mv_object_detection_get_result_count(handle, &frame_number, &cnt);
+               if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+                       break;
+
+               for (unsigned int idx = 0; idx < cnt; ++idx) {
+                       int left, top, right, bottom;
+
+                       int ret = mv_object_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
+                       if (error_code != MEDIA_VISION_ERROR_NONE)
+                               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+                       dlog_print(DLOG_INFO, LOG_TAG,
+                                          "frame = %lu, idx = %u, left = %d, top = %d, "
+                                          "right = %d, bottom = %d",
+                                          frame_number, idx, left, top, right, bottom);
+
+                       if (frame_number > MAX_INFERENCE_ITERATION - 10)
+                               is_loop_exit = true;
+               }
+       }
+}
+
+int main()
+{
+       int error_code = 0;
+       mv_object_detection_h handle;
+
+       error_code = mv_object_detection_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       pthread_t thread_id;
+
+       for (unsigned int iter = 0; iter < MAX_INFERENCE_ITERATION; ++iter) {
+               mv_source_h mv_source = NULL;
+
+               error_code = mv_create_source(&mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               load_image_to_source("/path/to/image", mv_source);
+
+               error_code = mv_object_detection_inference_async(handle, mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               if (iter == 0)
+                       pthread_create(&thread_id, NULL, object_detection_callback, handle);
+
+               error_code = mv_destroy_source(mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+       }
+
+       /* This thread will be exited after inference is performed MAX_INFERENCE_ITERATION times. */
+       pthread_join(thread_id, NULL);
+
+       error_code = mv_object_detection_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [OD async]
\ No newline at end of file
diff --git a/doc/examples/object_detection_sync.c b/doc/examples/object_detection_sync.c
new file mode 100644 (file)
index 0000000..e5d9d2c
--- /dev/null
@@ -0,0 +1,127 @@
+/**
+ * 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 <dlog.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_object_detection.h>
+
+#undef LOG_TAG
+#define LOG_TAG "OBJECT_DETECTION_SYNC_EXAMPLE"
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [OD sync]
+int main()
+{
+       int error_code = 0;
+       mv_object_detection_h handle;
+       mv_source_h mv_source = NULL;
+
+       error_code = mv_create_source(&mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       load_image_to_source("/path/to/image", mv_source);
+
+       error_code = mv_object_detection_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_inference(handle, mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       unsigned long frame_number;
+       unsigned int cnt;
+
+       int error_code = mv_object_detection_get_result_count(handle, &frame_number, &cnt);
+       if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+               break;
+
+       for (unsigned int idx = 0; idx < cnt; ++idx) {
+               int left, top, right, bottom;
+
+               int ret = mv_object_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               dlog_print(DLOG_INFO, LOG_TAG,
+                                  "frame = %lu, idx = %u, left = %d, top = %d, "
+                                  "right = %d, bottom = %d",
+                                  frame_number, idx, left, top, right, bottom);
+       }
+
+       error_code = mv_destroy_source(mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_object_detection_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [OD sync]
\ No newline at end of file
diff --git a/doc/examples/pose_landmark_async.c b/doc/examples/pose_landmark_async.c
new file mode 100644 (file)
index 0000000..ffb71f1
--- /dev/null
@@ -0,0 +1,150 @@
+/**
+ * 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 <dlog.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_pose_landmark.h>
+
+#undef LOG_TAG
+#define LOG_TAG "POSE_LANDMARK_ASYNC_EXAMPLE"
+
+#define MAX_INFERENCE_ITERATION 50
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [PLD async]
+void pose_landmark_callback(void *user_data)
+{
+       mv_pose_landmark_h handle = (mv_pose_landmark_h) user_data;
+       bool is_loop_exit = false;
+
+       while (!is_loop_exit) {
+               unsigned long frame_number;
+               unsigned int cnt;
+
+               int error_code = mv_pose_landmark_get_result_count(handle, &frame_number, &cnt);
+               if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+                       break;
+
+               for (unsigned int idx = 0; idx < cnt; ++idx) {
+                       unsigned int pos_x, pos_y;
+
+                       error_code = mv_pose_landmark_get_position(handle, idx, &pos_x, &pos_y);
+                       if (error_code != MEDIA_VISION_ERROR_NONE)
+                               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+                       dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, x = %u, y = %u", frame_number, idx, pos_x, pos_y);
+
+                       if (frame_number > MAX_INFERENCE_ITERATION - 10)
+                               is_loop_exit = true;
+               }
+       }
+}
+
+int main()
+{
+       int error_code = 0;
+       mv_pose_landmark_h handle;
+
+       error_code = mv_pose_landmark_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       pthread_t thread_id;
+
+       for (unsigned int iter = 0; iter < MAX_INFERENCE_ITERATION; ++iter) {
+               mv_source_h mv_source = NULL;
+
+               error_code = mv_create_source(&mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               load_image_to_source("/path/to/image", mv_source);
+
+               error_code = mv_pose_landmark_inference_async(handle, mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               if (iter == 0)
+                       pthread_create(&thread_id, NULL, pose_landmark_callback, handle);
+
+               error_code = mv_destroy_source(mv_source);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+       }
+
+       /* This thread will be exited after inference is performed MAX_INFERENCE_ITERATION times. */
+       pthread_join(thread_id, NULL);
+
+       error_code = mv_pose_landmark_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [PLD async]
\ No newline at end of file
diff --git a/doc/examples/pose_landmark_sync.c b/doc/examples/pose_landmark_sync.c
new file mode 100644 (file)
index 0000000..4ce13c0
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+ * 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 <dlog.h>
+#include <string.h>
+
+#include <image_util.h>
+#include <mv_pose_landmark.h>
+
+#undef LOG_TAG
+#define LOG_TAG "POSE_LANDMARK_SYNC_EXAMPLE"
+
+void load_image_to_source(const char *path, mv_source_h mv_source)
+{
+       unsigned char *dataBuffer = NULL;
+       size_t long bufferSize = 0;
+       unsigned int width = 0;
+       unsigned int height = 0;
+       image_util_decode_h imageDecoder = NULL;
+       image_util_image_h decodedImage = NULL;
+
+       int error_code = image_util_decode_create(&imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_input_path(imageDecoder, path);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_set_colorspace(imageDecoder, IMAGE_UTIL_COLORSPACE_RGB888);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_run2(imageDecoder, &decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_get_image(decodedImage, &width, &height, NULL, &dataBuffer, &bufferSize);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_decode_destroy(imageDecoder);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       /* Fill the dataBuffer to mv_source */
+       error_code = mv_source_fill_by_buffer(mv_source, dataBuffer, (unsigned int) bufferSize, width, height,
+                                                                                 MEDIA_VISION_COLORSPACE_RGB888);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = image_util_destroy_image(decodedImage);
+       if (error_code != IMAGE_UTIL_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+
+//! [PLD sync]
+int main()
+{
+       int error_code = 0;
+       mv_pose_landmark_h handle;
+       mv_source_h mv_source = NULL;
+
+       error_code = mv_create_source(&mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       load_image_to_source("/path/to/image", mv_source);
+
+       error_code = mv_pose_landmark_create(&handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_configure(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_prepare(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_inference(handle, mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       unsigned long frame_number;
+       unsigned int cnt;
+
+       int error_code = mv_pose_landmark_get_result_count(handle, &frame_number, &cnt);
+       if (error_code == MEDIA_VISION_ERROR_INVALID_OPERATION)
+               break;
+
+       for (unsigned int idx = 0; idx < cnt; ++idx) {
+               unsigned int pos_x, pos_y;
+
+               error_code = mv_pose_landmark_get_position(handle, idx, &pos_x, &pos_y);
+               if (error_code != MEDIA_VISION_ERROR_NONE)
+                       dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+               dlog_print(DLOG_INFO, LOG_TAG, "frame = %lu, idx = %u, x = %u, y = %u", frame_number, idx, pos_x, pos_y);
+       }
+
+       error_code = mv_destroy_source(mv_source);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+
+       error_code = mv_pose_landmark_destroy(handle);
+       if (error_code != MEDIA_VISION_ERROR_NONE)
+               dlog_print(DLOG_ERROR, LOG_TAG, "error code = %d", error_code);
+}
+//! [PLD sync]
\ No newline at end of file
index d48548e44b3178c185a2be6d8a34462626edea47..02906a32b09d774d2e15ee34e8339e5990bb1622 100644 (file)
  * After preparation, mv_3d_run() has to be called to process synchronously depth or pointcloud from #mv_source_h,
  * and callback functions will be invoked with processed depth or pointcloud.
  * Module also contains mv_3d_run_async() functions to process depth or pointcloud asynchronously.
+ *
+ * @defgroup    CAPI_MEDIA_VISION_FACE_DETECTION_MODULE Media Vision Face Detection
+ * @ingroup     CAPI_MEDIA_VISION_MODULE
+ * @brief Face detection.
+ * @section CAPI_MEDIA_VISION_FACE_DETECTION_MODULE_HEADER Required Header
+ *      \#include <mv_face_detection.h>
+ *
+ * @section CAPI_MEDIA_VISION_FACE_DETECTION_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - %http://tizen.org/feature/vision.inference.image\n
+ *  - %http://tizen.org/feature/vision.inference.face\n
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ * More details on featuring your application can be found from
+ * <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element">
+ *   <b>Feature Element</b>.
+ * </a>
+ *
+ * @section CAPI_MEDIA_VISION_FACE_DETECTION_MODULE_OVERVIEW Overview
+ * @ref CAPI_MEDIA_VISION_FACE_DETECTION_MODULE contains #mv_face_detection_h handle to perform
+ * face detection. Face detection handle should be created with mv_face_detection_create() and destroyed with
+ * mv_face_detection_destroy(). #mv_face_detection_h should be configured by calling
+ * mv_face_detection_configure(). After configuration, #mv_face_detection_h should be prepared by
+ * calling mv_face_detection_prepare() which loads models and set required parameters.
+ * After preparation, mv_face_detection_inference() or mv_face_detection_inference_async()
+ * can be called to detect faces in images on #mv_source_h.
+ * Use mv_face_detection_get_result_count() to get the number of results and mv_face_detection_get_bound_box()
+ * to get the bounding box of each result.
+ *
+ * @defgroup    CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE Media Vision Object Detection
+ * @ingroup     CAPI_MEDIA_VISION_MODULE
+ * @brief Object detection.
+ * @section CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE_HEADER Required Header
+ *      \#include <mv_object_detection.h>
+ *
+ * @section CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - %http://tizen.org/feature/vision.inference.image\n
+ *  - %http://tizen.org/feature/vision.inference.face\n
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ * More details on featuring your application can be found from
+ * <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element">
+ *   <b>Feature Element</b>.
+ * </a>
+ *
+ * @section CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE_OVERVIEW Overview
+ * @ref CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE contains #mv_object_detection_h handle to perform
+ * object detection. Object detection handle should be created with mv_object_detection_create() and destroyed with
+ * mv_object_detection_destroy(). #mv_object_detection_h should be configured by calling
+ * mv_object_detection_configure(). After configuration, #mv_object_detection_h should be prepared by
+ * calling mv_object_detection_prepare() which loads models and set required parameters.
+ * After preparation, mv_object_detection_inference() or mv_object_detection_inference_async()
+ * can be called to detect objects in images on #mv_source_h.
+ * Use mv_object_detection_get_result_count() to get the number of results and mv_object_detection_get_bound_box()
+ * to get the bounding box of each result.
+ *
+ * @defgroup    CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE Media Vision Image Classification
+ * @ingroup     CAPI_MEDIA_VISION_MODULE
+ * @brief Image classification.
+ * @section CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE_HEADER Required Header
+ *      \#include <mv_image_classification.h>
+ *
+ * @section CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - %http://tizen.org/feature/vision.inference.image\n
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ * More details on featuring your application can be found from
+ * <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element">
+ *   <b>Feature Element</b>.
+ * </a>
+ *
+ * @section CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE_OVERVIEW Overview
+ * @ref CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE contains #mv_image_classification_h handle to perform
+ * image classification. Image classification handle should be created with mv_image_classification_create() and destroyed with
+ * mv_image_classification_destroy(). #mv_image_classification_h should be configured by calling
+ * mv_image_classification_configure(). After configuration, #mv_image_classification_h should be prepared by
+ * calling mv_image_classification_prepare() which loads models and set required parameters.
+ * After preparation, mv_image_classification_inference() or mv_image_classification_inference_async()
+ * can be called to classify images on #mv_source_h.
+ * Use mv_image_classification_get_result_count() to get the number of results and mv_image_classification_get_label()
+ * to get the label of each result.
+ *
+ * @defgroup    CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE Media Vision Facial Landmark Detection
+ * @ingroup     CAPI_MEDIA_VISION_MODULE
+ * @brief Facial landmark detection.
+ * @section CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE_HEADER Required Header
+ *      \#include <mv_facial_landmark.h>
+ *
+ * @section CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - %http://tizen.org/feature/vision.inference.image\n
+ *  - %http://tizen.org/feature/vision.inference.face\n
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ * More details on featuring your application can be found from
+ * <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element">
+ *   <b>Feature Element</b>.
+ * </a>
+ *
+ * @section CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE_OVERVIEW Overview
+ * @ref CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE contains #mv_facial_landmark_h handle to perform
+ * facial landmark detection. Facial landmark handle should be created with mv_facial_landmark_create() and destroyed with
+ * mv_facial_landmark_destroy(). #mv_facial_landmark_h should be configured by calling
+ * mv_facial_landmark_configure(). After configuration, #mv_facial_landmark_h should be prepared by
+ * calling mv_facial_landmark_prepare() which loads models and set required parameters.
+ * After preparation, mv_facial_landmark_inference() or mv_facial_landmark_inference_async()
+ * can be called to detect facial landmarks in images on #mv_source_h.
+ * Use mv_facial_landmark_get_result_count() to get the number of results and mv_facial_landmark_get_position()
+ * to get the position of each landmark.
+ *
+ * @defgroup    CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE Media Vision Pose Landmark Detection
+ * @ingroup     CAPI_MEDIA_VISION_MODULE
+ * @brief Pose landmark detection.
+ * @section CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE_HEADER Required Header
+ *      \#include <mv_pose_landmark.h>
+ *
+ * @section CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ *  - %http://tizen.org/feature/vision.inference.image\n
+ *  - %http://tizen.org/feature/vision.inference.face\n
+ *
+ * It is recommended to design feature related codes in your application for
+ * reliability.\n
+ * You can check if a device supports the related features for this API by using
+ * @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of
+ * your application.\n
+ * To ensure your application is only running on the device with specific
+ * features, please define the features in your manifest file using the manifest
+ * editor in the SDK.\n
+ * More details on featuring your application can be found from
+ * <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element">
+ *   <b>Feature Element</b>.
+ * </a>
+ *
+ * @section CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE_OVERVIEW Overview
+ * @ref CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE contains #mv_pose_landmark_h handle to perform
+ * pose landmark detection. Pose landmark handle should be created with mv_pose_landmark_create() and destroyed with
+ * mv_pose_landmark_destroy(). #mv_pose_landmark_h should be configured by calling
+ * mv_pose_landmark_configure(). After configuration, #mv_pose_landmark_h should be prepared by
+ * calling mv_pose_landmark_prepare() which loads models and set required parameters.
+ * After preparation, mv_pose_landmark_inference() or mv_pose_landmark_inference_async()
+ * can be called to detect pose landmarks in images on #mv_source_h.
+ * Use mv_pose_landmark_get_result_count() to get the number of results and mv_pose_landmark_get_position()
+ * to get the position of each landmark.
  */
 #endif /* __TIZEN_MEDIAVISION_DOC_H__ */
diff --git a/include/mv_face_detection.h b/include/mv_face_detection.h
new file mode 100644 (file)
index 0000000..3a7a876
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2023 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 __TIZEN_MEDIAVISION_MV_FACE_DETECTION_H__
+#define __TIZEN_MEDIAVISION_MV_FACE_DETECTION_H__
+
+#include <mv_common.h>
+#include <mv_face_detection_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_face_detection.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_FACE_DETECTION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a inference handle for face detection object.
+ * @details Use this function to create a inference handle. After the creation
+ *          the face detection task has to be prepared with
+ *          mv_face_detection_prepare() function to prepare a network
+ *          for the inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @remarks The @a handle should be released using mv_face_detection_destroy().
+ *
+ * @param[out] handle    The handle to the inference to be created.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @code
+ * #include <mv_face_detection.h>
+ * ...
+ * mv_face_detection_h handle = NULL;
+ * mv_face_detection_create(&handle);
+ * ...
+ * mv_face_detection_destroy(handle);
+ * @endcode
+ *
+ * @see mv_face_detection_destroy()
+ * @see mv_face_detection_prepare()
+ */
+int mv_face_detection_create(mv_face_detection_h *handle);
+
+/**
+ * @brief Destroys inference handle and releases all its resources.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle    The handle to the inference to be destroyed.
+ *
+ * @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
+ *
+ * @pre Create inference handle by using mv_face_detection_create()
+ *
+ * @see mv_face_detection_create()
+ */
+int mv_face_detection_destroy(mv_face_detection_h handle);
+
+/**
+ * @brief Configures the backend for the face detection inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_face_detection_configure(mv_face_detection_h handle);
+
+/**
+ * @brief Prepares the face detection inference.
+ * @details Use this function to prepare the face detection inference based on
+ *          the configured network.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ */
+int mv_face_detection_prepare(mv_face_detection_h handle);
+
+/**
+ * @brief Performs the face detection inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function is synchronous and may take considerable time to run.
+ *
+ * @param[in] handle          The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_face_detection_create()
+ * @pre Prepare an inference by calling mv_face_detection_configure()
+ * @pre Prepare an inference by calling mv_face_detection_prepare()
+ *
+ * @par Inference Example
+ * @snippet face_detection_sync.c FD sync
+ */
+int mv_face_detection_inference(mv_face_detection_h handle, mv_source_h source);
+
+/**
+ * @brief Performs asynchronously the face detection inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function operates asynchronously, so it returns immediately upon invocation.
+ *          The inference results are inserted into the outgoing queue within the framework
+ *          in the order of processing, and the results can be obtained through mv_face_detection_get_result_count()
+ *          and mv_face_detection_get_bound_box().
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_face_detection_create()
+ * @pre Prepare an inference by calling mv_face_detection_configure()
+ * @pre Prepare an inference by calling mv_face_detection_prepare()
+ *
+ * @par Async Inference Example
+ * @snippet face_detection_async.c FD async
+ */
+int mv_face_detection_inference_async(mv_face_detection_h handle, mv_source_h source);
+
+/**
+ * @brief Gets the face detection inference result on the @a handle.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle          The handle to the inference
+ * @param[out] frame_number   A frame number inferenced.
+ * @param[out] result_cnt     A number of results.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_face_detection_create()
+ * @pre Prepare an inference by calling mv_face_detection_configure()
+ * @pre Prepare an inference by calling mv_face_detection_prepare()
+ * @pre Request an inference by calling mv_face_detection_inference()
+ */
+int mv_face_detection_get_result_count(mv_face_detection_h handle, unsigned long *frame_number,
+                                       unsigned int *result_cnt);
+
+/**
+ * @brief Gets a bound box to detected face region.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle              The handle to the inference
+ * @param[in] index               A result index.
+ * @param[out] left               An left position of bound box.
+ * @param[out] top                An top position of bound box.
+ * @param[out] right              An right position of bound box.
+ * @param[out] bottom             An bottom position of bound box.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_face_detection_create()
+ * @pre Prepare an inference by calling mv_face_detection_configure()
+ * @pre Prepare an inference by calling mv_face_detection_prepare()
+ * @pre Request an inference by calling mv_face_detection_inference()
+ * @pre Get result count by calling mv_face_detection_get_result_count()
+ */
+int mv_face_detection_get_bound_box(mv_face_detection_h handle, unsigned int index, int *left, int *top, int *right,
+                               int *bottom);
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_FACE_DETECTION_H__ */
index 80c6f1a405016f2a5608b5af416de6aa6e6696b6..be13732729750052a56063983d8e5d7d015fc562 100644 (file)
@@ -35,50 +35,6 @@ extern "C" {
  * @{
  */
 
-/**
- * @internal
- * @brief Creates a inference handle for face detection object.
- * @details Use this function to create a inference handle. After the creation
- *          the face detection task has to be prepared with
- *          mv_face_detection_prepare() function to prepare a network
- *          for the inference.
- *
- * @since_tizen 9.0
- *
- * @remarks The @a infer should be released using mv_face_detection_destroy().
- *
- * @param[out] handle    The handle to the inference to be created.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see mv_face_detection_destroy()
- * @see mv_face_detection_prepare()
- */
-int mv_face_detection_create(mv_face_detection_h *handle);
-
-/**
- * @internal
- * @brief Destroys inference handle and releases all its resources.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle    The handle to the inference to be destroyed.
- *
- * @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
- *
- * @pre Create inference handle by using mv_face_detection_create()
- *
- * @see mv_face_detection_create()
- */
-int mv_face_detection_destroy(mv_face_detection_h handle);
-
 /**
  * @internal
  * @brief Sets user-given model information.
@@ -102,151 +58,6 @@ int mv_face_detection_destroy(mv_face_detection_h handle);
 int mv_face_detection_set_model(mv_face_detection_h handle, const char *model_name, const char *model_file,
                                                                const char *meta_file, const char *label_file);
 
-/**
- * @internal
- * @brief Configures the backend for the face detection inference.
- *
- * @since_tizen 9.0
- *
- * @param [in] handle         The handle to the inference
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- */
-int mv_face_detection_configure(mv_face_detection_h handle);
-
-/**
- * @internal
- * @brief Prepares the face detection inference
- * @details Use this function to prepare the face detection inference based on
- *          the configured network.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle         The handle to the inference.
- *
- * @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_PERMISSION_DENIED Permission denied
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
- */
-int mv_face_detection_prepare(mv_face_detection_h handle);
-
-/**
- * @internal
- * @brief Performs the face detection inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function is synchronous and may take considerable time to run.
- *
- * @param[in] handle          The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_face_detect_create()
- * @pre Prepare an inference by calling mv_face_detect_configure()
- * @pre Prepare an inference by calling mv_face_detect_prepare()
- */
-int mv_face_detection_inference(mv_face_detection_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Performs asynchronously the face detection inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function operates asynchronously, so it returns immediately upon invocation.
- *          The inference results are inserted into the outgoing queue within the framework
- *          in the order of processing, and the results can be obtained through mv_face_detection_get_result()
- *          and mv_face_detection_get_label().
- *
- * @param[in] handle         The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_face_detect_create()
- * @pre Prepare an inference by calling mv_face_detect_configure()
- * @pre Prepare an inference by calling mv_face_detect_prepare()
- */
-int mv_face_detection_inference_async(mv_face_detection_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Gets the face detection inference result on the @a source.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle          The handle to the inference
- * @param[out] frame_number   A frame number inferenced.
- * @param[out] result_cnt     A number of results.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_face_detect_create()
- * @pre Prepare an inference by calling mv_face_detect_configure()
- * @pre Prepare an inference by calling mv_face_detect_prepare()
- * @pre Request an inference by calling mv_face_detect_inference()
- */
-int mv_face_detection_get_result_count(mv_face_detection_h handle, unsigned long *frame_number,
-                                                                          unsigned int *result_cnt);
-
-/**
- * @internal
- * @brief Gets a bound box to detected face region
- *
- * @since_tizen 9.0
- *
- * @param[in] handle              The handle to the inference
- * @param[in] index               A result index.
- * @param[out] left               An left position of bound box.
- * @param[out] top                An top position of bound box.
- * @param[out] right              An right position of bound box.
- * @param[out] bottom             An bottom position of bound box.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_face_detect_create()
- * @pre Prepare an inference by calling mv_face_detect_configure()
- * @pre Prepare an inference by calling mv_face_detect_prepare()
- * @pre Request an inference by calling mv_face_detect_inference()
- * @pre Get result count by calling mv_face_detection_get_result_cnt()
- */
-int mv_face_detection_get_bbox(mv_face_detection_h handle, unsigned int index, int *left, int *top, int *right,
-                                                          int *bottom);
-
 /**
  * @internal
  * @brief Sets user-given inference engine and device types for inference.
index be6813219b4a1a339ce841037d551f7bfdf8959b..7e442cbc565aab70f710ae5412e07fc900c6ef41 100644 (file)
@@ -25,23 +25,21 @@ extern "C" {
 
 /**
  * @file   mv_face_detection_type.h
- * @brief  This file contains the face recognition handle for Mediavision.
+ * @brief  This file contains the face detection handle for Mediavision.
  */
 
 /**
- * @addtogroup CAPI_MEDIA_VISION_FACE_DETECT_MODULE
+ * @addtogroup CAPI_MEDIA_VISION_FACE_DETECTION_MODULE
  * @{
  */
 
 /**
  * @brief The face detection object handle.
  *
- * @since_tizen 8.0
+ * @since_tizen 9.0
  */
 typedef void *mv_face_detection_h;
 
-typedef void (*mv_completion_cb)(mv_face_detection_h handle, void *user_data);
-
 /**
  * @}
  */
diff --git a/include/mv_facial_landmark.h b/include/mv_facial_landmark.h
new file mode 100644 (file)
index 0000000..9c7b81f
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2023 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 __TIZEN_MEDIAVISION_MV_FACIAL_LANDMARK_H__
+#define __TIZEN_MEDIAVISION_MV_FACIAL_LANDMARK_H__
+
+#include <mv_common.h>
+#include <mv_facial_landmark_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_facial_landmark.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a inference handle for facial landmark object.
+ * @details Use this function to create a inference handle. After the creation
+ *          the facial landmark task has to be prepared with
+ *          mv_facial_landmark_prepare() function to prepare a network
+ *          for the inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @remarks The @a handle should be released using mv_facial_landmark_destroy().
+ *
+ * @param[out] handle    The handle to the inference to be created.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @code
+ * #include <mv_facial_landmark.h>
+ * ...
+ * mv_facial_landmark_h handle = NULL;
+ * mv_facial_landmark_create(&handle);
+ * ...
+ * mv_facial_landmark_destroy(handle);
+ * @endcode
+ *
+ * @see mv_facial_landmark_destroy()
+ * @see mv_facial_landmark_prepare()
+ */
+int mv_facial_landmark_create(mv_facial_landmark_h *handle);
+
+/**
+ * @brief Destroys inference handle and releases all its resources.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle    The handle to the inference to be destroyed.
+ *
+ * @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
+ *
+ * @pre Create inference handle by using mv_facial_landmark_create()
+ *
+ * @see mv_facial_landmark_create()
+ */
+int mv_facial_landmark_destroy(mv_facial_landmark_h handle);
+
+/**
+ * @brief Configures the backend for the facial landmark inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_facial_landmark_configure(mv_facial_landmark_h handle);
+
+/**
+ * @brief Prepares the facial landmark inference.
+ * @details Use this function to prepare the facial landmark inference based on
+ *          the configured network.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ */
+int mv_facial_landmark_prepare(mv_facial_landmark_h handle);
+
+/**
+ * @brief Performs the facial landmark inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function is synchronous and may take considerable time to run.
+ *
+ * @param[in] handle          The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_facial_landmark_create()
+ * @pre Prepare an inference by calling mv_facial_landmark_configure()
+ * @pre Prepare an inference by calling mv_facial_landmark_prepare()
+ *
+ * @par Inference Example
+ * @snippet facial_landmark_sync.c FLD sync
+ */
+int mv_facial_landmark_inference(mv_facial_landmark_h handle, mv_source_h source);
+
+/**
+ * @brief Performs asynchronously the facial landmark inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function operates asynchronously, so it returns immediately upon invocation.
+ *          The inference results are inserted into the outgoing queue within the framework
+ *          in the order of processing, and the results can be obtained through mv_facial_landmark_get_position().
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_facial_landmark_create()
+ * @pre Prepare an inference by calling mv_facial_landmark_configure()
+ * @pre Prepare an inference by calling mv_facial_landmark_prepare()
+ *
+ * @par Async Inference Example
+ * @snippet facial_landmark_async.c FLD async
+ */
+int mv_facial_landmark_inference_async(mv_facial_landmark_h handle, mv_source_h source);
+
+/**
+ * @brief Gets the result count to objects.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[out] frame_number  A frame number inferenced.
+ * @param[out] result_cnt    A number of results.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_facial_landmark_create()
+ * @pre Prepare an inference by calling mv_facial_landmark_configure()
+ * @pre Prepare an inference by calling mv_facial_landmark_prepare()
+ * @pre Request an inference by calling mv_facial_landmark_inference()
+ */
+int mv_facial_landmark_get_result_count(mv_facial_landmark_h handle, unsigned long *frame_number,
+                                        unsigned int *result_cnt);
+
+/**
+ * @brief Gets the facial landmark position values to a given index.
+ *
+ * @since_tizen 9.0
+ * @remarks pos_x and pos_y arrays are allocated internally by the framework and will remain valid
+ *          until the handle is released.
+ *          Please do not deallocate them directly, and if you want to use them after the handle is released,
+ *          please copy them to user memory and use the copy.
+ *
+ *          This function operates differently depending on the inference request method.
+ *          - After mv_facial_landmark_inference() calls, this function returns facial landmark positions immediately.
+ *          - After mv_facial_landmark_inference_async() calls, this function can be blocked until the asynchronous inference request is completed
+ *            or the timeout occurs if no result within 3 seconds.
+ *
+ *          Additionally, after calling the mv_facial_landmark_inference_async() function, the function operates
+ *          in asynchronous mode until the handle is released.
+ *
+ * @param[in] handle               The handle to the inference
+ * @param[in] index                A result index.
+ * @param[out] pos_x               An array containing x-coordinate values.
+ * @param[out] pos_y               An array containing y-coordinate values.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_facial_landmark_create()
+ * @pre Prepare an inference by calling mv_facial_landmark_configure()
+ * @pre Prepare an inference by calling mv_facial_landmark_prepare()
+ * @pre Prepare an inference by calling mv_facial_landmark_inference()
+ * @pre Get result count by calling mv_facial_landmark_get_result_count()
+ */
+int mv_facial_landmark_get_position(mv_facial_landmark_h handle, unsigned int index, unsigned int *pos_x,
+                                    unsigned int *pos_y);
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_FACIAL_LANDMARK_H__ */
index 411e983c29e0604ba3e8d9b80516b92928abf7ff..cbf9651adf57e77b3c0eb37ba35ea519a5f4e6ab 100644 (file)
@@ -35,50 +35,6 @@ extern "C" {
  * @{
  */
 
-/**
- * @internal
- * @brief Creates a inference handle for facial landmark object.
- * @details Use this function to create a inference handle. After the creation
- *          the facial landmark task has to be prepared with
- *          mv_facial_landmark_prepare() function to prepare a network
- *          for the inference.
- *
- * @since_tizen 9.0
- *
- * @remarks The @a infer should be released using mv_facial_landmark_destroy().
- *
- * @param[out] handle    The handle to the inference to be created.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see mv_facial_landmark_destroy()
- * @see mv_facial_landmark_prepare()
- */
-int mv_facial_landmark_create(mv_facial_landmark_h *handle);
-
-/**
- * @internal
- * @brief Destroys inference handle and releases all its resources.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle    The handle to the inference to be destroyed.
- *
- * @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
- *
- * @pre Create inference handle by using mv_facial_landmark_create()
- *
- * @see mv_facial_landmark_create()
- */
-int mv_facial_landmark_destroy(mv_facial_landmark_h handle);
-
 /**
  * @internal
  * @brief Sets user-given model information.
@@ -102,160 +58,6 @@ int mv_facial_landmark_destroy(mv_facial_landmark_h handle);
 int mv_facial_landmark_set_model(mv_facial_landmark_h handle, const char *model_name, const char *model_file,
                                                                 const char *meta_file, const char *label_file);
 
-/**
- * @internal
- * @brief Configures the backend for the facial landmark inference.
- *
- * @since_tizen 9.0
- *
- * @param [in] handle         The handle to the inference
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- */
-int mv_facial_landmark_configure(mv_facial_landmark_h handle);
-
-/**
- * @internal
- * @brief Prepares the facial landmark inference
- * @details Use this function to prepare the facial landmark inference based on
- *          the configured network.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle         The handle to the inference.
- *
- * @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_PERMISSION_DENIED Permission denied
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
- */
-int mv_facial_landmark_prepare(mv_facial_landmark_h handle);
-
-/**
- * @internal
- * @brief Performs the facial landmark inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function is synchronous and may take considerable time to run.
- *
- * @param[in] handle          The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_facial_landmark_create()
- * @pre Prepare an inference by calling mv_facial_landmark_configure()
- * @pre Prepare an inference by calling mv_facial_landmark_prepare()
- */
-int mv_facial_landmark_inference(mv_facial_landmark_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Performs asynchronously the facial landmark inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function operates asynchronously, so it returns immediately upon invocation.
- *          The inference results are inserted into the outgoing queue within the framework
- *          in the order of processing, and the results can be obtained through mv_facial_landmark_get_positions().
- *
- * @param[in] handle         The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_facial_landmark_create()
- * @pre Prepare an inference by calling mv_facial_landmark_configure()
- * @pre Prepare an inference by calling mv_facial_landmark_prepare()
- */
-int mv_facial_landmark_inference_async(mv_facial_landmark_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Gets the result count to objects.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle         The handle to the inference
- * @param[out] frame_number  A frame number inferenced.
- * @param[out] result_cnt    A number of results.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_facial_landmark_create()
- * @pre Prepare an inference by calling mv_facial_landmark_configure()
- * @pre Prepare an inference by calling mv_facial_landmark_prepare()
- * @pre Request an inference by calling mv_facial_landmark_inference()
- */
-int mv_facial_landmark_get_result_count(mv_facial_landmark_h handle, unsigned long *frame_number,
-                                                                               unsigned int *result_cnt);
-
-/**
- * @internal
- * @brief Gets the facial landmark position values to a given index.
- *
- * @since_tizen 9.0
- * @remarks pos_x and pos_y arrays are allocated internally by the framework and will remain valid
- *          until the handle is released.
- *          Please do not deallocate them directly, and if you want to use them after the handle is released,
- *          please copy them to user memory and use the copy.
- *
- *          This function operates differently depending on the inference request method.
- *          - After mv_facial_landmark_inference() calls, this function returns facial landmark positions immediately.
- *          - After mv_facial_landmark_inference_async() calls, this function can be blocked until the asynchronous inference request is completed
- *            or the timeout occurs if no result within 3 seconds.
- *
- *          Additionally, after calling the mv_facial_landmark_inference_async function, the function operates
- *          in asynchronous mode until the handle is released.
- *
- * @param[in] handle               The handle to the inference
- * @param[in] index                A result index.
- * @param[out] pos_x               An array containing x-coordinate values.
- * @param[out] pos_y               An array containing y-coordinate values.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_facial_landmark_create()
- * @pre Prepare an inference by calling mv_facial_landmark_configure()
- * @pre Prepare an inference by calling mv_facial_landmark_prepare()
- * @pre Prepare an inference by calling mv_facial_landmark_inference()
- * @pre Get result count by calling mv_facial_landmark_get_result_count()
- */
-int mv_facial_landmark_get_position(mv_facial_landmark_h handle, unsigned int index, unsigned int *pos_x,
-                                                                       unsigned int *pos_y);
-
 /**
  * @internal
  * @brief Sets user-given inference engine and device types for inference.
index f978c13644b6438b8eaab826a6cf5921ac64272a..e7354082eeb98716f2809a31ef98eaf496a2fe3c 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
  */
 
 /**
- * @addtogroup CAPI_MEDIA_VISION_FACE_LANDMARK_MODULE
+ * @addtogroup CAPI_MEDIA_VISION_FACIAL_LANDMARK_MODULE
  * @{
  */
 
diff --git a/include/mv_image_classification.h b/include/mv_image_classification.h
new file mode 100644 (file)
index 0000000..6c59078
--- /dev/null
@@ -0,0 +1,251 @@
+/**
+ * Copyright (c) 2023 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 __TIZEN_MEDIAVISION_MV_IMAGE_CLASSIFICATION_H__
+#define __TIZEN_MEDIAVISION_MV_IMAGE_CLASSIFICATION_H__
+
+#include <mv_common.h>
+#include <mv_image_classification_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_image_classification.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_IMAGE_CLASSIFICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates image classification object handle.
+ * @details Use this function to create an image classification object handle.
+ *          After creation the handle has to be prepared with
+ *          mv_image_classification_prepare() function to prepare
+ *          an image classification object.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[out] handle    The handle to the image classification object to be created
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @post Release @a handle by using mv_image_classification_destroy() function when
+ *       it is not needed anymore.
+ *
+ * @code
+ * #include <mv_image_classification.h>
+ * ...
+ * mv_image_classification_h handle = NULL;
+ * mv_image_classification_create(&handle);
+ * ...
+ * mv_image_classification_destroy(handle);
+ * @endcode
+ *
+ * @see mv_image_classification_destroy()
+ */
+int mv_image_classification_create(mv_image_classification_h *handle);
+
+/**
+ * @brief Destroys image classification handle and releases all its resources.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle    The handle to the image classification object to be destroyed.
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre Create an image classification handle by using mv_image_classification_create()
+ *
+ * @see mv_image_classification_create()
+ */
+int mv_image_classification_destroy(mv_image_classification_h handle);
+
+/**
+ * @brief Configures the backend to the inference handle.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_image_classification_configure(mv_image_classification_h handle);
+
+/**
+ * @brief Prepares inference.
+ * @details Use this function to prepare inference based on
+ *          the configured network.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_image_classification_prepare(mv_image_classification_h handle);
+
+/**
+ *
+ * @brief Performs inference with a given face on the @a source.
+ * @details Use this function to inference with a given source.
+ *
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the image classification object.
+ * @param[in] source         The handle to the source of the media.
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an image classification handle by calling mv_image_classification_create()
+ * @pre Prepare an image classification by calling mv_image_classification_prepare()
+ *
+ * @par Inference Example
+ * @snippet image_classification_sync.c IC sync
+ */
+int mv_image_classification_inference(mv_image_classification_h handle, mv_source_h source);
+
+/**
+ * @brief Performs asynchronously the image classification inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function operates asynchronously, so it returns immediately upon invocation.
+ *          The inference results are inserted into the outgoing queue within the framework
+ *          in the order of processing, and the results can be obtained through mv_image_classification_get_label().
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_image_classification_create()
+ * @pre Prepare an inference by calling mv_image_classification_configure()
+ * @pre Prepare an inference by calling mv_image_classification_prepare()
+ *
+ * @par Async Inference Example
+ * @snippet image_classification_async.c IC async
+ */
+int mv_image_classification_inference_async(mv_image_classification_h handle, mv_source_h source);
+
+/**
+ * @brief Gets the image classification inference result count on the @a handle.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle       The handle to the inference
+ * @param[out] frame_number       A frame number inferenced.
+ * @param[out] result_cnt  A number of results.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_image_classification_create()
+ * @pre Prepare an inference by calling mv_image_classification_configure()
+ * @pre Prepare an inference by calling mv_image_classification_prepare()
+ * @pre Request an inference by calling mv_image_classification_inference()
+ */
+int mv_image_classification_get_result_count(mv_image_classification_h handle, unsigned long *frame_number,
+                                             unsigned int *result_cnt);
+
+/**
+ * @brief Gets the image classification inference result to a given index.
+ *
+ * @since_tizen 9.0
+ *
+ * @remarks The @a label should not be released.
+ * @remarks The @a label is available until new inference is performed or @a handle is released.
+ *
+ * @param[in] handle              The handle to the inference
+ * @param[in] index               A result index.
+ * @param[out] label              A label name to a detected object.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_image_classification_create()
+ * @pre Prepare an inference by calling mv_image_classification_configure()
+ * @pre Prepare an inference by calling mv_image_classification_prepare()
+ * @pre Request an inference by calling mv_image_classification_inference()
+ * @pre Get result count by calling mv_image_classification_get_result_count()
+ *
+ * @code
+ * #include <mv_image_classification.h>
+ * #include <stdio.h>
+ * ...
+ * mv_image_classification_h handle = NULL;
+ * mv_image_classification_create(&handle);
+ * ...
+ * // perform inference
+ * ...
+ * unsigned long frame_number;
+ * unsigned int cnt;
+ * mv_image_classification_get_result_count(handle, &frame_number, &cnt);
+ * for (unsigned long idx = 0; idx < cnt; ++idx) {
+ *      const char *label = NULL;
+ *      mv_image_classification_get_label(handle, idx, &label);
+ *      printf("frame number = %ld, label = %s\n", frame_number, label);
+ * }
+ * mv_image_classification_destroy(handle);
+ * @endcode
+ */
+int mv_image_classification_get_label(mv_image_classification_h handle, unsigned int index, const char **label);
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_IMAGE_CLASSIFICATION_H__ */
index b4f526bd56373b01668bf0e0be8d3c0b2a816218..442b3f86b0139b02003bdfbe5396c95109b2fd96 100644 (file)
 extern "C" {
 #endif /* __cplusplus */
 
-/**
-        * @brief Create image classification object handle.
-        * @details Use this function to create an image classification object handle.
-        *          After creation the handle has to be prepared with
-        *          @ref mv_image_classification_prepare() function to prepare
-        *               an image classification object.
-        *
-        * @since_tizen 9.0
-        *
-        * @param[out] out_handle    The handle to the image classification object to be created
-        *
-        * @return @c 0 on success, otherwise a negative error value
-        * @retval #MEDIA_VISION_ERROR_NONE Successful
-        * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
-        * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
-        *
-        * @post Release @a handle by using
-        *       @ref mv_image_classification_destroy() function when it is not needed
-        *       anymore
-        *
-        * @see mv_image_classification_destroy()
-        */
-int mv_image_classification_create(mv_image_classification_h *out_handle);
-
-/**
-        * @brief Destroy image classification handle and releases all its resources.
-        *
-        * @since_tizen 9.0
-        *
-        * @param[in] handle    The handle to the image classification object to be destroyed.
-        *
-        * @return @c 0 on success, otherwise a negative error value
-        * @retval #MEDIA_VISION_ERROR_NONE Successful
-        * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
-        *
-        * @pre Create an image classification handle by using @ref mv_image_classification_create()
-        *
-        * @see mv_image_classification_create()
-        */
-int mv_image_classification_destroy(mv_image_classification_h handle);
-
-/**
-        * @brief Configure the backend to the inference handle
-        *
-        * @since_tizen 9.0
-        *
-        * @param [in] handle         The handle to the inference
-        *
-        * @return @c 0 on success, otherwise a negative error value
-        * @retval #MEDIA_VISION_ERROR_NONE Successful
-        * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
-        * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
-        */
-int mv_image_classification_configure(mv_image_classification_h handle);
-
-/**
-        * @brief Prepare inference.
-        * @details Use this function to prepare inference based on
-        *          the configured network.
-        *
-        * @since_tizen 9.0
-        *
-        * @param [in] handle         The handle to the inference
-        *
-        * @return @c 0 on success, otherwise a negative error value
-        * @retval #MEDIA_VISION_ERROR_NONE Successful
-        * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
-        * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
-        */
-int mv_image_classification_prepare(mv_image_classification_h handle);
-
-/**
-        *
-        * @brief Inference with a given face on the @a source
-        * @details Use this function to inference with a given source.
-        *
-        *
-        * @since_tizen 9.0
-        *
-        * @param[in] handle         The handle to the image classification object.
-        * @param[in] source         The handle to the source of the media.
-        *
-        * @return @c 0 on success, otherwise a negative error value
-        * @retval #MEDIA_VISION_ERROR_NONE Successful
-        * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
-        * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
-        *                                                  isn't supported
-        * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
-        *
-        * @pre Create a source handle by calling @ref mv_create_source()
-        * @pre Create an image classification handle by calling @ref mv_image_classification_create()
-        * @pre Prepare an image classification by calling @ref mv_image_classification_prepare()
-        */
-int mv_image_classification_inference(mv_image_classification_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Performs asynchronously the image classification inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function operates asynchronously, so it returns immediately upon invocation.
- *          The inference results are inserted into the outgoing queue within the framework
- *          in the order of processing, and the results can be obtained through mv_image_classification_get_label().
- *
- * @param[in] handle         The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_image_classification_create()
- * @pre Prepare an inference by calling mv_image_classification_configure()
- * @pre Prepare an inference by calling mv_image_classification_prepare()
- */
-int mv_image_classification_inference_async(mv_image_classification_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Gets the image classification inference result count on the @a source.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle       The handle to the inference
- * @param[out] frame_number       A frame number inferenced.
- * @param[out] result_cnt  A number of results.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_image_classification_create()
- * @pre Prepare an inference by calling mv_image_classification_configure()
- * @pre Prepare an inference by calling mv_image_classification_prepare()
- * @pre Request an inference by calling mv_image_classification_inference()
- */
-int mv_image_classification_get_result_count(mv_image_classification_h handle, unsigned long *frame_number,
-                                                                                        unsigned int *result_cnt);
-
-/**
- * @internal
- * @brief Gets the image classification inference result to a given index.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle              The handle to the inference
- * @param[in] index               A result index.
- * @param[out] label              A label name to a detected object.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_image_classification_create()
- * @pre Prepare an inference by calling mv_image_classification_configure()
- * @pre Prepare an inference by calling mv_image_classification_prepare()
- * @pre Request an inference by calling mv_image_classification_inference()
- * @pre Get result count by calling mv_image_classification_get_result_count()
- */
-int mv_image_classification_get_label(mv_image_classification_h handle, unsigned int index, const char **label);
-
 /**
         * @brief Set user-given model information.
         * @details Use this function to change the model information instead of default one after calling @ref mv_image_classification_create().
index a17d395994eac9ae720cccaad46787fbe0b517e6..2ecee02d4e256cde58a9024b7f32ffb9a6476135 100644 (file)
@@ -34,7 +34,7 @@ extern "C" {
  */
 
 /**
- * @brief The object detection 3d object handle.
+ * @brief The image classification object handle.
  *
  * @since_tizen 9.0
  */
diff --git a/include/mv_object_detection.h b/include/mv_object_detection.h
new file mode 100644 (file)
index 0000000..94e05aa
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2022 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 __TIZEN_MEDIAVISION_MV_OBJECT_DETECTION_H__
+#define __TIZEN_MEDIAVISION_MV_OBJECT_DETECTION_H__
+
+#include <mv_common.h>
+#include <mv_object_detection_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_object_detection.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a inference handle for object detection object.
+ * @details Use this function to create a inference handle. After the creation
+ *          the object detection 3d task has to be prepared with
+ *          mv_object_detection_prepare() function to prepare a network
+ *          for the inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @remarks The @a infer should be released using mv_object_detection_destroy().
+ *
+ * @param[out] infer    The handle to the inference to be created.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @code
+ * #include <mv_object_detection.h>
+ * ...
+ * mv_object_detection_h handle = NULL;
+ * mv_object_detection_create(&handle);
+ * ...
+ * mv_object_detection_destroy(handle);
+ * @endcode
+ *
+ * @see mv_object_detection_destroy()
+ * @see mv_object_detection_prepare()
+ */
+int mv_object_detection_create(mv_object_detection_h *infer);
+
+/**
+ * @brief Destroys inference handle and releases all its resources.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] infer    The handle to the inference to be destroyed.
+ *
+ * @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
+ *
+ * @pre Create inference handle by using mv_object_detection_create()
+ *
+ * @see mv_object_detection_create()
+ */
+int mv_object_detection_destroy(mv_object_detection_h infer);
+
+/**
+ * @brief Configures the backend for the object detection inference.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] infer         The handle to the inference
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_object_detection_configure(mv_object_detection_h infer);
+
+/**
+ * @brief Prepares the object detection inference.
+ * @details Use this function to prepare the object detection inference based on
+ *          the configured network.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] infer         The handle to the inference.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
+ */
+int mv_object_detection_prepare(mv_object_detection_h infer);
+
+/**
+ * @brief Performs the object detection inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function is synchronous and may take considerable time to run.
+ *
+ * @param[in] infer          The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_object_detection_create()
+ * @pre Prepare an inference by calling mv_object_detection_configure()
+ * @pre Prepare an inference by calling mv_object_detection_prepare()
+ *
+ * @par Inference Example
+ * @snippet object_detection_sync.c OD sync
+ */
+int mv_object_detection_inference(mv_object_detection_h infer, mv_source_h source);
+
+/**
+ * @brief Performs asynchronously the object detection inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function operates asynchronously, so it returns immediately upon invocation.
+ *          The inference results are inserted into the outgoing queue within the framework
+ *          in the order of processing, and the results can be obtained through
+ *          mv_object_detection_get_result_count() and mv_object_detection_get_label().
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_object_detection_create()
+ * @pre Prepare an inference by calling mv_object_detection_configure()
+ * @pre Prepare an inference by calling mv_object_detection_prepare()
+ *
+ * @par Async Inference Example
+ * @snippet object_detection_async.c OD async
+ */
+int mv_object_detection_inference_async(mv_object_detection_h handle, mv_source_h source);
+
+/**
+ * @brief Gets the object detection inference result on the @a handle.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle          The handle to the inference
+ * @param[out] frame_number   A frame number inferenced.
+ * @param[out] result_cnt     A number of results.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_object_detection_create()
+ * @pre Prepare an inference by calling mv_object_detection_configure()
+ * @pre Prepare an inference by calling mv_object_detection_prepare()
+ * @pre Request an inference by calling mv_object_detection_inference()
+ */
+int mv_object_detection_get_result_count(mv_object_detection_h handle, unsigned long *frame_number,
+                                         unsigned int *result_cnt);
+
+/**
+ * @brief Gets a bound box to detected object region.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle              The handle to the inference
+ * @param[in] index               A result index.
+ * @param[out] left               An left position array to bound boxes.
+ * @param[out] top                An top position array to bound boxes.
+ * @param[out] right              An right position array to bound boxes.
+ * @param[out] bottom             An bottom position array to bound boxes.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_object_detection_create()
+ * @pre Prepare an inference by calling mv_object_detection_configure()
+ * @pre Prepare an inference by calling mv_object_detection_prepare()
+ * @pre Prepare an inference by calling mv_object_detection_inference()
+ */
+int mv_object_detection_get_bound_box(mv_object_detection_h handle, unsigned int index, int *left, int *top, int *right,
+                                 int *bottom);
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_OBJECT_DETECTION_H__ */
index 54cfa8d58361e126a899a4c0c10ac33ddecd71ba..80d83f222a08b0360a31b50763b9d21046922e2b 100644 (file)
@@ -35,50 +35,6 @@ extern "C" {
  * @{
  */
 
-/**
- * @internal
- * @brief Creates a inference handle for object detection object.
- * @details Use this function to create a inference handle. After the creation
- *          the object detection 3d task has to be prepared with
- *          mv_object_detection_prepare() function to prepare a network
- *          for the inference.
- *
- * @since_tizen 9.0
- *
- * @remarks The @a infer should be released using mv_object_detection_destroy().
- *
- * @param[out] infer    The handle to the inference to be created.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @see mv_object_detection_destroy()
- * @see mv_object_detection_prepare()
- */
-int mv_object_detection_create(mv_object_detection_h *infer);
-
-/**
- * @internal
- * @brief Destroys inference handle and releases all its resources.
- *
- * @since_tizen 9.0
- *
- * @param[in] infer    The handle to the inference to be destroyed.
- *
- * @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
- *
- * @pre Create inference handle by using mv_object_detection_create()
- *
- * @see mv_object_detection_create()
- */
-int mv_object_detection_destroy(mv_object_detection_h infer);
-
 /**
  * @internal
  * @brief Set user-given model information.
@@ -102,150 +58,6 @@ int mv_object_detection_destroy(mv_object_detection_h infer);
 int mv_object_detection_set_model(mv_object_detection_h handle, const char *model_name, const char *model_file,
                                                                  const char *meta_file, const char *label_file);
 
-/**
- * @internal
- * @brief Configures the backend for the object detection inference.
- *
- * @since_tizen 9.0
- *
- * @param [in] infer         The handle to the inference
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- */
-int mv_object_detection_configure(mv_object_detection_h infer);
-
-/**
- * @internal
- * @brief Prepares the object detection inference
- * @details Use this function to prepare the object detection inference based on
- *          the configured network.
- *
- * @since_tizen 9.0
- *
- * @param[in] infer         The handle to the inference.
- *
- * @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_PERMISSION_DENIED Permission denied
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_INVALID_OPERATION Invalid operation
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Not supported format
- */
-int mv_object_detection_prepare(mv_object_detection_h infer);
-
-/**
- * @internal
- * @brief Performs the object detection inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function is synchronous and may take considerable time to run.
- *
- * @param[in] source         The handle to the source of the media
- * @param[in] infer          The handle to the inference
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_object_detect_create()
- * @pre Prepare an inference by calling mv_object_detect_configure()
- * @pre Prepare an inference by calling mv_object_detect_prepare()
- */
-int mv_object_detection_inference(mv_object_detection_h infer, mv_source_h source);
-
-/**
- * @internal
- * @brief Performs asynchronously the object detection inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function operates asynchronously, so it returns immediately upon invocation.
- *          The inference results are inserted into the outgoing queue within the framework
- *          in the order of processing, and the results can be obtained through mv_object_detection_get_result()
- *          and mv_object_detection_get_label().
- *
- * @param[in] handle         The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_object_detect_create()
- * @pre Prepare an inference by calling mv_object_detect_configure()
- * @pre Prepare an inference by calling mv_object_detect_prepare()
- */
-int mv_object_detection_inference_async(mv_object_detection_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Gets the object detection inference result on the @a source.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle          The handle to the inference
- * @param[out] frame_number   A frame number inferenced.
- * @param[out] result_cnt     A number of results.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_object_detect_create()
- * @pre Prepare an inference by calling mv_object_detect_configure()
- * @pre Prepare an inference by calling mv_object_detect_prepare()
- * @pre Request an inference by calling mv_object_detect_inference()
- */
-int mv_object_detection_get_result_count(mv_object_detection_h handle, unsigned long *frame_number,
-                                                                                unsigned int *result_cnt);
-
-/**
- * @internal
- * @brief Gets a bound box to detected object region
- *
- * @since_tizen 9.0
- *
- * @param[in] handle              The handle to the inference
- * @param[in] index               A result index.
- * @param[out] left               An left position array to bound boxes.
- * @param[out] top                An top position array to bound boxes.
- * @param[out] right              An right position array to bound boxes.
- * @param[out] bottom             An bottom position array to bound boxes.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_object_detect_create()
- * @pre Prepare an inference by calling mv_object_detect_configure()
- * @pre Prepare an inference by calling mv_object_detect_prepare()
- * @pre Prepare an inference by calling mv_object_detect_inference()
- */
-int mv_object_detection_get_bbox(mv_object_detection_h handle, unsigned int index, int *left, int *top, int *right,
-                                                                int *bottom);
-
 /**
  * @internal
  * @brief Set user-given inference engine and device types for inference.
index a9490a5c9771eeb1dbfe767e32e9a6f8981b3922..0e7b921f78483f0da72492da12be46726d268b71 100644 (file)
@@ -25,11 +25,11 @@ extern "C" {
 
 /**
  * @file   mv_object_detection_type.h
- * @brief  This file contains the face recognition handle for Mediavision.
+ * @brief  This file contains the object detection handle for Mediavision.
  */
 
 /**
- * @addtogroup CAPI_MEDIA_VISION_OBJECT_DETECT_MODULE
+ * @addtogroup CAPI_MEDIA_VISION_OBJECT_DETECTION_MODULE
  * @{
  */
 
@@ -40,8 +40,6 @@ extern "C" {
  */
 typedef void *mv_object_detection_h;
 
-typedef void (*mv_completion_cb)(mv_object_detection_h handle, void *user_data);
-
 /**
  * @}
  */
diff --git a/include/mv_pose_landmark.h b/include/mv_pose_landmark.h
new file mode 100644 (file)
index 0000000..588fb88
--- /dev/null
@@ -0,0 +1,244 @@
+/**
+ * Copyright (c) 2023 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 __TIZEN_MEDIAVISION_MV_POSE_LANDMARK_H__
+#define __TIZEN_MEDIAVISION_MV_POSE_LANDMARK_H__
+
+#include <mv_common.h>
+#include <mv_pose_landmark_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_object_detection.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_POSE_LANDMARK_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates pose landmark object handle.
+ * @details Use this function to create an pose landmark object handle.
+ *          After creation the handle has to be prepared with
+ *          mv_pose_landmark_prepare() function to prepare
+ *          a pose landmark object.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[out] handle    The handle to the pose landmark object to be created
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @post Release @a handle by using
+ *       mv_pose_landmark_destroy() function when it is not needed
+ *       anymore
+ *
+ * @code
+ * #include <mv_pose_landmark.h>
+ * ...
+ * mv_pose_landmark_h handle = NULL;
+ * mv_pose_landmark_create(&handle);
+ * ...
+ * mv_pose_landmark_destroy(handle);
+ * @endcode
+ *
+ * @see mv_pose_landmark_destroy()
+ */
+int mv_pose_landmark_create(mv_pose_landmark_h *handle);
+
+/**
+ * @brief Destroys pose landmark handle and releases all its resources.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle    The handle to the pose landmark object to be destroyed.
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre Create an pose landmark handle by using mv_pose_landmark_create()
+ *
+ * @see mv_pose_landmark_create()
+ */
+int mv_pose_landmark_destroy(mv_pose_landmark_h handle);
+
+/**
+ * @brief Configures the backend to the inference handle.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_pose_landmark_configure(mv_pose_landmark_h handle);
+
+/**
+ * @brief Prepares inference.
+ * @details Use this function to prepare inference based on
+ *          the configured network.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int mv_pose_landmark_prepare(mv_pose_landmark_h handle);
+
+/**
+ *
+ * @brief Inferences with a given facial on the @a source.
+ * @details Use this function to inference with a given source.
+ *
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the pose landmark object.
+ * @param[in] source         The handle to the source of the media.
+ *
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #MEDIA_VISION_ERROR_NONE Successful
+ * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an pose landmark handle by calling mv_pose_landmark_create()
+ * @pre Prepare an inference by calling mv_object_detect_configure()
+ * @pre Prepare an pose landmark by calling mv_pose_landmark_prepare()
+ *
+ * @par Inference Example
+ * @snippet pose_landmark_sync.c PLD sync
+ */
+int mv_pose_landmark_inference(mv_pose_landmark_h handle, mv_source_h source);
+
+/**
+ * @brief Performs asynchronously the pose landmark inference on the @a source.
+ *
+ * @since_tizen 9.0
+ * @remarks This function operates asynchronously, so it returns immediately upon invocation.
+ *          The inference results are inserted into the outgoing queue within the framework
+ *          in the order of processing, and the results can be obtained through mv_pose_landmark_get_result_count()
+ *          and mv_pose_landmark_get_position().
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[in] source         The handle to the source of the media
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
+ *                                                  isn't supported
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_pose_landmark_create()
+ * @pre Prepare an inference by calling mv_pose_landmark_configure()
+ * @pre Prepare an inference by calling mv_pose_landmark_prepare()
+ *
+ * @par Async Inference Example
+ * @snippet pose_landmark_async.c PLD async
+ */
+int mv_pose_landmark_inference_async(mv_pose_landmark_h handle, mv_source_h source);
+
+/**
+ * @brief Gets the result count to objects.
+ *
+ * @since_tizen 9.0
+ *
+ * @param[in] handle         The handle to the inference
+ * @param[out] frame_number  A frame number inferenced.
+ * @param[out] result_cnt    A number of results.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_pose_landmark_create()
+ * @pre Prepare an inference by calling mv_pose_landmark_configure()
+ * @pre Prepare an inference by calling mv_pose_landmark_prepare()
+ * @pre Request an inference by calling mv_pose_landmark_inference()
+ */
+int mv_pose_landmark_get_result_count(mv_pose_landmark_h handle, unsigned long *frame_number, unsigned int *result_cnt);
+
+/**
+ * @brief Gets the pose landmark position values to a given index.
+ *
+ * @since_tizen 9.0
+ * @remarks pos_x and pos_y arrays are allocated internally by the framework and will remain valid
+ *          until the handle is released.
+ *          Please do not deallocate them directly, and if you want to use them after the handle is released,
+ *          please copy them to user memory and use the copy.
+ *
+ *          This function operates differently depending on the inference request method.
+ *          - After mv_facial_landmark_inference() calls, this function returns facial landmark positions immediately.
+ *          - After mv_facial_landmark_inference_async() calls, this function can be blocked until the asynchronous inference request is completed
+ *            or the timeout occurs if no result within 3 seconds.
+ *
+ *          Additionally, after calling the mv_facial_landmark_inference_async function, the function operates
+ *          in asynchronous mode until the handle is released.
+ *
+ * @param[in] handle               The handle to the inference
+ * @param[in] index                A result index.
+ * @param[out] pos_x               An array containing x-coordinate values.
+ * @param[out] pos_y               An array containing y-coordinate values.
+ *
+ * @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
+ * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
+ *
+ * @pre Create a source handle by calling mv_create_source()
+ * @pre Create an inference handle by calling mv_pose_landmark_create()
+ * @pre Prepare an inference by calling mv_pose_landmark_configure()
+ * @pre Prepare an inference by calling mv_pose_landmark_prepare()
+ * @pre Prepare an inference by calling mv_pose_landmark_inference()
+ * @pre Get result count by calling mv_pose_landmark_get_result_count()
+ */
+int mv_pose_landmark_get_position(mv_pose_landmark_h handle, unsigned int index, unsigned int *pos_x,
+                                  unsigned int *pos_y);
+/**
+ * @}
+ */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_MV_POSE_LANDMARK_H__ */
index 2943892285d95c3cf77fc44e401e6b9dceab908f..9d17dc94281716747e53bcaecae32eabd3072039 100644 (file)
 extern "C" {
 #endif /* __cplusplus */
 
-/**
- * @brief Creates pose landmark object handle.
- * @details Use this function to create an pose landmark object handle.
- *          After creation the handle has to be prepared with
- *          @ref mv_pose_landmark_prepare() function to prepare
- *               an pose landmark object.
- *
- * @since_tizen 9.0
- *
- * @param[out] out_handle    The handle to the pose landmark object to be created
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @post Release @a handle by using
- *       @ref mv_pose_landmark_destroy() function when it is not needed
- *       anymore
- *
- * @see mv_pose_landmark_destroy()
- */
-int mv_pose_landmark_create(mv_pose_landmark_h *out_handle);
-
-/**
- * @brief Destroys pose landmark handle and releases all its resources.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle    The handle to the pose landmark object to be destroyed.
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @pre Create an pose landmark handle by using @ref mv_pose_landmark_create()
- *
- * @see mv_pose_landmark_create()
- */
-int mv_pose_landmark_destroy(mv_pose_landmark_h handle);
-
 /**
  * @brief Set user-given model information.
  * @details Use this function to change the model information instead of default one after calling @ref mv_pose_landmark_create().
@@ -87,151 +46,6 @@ int mv_pose_landmark_destroy(mv_pose_landmark_h handle);
 int mv_pose_landmark_set_model(mv_pose_landmark_h handle, const char *model_name, const char *model_file,
                                                           const char *meta_file, const char *label_file);
 
-/**
- * @brief Configures the backend to the inference handle
- *
- * @since_tizen 9.0
- *
- * @param [in] handle         The handle to the inference
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED Not supported
- */
-int mv_pose_landmark_configure(mv_pose_landmark_h handle);
-
-/**
- * @brief Prepares inference.
- * @details Use this function to prepare inference based on
- *          the configured network.
- *
- * @since_tizen 9.0
- *
- * @param [in] handle         The handle to the inference
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_INVALID_DATA Invalid model data
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- */
-int mv_pose_landmark_prepare(mv_pose_landmark_h handle);
-
-/**
- *
- * @brief Inferences with a given facial on the @a source
- * @details Use this function to inference with a given source.
- *
- *
- * @since_tizen 9.0
- *
- * @param[in] handle         The handle to the pose landmark object.
- * @param[in] source         The handle to the source of the media.
- *
- * @return @c 0 on success, otherwise a negative error value
- * @retval #MEDIA_VISION_ERROR_NONE Successful
- * @retval #MEDIA_VISION_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- * @retval #MEDIA_VISION_ERROR_OUT_OF_MEMORY Out of memory
- *
- * @pre Create a source handle by calling @ref mv_create_source()
- * @pre Create an pose landmark handle by calling @ref mv_pose_landmark_create()
- * @pre Prepare an inference by calling mv_object_detect_configure()
- * @pre Prepare an pose landmark by calling @ref mv_pose_landmark_prepare()
- */
-int mv_pose_landmark_inference(mv_pose_landmark_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Performs asynchronously the pose landmark inference on the @a source.
- *
- * @since_tizen 9.0
- * @remarks This function operates asynchronously, so it returns immediately upon invocation.
- *          The inference results are inserted into the outgoing queue within the framework
- *          in the order of processing, and the results can be obtained through mv_pose_landmark_get_pos().
- *
- * @param[in] handle         The handle to the inference
- * @param[in] source         The handle to the source of the media
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- * @retval #MEDIA_VISION_ERROR_NOT_SUPPORTED_FORMAT Source colorspace
- *                                                  isn't supported
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_pose_landmark_create()
- * @pre Prepare an inference by calling mv_pose_landmark_configure()
- * @pre Prepare an inference by calling mv_pose_landmark_prepare()
- */
-int mv_pose_landmark_inference_async(mv_pose_landmark_h handle, mv_source_h source);
-
-/**
- * @internal
- * @brief Gets the result count to objects.
- *
- * @since_tizen 9.0
- *
- * @param[in] handle         The handle to the inference
- * @param[out] frame_number  A frame number inferenced.
- * @param[out] result_cnt    A number of results.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_pose_landmark_create()
- * @pre Prepare an inference by calling mv_pose_landmark_configure()
- * @pre Prepare an inference by calling mv_pose_landmark_prepare()
- * @pre Request an inference by calling mv_pose_landmark_inference()
- */
-int mv_pose_landmark_get_result_count(mv_pose_landmark_h handle, unsigned long *frame_number, unsigned int *result_cnt);
-
-/**
- * @internal
- * @brief Gets the pose landmark position values to a given index.
- *
- * @since_tizen 9.0
- * @remarks pos_x and pos_y arrays are allocated internally by the framework and will remain valid
- *          until the handle is released.
- *          Please do not deallocate them directly, and if you want to use them after the handle is released,
- *          please copy them to user memory and use the copy.
- *
- *          This function operates differently depending on the inference request method.
- *          - After mv_facial_landmark_inference() calls, this function returns facial landmark positions immediately.
- *          - After mv_facial_landmark_inference_async() calls, this function can be blocked until the asynchronous inference request is completed
- *            or the timeout occurs if no result within 3 seconds.
- *
- *          Additionally, after calling the mv_facial_landmark_inference_async function, the function operates
- *          in asynchronous mode until the handle is released.
- *
- * @param[in] handle               The handle to the inference
- * @param[in] index                A result index.
- * @param[out] pos_x               An array containing x-coordinate values.
- * @param[out] pos_y               An array containing y-coordinate values.
- *
- * @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
- * @retval #MEDIA_VISION_ERROR_INTERNAL          Internal error
- *
- * @pre Create a source handle by calling mv_create_source()
- * @pre Create an inference handle by calling mv_pose_landmark_create()
- * @pre Prepare an inference by calling mv_pose_landmark_configure()
- * @pre Prepare an inference by calling mv_pose_landmark_prepare()
- * @pre Prepare an inference by calling mv_pose_landmark_inference()
- * @pre Get result count by calling mv_pose_landmark_get_result_count()
- */
-int mv_pose_landmark_get_position(mv_pose_landmark_h handle, unsigned int index, unsigned int *pos_x,
-                                                                 unsigned int *pos_y);
-
 /**
  * @brief Set user-given backend and device types for inference.
  * @details Use this function to change the backend and device types for inference instead of default ones after calling @ref mv_pose_landmark_create().
index b9f29b4f0358fe941a647a2a4dcd4216005950c5..81ccfca9922161daf19cfa9e6a81686df8e4b4d6 100644 (file)
@@ -18,5 +18,6 @@ install(
        DIRECTORY ${PROJECT_SOURCE_DIR}/../../include/ DESTINATION include/media
        FILES_MATCHING
        PATTERN "mv_image_classification_internal.h"
+       PATTERN "mv_image_classification.h"
        PATTERN "mv_image_classification_type.h"
        )
\ No newline at end of file
index 104a9e26884c8ff7efc8b93d4f2034c0fda1b2d5..18e2583add307ea2ed09435addeb1c6f1c2d02dd 100644 (file)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include "mv_image_classification.h"
 #include "Context.h"
 #include "ITask.h"
 #include "ImageClassificationAdapter.h"
@@ -38,7 +39,8 @@ using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
 
-static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference.image" };
+static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference",
+                                                                         "http://tizen.org/feature/vision.inference.image" };
 static const size_t num_keys = sizeof(feature_keys) / sizeof(char *);
 
 int mv_image_classification_create(mv_image_classification_h *out_handle)
index 35ad9c3e44c093d73367c85b6bb2e94c4aabb3b4..104e4661df3f7e11011ef724905081123b06ac45 100644 (file)
@@ -18,7 +18,9 @@ install(
        DIRECTORY ${PROJECT_SOURCE_DIR}/../../include/ DESTINATION include/media
        FILES_MATCHING
        PATTERN "mv_facial_landmark_internal.h"
+       PATTERN "mv_facial_landmark.h"
        PATTERN "mv_facial_landmark_type.h"
        PATTERN "mv_pose_landmark_internal.h"
+       PATTERN "mv_pose_landmark.h"
        PATTERN "mv_pose_landmark_type.h"
        )
index 8020ab03fe6f0d1c92df640ead4fd4c8b16de626..3149688fd41bba2281dcbf0f4b9265c6cd61da1a 100644 (file)
  * limitations under the License.
  */
 
+#include "mv_facial_landmark_internal.h"
+#include "mv_facial_landmark.h"
 #include "Context.h"
 #include "FacialLandmarkAdapter.h"
 #include "ITask.h"
 #include "MvMlException.h"
 #include "landmark_detection_type.h"
-#include "mv_facial_landmark_internal.h"
 #include "mv_feature_key.h"
 #include "mv_private.h"
 #include "native_capi.h"
@@ -38,7 +39,7 @@ using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
 
-static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference.image",
+static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference",
                                                                          "http://tizen.org/feature/vision.inference.face" };
 static const size_t num_keys = sizeof(feature_keys) / sizeof(char *);
 
index e7fe6d9ee0bbf0dbf45909f2917feb861dd2900b..d78498cc5c09d76320e84dd2c751d4c457986753 100644 (file)
  * limitations under the License.
  */
 
+#include "mv_pose_landmark_internal.h"
+#include "mv_pose_landmark.h"
 #include "Context.h"
 #include "ITask.h"
 #include "MvMlException.h"
 #include "PoseLandmarkAdapter.h"
 #include "landmark_detection_type.h"
 #include "mv_feature_key.h"
-#include "mv_pose_landmark_internal.h"
 #include "mv_private.h"
 #include "native_capi.h"
 
@@ -38,7 +39,7 @@ using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
 
-static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference.image",
+static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference",
                                                                          "http://tizen.org/feature/vision.inference.face" };
 static const size_t num_keys = sizeof(feature_keys) / sizeof(char *);
 
index 121791ca55cae7200047d6658454b849d8a67630..588813a86a12666ccf8c4374520497f418eb446b 100644 (file)
@@ -18,8 +18,10 @@ install(
        DIRECTORY ${PROJECT_SOURCE_DIR}/../../include/ DESTINATION include/media
        FILES_MATCHING
        PATTERN "mv_object_detection_internal.h"
+       PATTERN "mv_object_detection.h"
        PATTERN "mv_object_detection_type.h"
        PATTERN "mv_face_detection_internal.h"
+       PATTERN "mv_face_detection.h"
        PATTERN "mv_face_detection_type.h"
        )
 install(
index e07cd527a3a7a9b4ea1c5f16f02e019d5c42a6de..41d22373d5bd00dd5298021b94c93d31f1c602cf 100644 (file)
  * limitations under the License.
  */
 
+#include "mv_face_detection_internal.h"
+#include "mv_face_detection.h"
 #include "Context.h"
 #include "FaceDetectionAdapter.h"
 #include "ITask.h"
 #include "MvMlException.h"
-#include "mv_face_detection_internal.h"
 #include "mv_feature_key.h"
 #include "mv_private.h"
 #include "native_capi.h"
@@ -40,7 +41,7 @@ using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
 
-static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference.image",
+static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference",
                                                                          "http://tizen.org/feature/vision.inference.face" };
 static const size_t num_keys = sizeof(feature_keys) / sizeof(char *);
 
@@ -320,7 +321,7 @@ int mv_face_detection_get_result_count(mv_face_detection_h handle, unsigned long
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int mv_face_detection_get_bbox(mv_face_detection_h handle, unsigned int index, int *left, int *top, int *right,
+int mv_face_detection_get_bound_box(mv_face_detection_h handle, unsigned int index, int *left, int *top, int *right,
                                                           int *bottom)
 {
        MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
index 3e2be8ae25db3ab093255973663b6fed785f1e12..5ce06a456737eb4aaa429c0bfc4310fc1823583e 100644 (file)
  * limitations under the License.
  */
 
+#include "mv_object_detection_internal.h"
+#include "mv_object_detection.h"
 #include "Context.h"
 #include "ITask.h"
 #include "MvMlException.h"
 #include "ObjectDetectionAdapter.h"
 #include "mv_feature_key.h"
-#include "mv_object_detection_internal.h"
 #include "mv_private.h"
 #include "native_capi.h"
 #include "object_detection_type.h"
@@ -40,8 +41,8 @@ using namespace mediavision::machine_learning;
 using namespace MediaVision::Common;
 using namespace mediavision::machine_learning::exception;
 
-static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference.image",
-                                                                         "http://tizen.org/feature/vision.inference.face" };
+static const char *feature_keys[] = { "http://tizen.org/feature/vision.inference",
+                                                                         "http://tizen.org/feature/vision.inference.image" };
 static const size_t num_keys = sizeof(feature_keys) / sizeof(char *);
 
 int mv_object_detection_create(mv_object_detection_h *handle)
@@ -318,7 +319,7 @@ int mv_object_detection_get_result_count(mv_object_detection_h handle, unsigned
        return MEDIA_VISION_ERROR_NONE;
 }
 
-int mv_object_detection_get_bbox(mv_object_detection_h handle, unsigned int index, int *left, int *top, int *right,
+int mv_object_detection_get_bound_box(mv_object_detection_h handle, unsigned int index, int *left, int *top, int *right,
                                                                 int *bottom)
 {
        MEDIA_VISION_SUPPORT_CHECK(mv_check_feature_key(feature_keys, num_keys, true));
index bccb40e71928dfc5fdededdb24daa224438757c4..f4f9840682e7a5c4eed7be60fc1314314092b860 100644 (file)
@@ -423,13 +423,16 @@ find . -name '*.gcno' -not -path "./test/*" -not -path "./mv_machine_learning/*"
 %endif
 %if "%{enable_ml_image_classification}" == "1"
 %{_includedir}/media/mv_image_classification_internal.h
+%{_includedir}/media/mv_image_classification.h
 %{_includedir}/media/mv_image_classification_type.h
 %{_libdir}/pkgconfig/*image-classification.pc
 %endif
 %if "%{enable_ml_object_detection}" == "1"
 %{_includedir}/media/mv_object_detection_internal.h
+%{_includedir}/media/mv_object_detection.h
 %{_includedir}/media/mv_object_detection_type.h
 %{_includedir}/media/mv_face_detection_internal.h
+%{_includedir}/media/mv_face_detection.h
 %{_includedir}/media/mv_face_detection_type.h
 %{_includedir}/media/IObjectDetection.h
 %{_includedir}/media/object_detection_type.h
@@ -442,8 +445,10 @@ find . -name '*.gcno' -not -path "./test/*" -not -path "./mv_machine_learning/*"
 %endif
 %if "%{enable_ml_landmark_detection}" == "1"
 %{_includedir}/media/mv_facial_landmark_internal.h
+%{_includedir}/media/mv_facial_landmark.h
 %{_includedir}/media/mv_facial_landmark_type.h
 %{_includedir}/media/mv_pose_landmark_internal.h
+%{_includedir}/media/mv_pose_landmark.h
 %{_includedir}/media/mv_pose_landmark_type.h
 %{_libdir}/pkgconfig/*landmark-detection.pc
 %endif
index ba3037bc1c95ae6acdb2a7e79f91b550d8ee54a6..7b297b028debf0c95f84f4ea9b34b6dbac375314 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "ImageHelper.h"
 #include "mv_image_classification_internal.h"
+#include "mv_image_classification.h"
 
 #define IMAGE_PATH TEST_RES_PATH "/res/inference/images/banana.jpg"
 
index e292a53fe149e39217200f3ffb8abe2800a0e6ab..7f0ef2775332abcf7b9768a75e7be5d16e06c7d8 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "ImageHelper.h"
 #include "mv_image_classification_internal.h"
+#include "mv_image_classification.h"
 
 #define IMAGE_PATH TEST_RES_PATH "/res/inference/images/banana.jpg"
 #define MAX_INFERENCE_ITERATION 50
index 752553c0dc4e70b3ca8b0411c765929f8785806d..134a1cf49f60dccee861ebd78d778ed8fcae70a8 100644 (file)
@@ -22,7 +22,9 @@
 
 #include "ImageHelper.h"
 #include "mv_facial_landmark_internal.h"
+#include "mv_facial_landmark.h"
 #include "mv_pose_landmark_internal.h"
+#include "mv_pose_landmark.h"
 
 #define IMG_FACE TEST_RES_PATH "/res/inference/images/faceLandmark.jpg"
 #define IMG_POSE TEST_RES_PATH "/res/inference/images/poseLandmark.jpg"
index 93e7f3fc8c2978189b336dd850d029ccac9004e7..caa4437b5f1345349d127dac504b1322e1cbbd32 100644 (file)
@@ -23,7 +23,9 @@
 
 #include "ImageHelper.h"
 #include "mv_facial_landmark_internal.h"
+#include "mv_facial_landmark.h"
 #include "mv_pose_landmark_internal.h"
+#include "mv_pose_landmark.h"
 
 #define IMG_FACE TEST_RES_PATH "/res/inference/images/faceLandmark.jpg"
 #define IMG_POSE TEST_RES_PATH "/res/inference/images/poseLandmark.jpg"
index aaee147b8d1631ec6bcc92fb86cc8b39c13c324d..b9432d62193c01071c7f42631052aa3146950fb7 100644 (file)
@@ -22,7 +22,9 @@
 
 #include "ImageHelper.h"
 #include "mv_face_detection_internal.h"
+#include "mv_face_detection.h"
 #include "mv_object_detection_internal.h"
+#include "mv_object_detection.h"
 
 #define IMG_DOG TEST_RES_PATH "/res/inference/images/dog2.jpg"
 #define IMG_FACE TEST_RES_PATH "/res/inference/images/faceDetection.jpg"
@@ -184,7 +186,7 @@ TEST(ObjectDetectionTest, InferenceShouldBeOk)
                for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
                        int left, top, right, bottom;
 
-                       int ret = mv_object_detection_get_bbox(handle, idx, &left, &top, &right, &bottom);
+                       int ret = mv_object_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
                        ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
 
                        ASSERT_EQ(coordinate_answers[answer_idx][idx][0], left);
@@ -252,7 +254,7 @@ TEST(FaceDetectionTest, InferenceShouldBeOk)
                for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
                        int left, top, right, bottom;
 
-                       int ret = mv_face_detection_get_bbox(handle, idx, &left, &top, &right, &bottom);
+                       int ret = mv_face_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
                        ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
 
                        ASSERT_EQ(coordinate_answers[idx][0], left);
index 5084b27633810ff024851ca8987e76dcb51d4ef2..4a7cdd81a06f5eb62368060d8eed816e76d74259 100644 (file)
@@ -23,7 +23,9 @@
 
 #include "ImageHelper.h"
 #include "mv_face_detection_internal.h"
+#include "mv_face_detection.h"
 #include "mv_object_detection_internal.h"
+#include "mv_object_detection.h"
 
 #define IMG_DOG TEST_RES_PATH "/res/inference/images/dog2.jpg"
 #define IMG_FACE TEST_RES_PATH "/res/inference/images/faceDetection.jpg"
@@ -62,7 +64,7 @@ void object_detection_callback(void *user_data)
                for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
                        int left, top, right, bottom;
 
-                       int ret = mv_object_detection_get_bbox(handle, idx, &left, &top, &right, &bottom);
+                       int ret = mv_object_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
                        ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
 
                        ASSERT_EQ(coordinate_answers[idx][0], left);
@@ -202,7 +204,7 @@ void face_detection_callback(void *user_data)
                for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
                        int left, top, right, bottom;
 
-                       int ret = mv_face_detection_get_bbox(handle, idx, &left, &top, &right, &bottom);
+                       int ret = mv_face_detection_get_bound_box(handle, idx, &left, &top, &right, &bottom);
                        ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);
 
                        ASSERT_EQ(coordinate_answers[idx][0], left);