mv_machine_learning: keep object detection 3d as internal api
authorInki Dae <inki.dae@samsung.com>
Thu, 6 Oct 2022 01:24:30 +0000 (10:24 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 7 Nov 2022 03:12:39 +0000 (12:12 +0900)
[Issue type] code cleanup

Keep object detection 3d API as internal one. This API will be announced
officially next year with several enhancements.

Change-Id: Ia775569a3572a9fff75780fcdffa2a183dbf1885
Signed-off-by: Inki Dae <inki.dae@samsung.com>
include/mv_object_detection_3d.h [deleted file]
include/mv_object_detection_3d_internal.h [new file with mode: 0644]
mv_machine_learning/object_detection/src/mv_object_detection_3d.c
test/testsuites/machine_learning/object_detection/test_object_detection_3d.cpp

diff --git a/include/mv_object_detection_3d.h b/include/mv_object_detection_3d.h
deleted file mode 100644 (file)
index 15d3662..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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_OBJECT_DETECT_3D_H__
-#define __TIZEN_MEDIAVISION_OBJECT_DETECT_3D_H__
-
-#include <mv_common.h>
-#include <mv_object_detection_3d_type.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * @file   mv_object_detection_3d.h
- * @brief  This file contains the Inference based Media Vision API.
- */
-
-/**
- * @addtogroup CAPI_MEDIA_VISION_INFERENCE_MODULE
- * @{
- */
-
-/**
- * @brief Creates a inference handle for object detection 3d 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_3d_prepare() function to prepare a network
- *          for the inference.
- *
- * @since_tizen 7.0
- *
- * @remarks The @a infer should be released using mv_object_detection_3d_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_3d_destroy()
- * @see mv_object_detection_3d_prepare()
- */
-int mv_object_detection_3d_create(mv_object_detection_3d_h *infer);
-
-/**
- * @brief Destroys inference handle and releases all its resources.
- *
- * @since_tizen 7.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_3d_create()
- *
- * @see mv_object_detection_3d_create()
- */
-int mv_object_detection_3d_destroy(mv_object_detection_3d_h infer);
-
-/**
- * @brief Configures the backend for the object detection 3d inference.
- *
- * @since_tizen 7.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_3d_configure(mv_object_detection_3d_h infer);
-
-/**
- * @brief Prepares the object detection 3d inference
- * @details Use this function to prepare the object detection 3d inference based on
- *          the configured network.
- *
- * @since_tizen 7.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_3d_prepare(mv_object_detection_3d_h infer);
-
-/**
- * @brief Performs the object detection 3d inference on the @a source.
- *
- * @since_tizen 7.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_3d_create()
- * @pre Prepare an inference by calling mv_object_detect_3d_prepare()
- * @post
- *
- * @see mv_object_detect_3d_result_s structure
- */
-int mv_object_detection_3d_inference(mv_object_detection_3d_h infer, mv_source_h source);
-
-/**
- * @brief Gets the probability value to the detected object.
- * @details Use this function to get the probability value after calling @ref mv_object_detection_3d_inference().
- *
- * @since_tizen 7.0
- *
- * @remarks The @a result must NOT be released using free()
- *
- * @param[in] handle              The handle to the face recognition object.
- * @param[out] out_probability    A pointer to probability array.
- *
- * @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_OPERATION Invalid operation
- *
- * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
- */
-int mv_object_detection_3d_get_probability(mv_object_detection_3d_h handle, unsigned int *out_probability);
-
-/**
- * @brief Gets the number of points to the 3D bounding box of the detected object.
- * @details Use this function to get the number of points after calling @ref mv_object_detection_3d_inference().
- *
- * @since_tizen 7.0
- *
- * @remarks The @a result must NOT be released using free()
- *
- * @param[in] handle                The handle to the face recognition object.
- * @param[out] out_num_of_points    Number of points.
- *
- * @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_OPERATION Invalid operation
- *
- * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
- */
-int mv_object_detection_3d_get_num_of_points(mv_object_detection_3d_h handle, unsigned int *out_num_of_points);
-
-/**
- * @brief Gets the x and y coordinates values to the 3D bounding box of the detected object.
- * @details Use this function to get the coordinates values after calling @ref mv_object_detection_3d_inference().
- *
- * @since_tizen 7.0
- *
- * @remarks The @a result must NOT be released using free()
- *
- * @param[in] handle    The handle to the face recognition object.
- * @param[out] out_x    A pointer to x coordinates array.
- * @param[out] out_y    A pointer to y coordinates array.
-  *
- * @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_OPERATION Invalid operation
- *
- * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
- */
-int mv_object_detection_3d_get_points(mv_object_detection_3d_h handle, unsigned int **out_x, unsigned int **out_y);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __TIZEN_MEDIAVISION_OBJECT_DETECT_3D_H__ */
diff --git a/include/mv_object_detection_3d_internal.h b/include/mv_object_detection_3d_internal.h
new file mode 100644 (file)
index 0000000..778b0f2
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * 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_OBJECT_DETECT_3D_INTERNAL_H__
+#define __TIZEN_MEDIAVISION_OBJECT_DETECT_3D_INTERNAL_H__
+
+#include <mv_common.h>
+#include <mv_object_detection_3d_type.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @file   mv_object_detection_3d.h
+ * @brief  This file contains the Inference based Media Vision API.
+ */
+
+/**
+ * @addtogroup CAPI_MEDIA_VISION_INFERENCE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Creates a inference handle for object detection 3d 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_3d_prepare() function to prepare a network
+ *          for the inference.
+ *
+ * @since_tizen 7.0
+ *
+ * @remarks The @a infer should be released using mv_object_detection_3d_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_3d_destroy()
+ * @see mv_object_detection_3d_prepare()
+ */
+int mv_object_detection_3d_create(mv_object_detection_3d_h *infer);
+
+/**
+ * @brief Destroys inference handle and releases all its resources.
+ *
+ * @since_tizen 7.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_3d_create()
+ *
+ * @see mv_object_detection_3d_create()
+ */
+int mv_object_detection_3d_destroy(mv_object_detection_3d_h infer);
+
+/**
+ * @brief Configures the backend for the object detection 3d inference.
+ *
+ * @since_tizen 7.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_3d_configure(mv_object_detection_3d_h infer);
+
+/**
+ * @brief Prepares the object detection 3d inference
+ * @details Use this function to prepare the object detection 3d inference based on
+ *          the configured network.
+ *
+ * @since_tizen 7.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_3d_prepare(mv_object_detection_3d_h infer);
+
+/**
+ * @brief Performs the object detection 3d inference on the @a source.
+ *
+ * @since_tizen 7.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_3d_create()
+ * @pre Prepare an inference by calling mv_object_detect_3d_prepare()
+ * @post
+ *
+ * @see mv_object_detect_3d_result_s structure
+ */
+int mv_object_detection_3d_inference(mv_object_detection_3d_h infer, mv_source_h source);
+
+/**
+ * @brief Gets the probability value to the detected object.
+ * @details Use this function to get the probability value after calling @ref mv_object_detection_3d_inference().
+ *
+ * @since_tizen 7.0
+ *
+ * @remarks The @a result must NOT be released using free()
+ *
+ * @param[in] handle              The handle to the face recognition object.
+ * @param[out] out_probability    A pointer to probability array.
+ *
+ * @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_OPERATION Invalid operation
+ *
+ * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
+ */
+int mv_object_detection_3d_get_probability(mv_object_detection_3d_h handle, unsigned int *out_probability);
+
+/**
+ * @brief Gets the number of points to the 3D bounding box of the detected object.
+ * @details Use this function to get the number of points after calling @ref mv_object_detection_3d_inference().
+ *
+ * @since_tizen 7.0
+ *
+ * @remarks The @a result must NOT be released using free()
+ *
+ * @param[in] handle                The handle to the face recognition object.
+ * @param[out] out_num_of_points    Number of points.
+ *
+ * @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_OPERATION Invalid operation
+ *
+ * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
+ */
+int mv_object_detection_3d_get_num_of_points(mv_object_detection_3d_h handle, unsigned int *out_num_of_points);
+
+/**
+ * @brief Gets the x and y coordinates values to the 3D bounding box of the detected object.
+ * @details Use this function to get the coordinates values after calling @ref mv_object_detection_3d_inference().
+ *
+ * @since_tizen 7.0
+ *
+ * @remarks The @a result must NOT be released using free()
+ *
+ * @param[in] handle    The handle to the face recognition object.
+ * @param[out] out_x    A pointer to x coordinates array.
+ * @param[out] out_y    A pointer to y coordinates array.
+  *
+ * @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_OPERATION Invalid operation
+ *
+ * @pre Request an inference by calling @ref mv_object_detection_3d_inference()
+ */
+int mv_object_detection_3d_get_points(mv_object_detection_3d_h handle, unsigned int **out_x, unsigned int **out_y);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __TIZEN_MEDIAVISION_OBJECT_DETECT_3D_INTERNAL_H__ */
index cc2f81f489f4a9fa7fa8f7f7d150eb2c977adb7b..0d6bc6aeddae96e061708559053fab09b69a9eae 100644 (file)
@@ -15,7 +15,7 @@
  */
 
 #include "mv_private.h"
-#include "mv_object_detection_3d.h"
+#include "mv_object_detection_3d_internal.h"
 #include "mv_object_detection_3d_open.h"
 
 /**
index 0fc8db75531dc5054d2b66c3b74454e8e922fee9..ed40831576eba0a4962d5e8706235986fcb78fde 100644 (file)
@@ -21,7 +21,7 @@
 #include "gtest/gtest.h"
 
 #include "ImageHelper.h"
-#include "mv_object_detection_3d.h"
+#include "mv_object_detection_3d_internal.h"
 
 #define IMAGE_PATH "/res/inference/images/cup.jpeg"