From: Inki Dae Date: Mon, 19 Sep 2022 13:19:35 +0000 (+0900) Subject: mv_machine_learning: do not expose structure to user X-Git-Tag: accepted/tizen/unified/20230113.091231~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5128e562bf16ffb18dd29f8db8c573af42a68f17;p=platform%2Fcore%2Fapi%2Fmediavision.git mv_machine_learning: do not expose structure to user [Issue type] code cleanup Do not allow for user to access structure type instead, introduce each CAPI corresponding to each member of the structure. Change-Id: Iac3e475ebb54b862c0b007b84f228154a10f1308 Signed-off-by: Inki Dae --- diff --git a/include/mv_object_detection_3d.h b/include/mv_object_detection_3d.h index 8438f6d0..15d36629 100644 --- a/include/mv_object_detection_3d.h +++ b/include/mv_object_detection_3d.h @@ -139,15 +139,15 @@ int mv_object_detection_3d_prepare(mv_object_detection_3d_h infer); int mv_object_detection_3d_inference(mv_object_detection_3d_h infer, mv_source_h source); /** - * @brief Gets the object detection 3d result. - * @details Use this function to get the detected result after calling @ref mv_object_detection_3d_inference(). + * @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_result The structure point which contains object detection 3d inference result. + * @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 @@ -156,7 +156,48 @@ int mv_object_detection_3d_inference(mv_object_detection_3d_h infer, mv_source_h * * @pre Request an inference by calling @ref mv_object_detection_3d_inference() */ -int mv_object_detection_3d_get_result(mv_object_detection_3d_h handle, mv_object_detection_3d_result_s *out_result); +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); /** * @} */ diff --git a/include/mv_object_detection_3d_type.h b/include/mv_object_detection_3d_type.h index fae4eda9..5e207be8 100644 --- a/include/mv_object_detection_3d_type.h +++ b/include/mv_object_detection_3d_type.h @@ -33,32 +33,6 @@ extern "C" { * @{ */ -/** - * @brief The structure to object detection 3d result. - * - * @since_tizen 7.0 - * @remarks @a points should not be released by app. - * The number of elements in @a points is equal to @a number_of_points. - * - * @probability The probability value to the detected object. - * @number_of_points The number of points. - * @points 2d coodinations to keypoints. - * @number_of_edges The number of edges. - * @edge_indexes pair index per a edge to the points array. - * - * @pre Call mv_object_detection_3d_inference() function to perform 3d detection of the objects - * in @a source and to get a result. - * - * @see mv_object_detect_3d_inference() - */ -typedef struct mv_object_detection_3d_result { - unsigned int probability; - unsigned int number_of_points; - mv_point_s points[9]; - unsigned int number_of_edges; - unsigned int edge_indexes[12][2]; -} mv_object_detection_3d_result_s; - /** * @brief The object detection 3d object handle. * diff --git a/mv_machine_learning/common/include/itask.h b/mv_machine_learning/common/include/itask.h index 940668e8..420e050d 100644 --- a/mv_machine_learning/common/include/itask.h +++ b/mv_machine_learning/common/include/itask.h @@ -31,7 +31,7 @@ public: virtual void prepare() = 0; virtual void setInput(T &t) = 0; virtual void perform() = 0; - virtual V &getOutput() = 0; + virtual V* getOutput() = 0; }; } // namespace } // namespace diff --git a/mv_machine_learning/face_recognition/include/face_recognition.h b/mv_machine_learning/face_recognition/include/face_recognition.h index c2fb9538..18c28bb0 100644 --- a/mv_machine_learning/face_recognition/include/face_recognition.h +++ b/mv_machine_learning/face_recognition/include/face_recognition.h @@ -133,10 +133,11 @@ public: int RegisterNewFace(mv_source_h img_src, std::string label_name); int RecognizeFace(mv_source_h img_src); int DeleteLabel(std::string label_name); - mv_face_recognition_result_s &GetResult(); + int GetLabel(const char **out_label); + mv_face_recognition_result_s* GetResult(); }; } // machine_learning } // mediavision -#endif \ No newline at end of file +#endif diff --git a/mv_machine_learning/face_recognition/include/face_recognition_adapter.h b/mv_machine_learning/face_recognition/include/face_recognition_adapter.h index d77d938f..253c3954 100644 --- a/mv_machine_learning/face_recognition/include/face_recognition_adapter.h +++ b/mv_machine_learning/face_recognition/include/face_recognition_adapter.h @@ -81,7 +81,7 @@ public: void prepare() override; void setInput(T &t) override; void perform() override; - V &getOutput() override; + V* getOutput() override; }; } // machine_learning diff --git a/mv_machine_learning/face_recognition/src/face_recognition.cpp b/mv_machine_learning/face_recognition/src/face_recognition.cpp index 633e0bf6..6e71086e 100644 --- a/mv_machine_learning/face_recognition/src/face_recognition.cpp +++ b/mv_machine_learning/face_recognition/src/face_recognition.cpp @@ -644,7 +644,26 @@ int FaceRecognition::DeleteLabel(string label_name) return MEDIA_VISION_ERROR_NONE; } -mv_face_recognition_result_s &FaceRecognition::GetResult() +int FaceRecognition::GetLabel(const char **out_label) +{ + if (_status != INFERENCED) { + LOGE("Inference not completed yet."); + return MEDIA_VISION_ERROR_INVALID_OPERATION; + } + + try { + _label_manager->GetLabelString(_result.label, _result.label_idx); + } catch (const BaseException &e) { + LOGE("%s", e.what()); + return e.getError(); + } + + *out_label = _result.label.c_str(); + + return MEDIA_VISION_ERROR_NONE; +} + +mv_face_recognition_result_s* FaceRecognition::GetResult() { if (_status != INFERENCED) throw InvalidOperation("Inference not completed yet."); @@ -659,8 +678,8 @@ mv_face_recognition_result_s &FaceRecognition::GetResult() throw e; } - return _result; + return &_result; } } // machine_learning -} // mediavision \ No newline at end of file +} // mediavision diff --git a/mv_machine_learning/face_recognition/src/face_recognition_adapter.cpp b/mv_machine_learning/face_recognition/src/face_recognition_adapter.cpp index 79619011..b018b846 100644 --- a/mv_machine_learning/face_recognition/src/face_recognition_adapter.cpp +++ b/mv_machine_learning/face_recognition/src/face_recognition_adapter.cpp @@ -127,7 +127,7 @@ template void FaceRecognitionAdapter::perform() } } -template V &FaceRecognitionAdapter::getOutput() +template V* FaceRecognitionAdapter::getOutput() { return _face_recognition->GetResult(); } diff --git a/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp b/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp index 5d305f30..c5c77139 100644 --- a/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp +++ b/mv_machine_learning/face_recognition/src/mv_face_recognition_open.cpp @@ -213,7 +213,7 @@ int mv_face_recognition_get_label_open(mv_face_recognition_h handle, const char Context *context = static_cast(handle); auto task = static_cast(context->__tasks["face_recognition"]); - *out_label = task->getOutput().label.c_str(); + *out_label = task->getOutput()->label.c_str(); } catch (const BaseException &e) { LOGE("%s", e.what()); return e.getError(); diff --git a/mv_machine_learning/object_detection/include/mv_object_detection_3d_open.h b/mv_machine_learning/object_detection/include/mv_object_detection_3d_open.h index 29a94be6..edec702c 100644 --- a/mv_machine_learning/object_detection/include/mv_object_detection_3d_open.h +++ b/mv_machine_learning/object_detection/include/mv_object_detection_3d_open.h @@ -123,22 +123,65 @@ extern "C" int mv_object_detection_3d_inference_open(mv_object_detection_3d_h handle, mv_source_h source); /** - * @brief Get a label name and store it to @a out_label. - * @details Use this function to get a label name after calling mv_object_detection_3d_inference_open function. + * @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 * - * @param[in] handle The handle to the object detection 3d object. - * @param[out] + * @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_open(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_open(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 a inference by calling @ref mv_object_detection_3d_inference_open() + * @pre Request an inference by calling @ref mv_object_detection_3d_inference() */ - int mv_object_detection_3d_get_result_open(mv_object_detection_3d_h handle, mv_object_detection_3d_result_s *out_result); + int mv_object_detection_3d_get_points_open(mv_object_detection_3d_h handle, unsigned int **out_x, unsigned int **out_y); #ifdef __cplusplus } diff --git a/mv_machine_learning/object_detection/include/object_detection.h b/mv_machine_learning/object_detection/include/object_detection.h index 8ad9cdad..b1e2a8dc 100644 --- a/mv_machine_learning/object_detection/include/object_detection.h +++ b/mv_machine_learning/object_detection/include/object_detection.h @@ -47,7 +47,7 @@ public: void configure(); void prepare(); void inference(mv_source_h source); - virtual object_detection_3d_result_s& getResult() = 0; + virtual object_detection_3d_result_s* getResult() = 0; }; } // machine_learning diff --git a/mv_machine_learning/object_detection/include/object_detection_adapter.h b/mv_machine_learning/object_detection/include/object_detection_adapter.h index 6aff8eb6..dcf136cc 100644 --- a/mv_machine_learning/object_detection/include/object_detection_adapter.h +++ b/mv_machine_learning/object_detection/include/object_detection_adapter.h @@ -45,7 +45,7 @@ public: void prepare() override; void setInput(T &t) override; void perform() override; - V &getOutput() override; + V* getOutput() override; }; } // machine_learning diff --git a/mv_machine_learning/object_detection/include/object_detection_type.h b/mv_machine_learning/object_detection/include/object_detection_type.h index 980598b1..1131c9e3 100644 --- a/mv_machine_learning/object_detection/include/object_detection_type.h +++ b/mv_machine_learning/object_detection/include/object_detection_type.h @@ -36,7 +36,8 @@ typedef struct { typedef struct { unsigned int probability; unsigned int number_of_points; - mv_point_s points[9]; + unsigned int x[9]; + unsigned int y[9]; unsigned int number_of_edges; unsigned int edge_indexes[12][2]; } object_detection_3d_result_s; diff --git a/mv_machine_learning/object_detection/include/objectron.h b/mv_machine_learning/object_detection/include/objectron.h index bfe3f9f4..4087fd6e 100644 --- a/mv_machine_learning/object_detection/include/objectron.h +++ b/mv_machine_learning/object_detection/include/objectron.h @@ -36,7 +36,7 @@ public: Objectron(); ~Objectron(); void parseMetaFile() override; - object_detection_3d_result_s& getResult() override; + object_detection_3d_result_s* getResult() override; }; } // machine_learning diff --git a/mv_machine_learning/object_detection/src/mv_object_detection_3d.c b/mv_machine_learning/object_detection/src/mv_object_detection_3d.c index 94f876d8..cc2f81f4 100644 --- a/mv_machine_learning/object_detection/src/mv_object_detection_3d.c +++ b/mv_machine_learning/object_detection/src/mv_object_detection_3d.c @@ -105,19 +105,58 @@ int mv_object_detection_3d_inference(mv_object_detection_3d_h infer, mv_source_h return ret; } -int mv_object_detection_3d_get_result(mv_object_detection_3d_h handle, mv_object_detection_3d_result_s *out_result) +int mv_object_detection_3d_get_probability(mv_object_detection_3d_h handle, unsigned int *out_probability) { MEDIA_VISION_SUPPORT_CHECK( _mv_inference_face_check_system_info_feature_supported()); MEDIA_VISION_INSTANCE_CHECK(handle); - MEDIA_VISION_NULL_ARG_CHECK(out_result); + MEDIA_VISION_NULL_ARG_CHECK(out_probability); MEDIA_VISION_FUNCTION_ENTER(); int ret = MEDIA_VISION_ERROR_NONE; - ret = mv_object_detection_3d_get_result_open(handle, out_result); + ret = mv_object_detection_3d_get_probability_open(handle, out_probability); + + MEDIA_VISION_FUNCTION_LEAVE(); + + return ret; +} + +int mv_object_detection_3d_get_num_of_points(mv_object_detection_3d_h handle, unsigned int *out_num_of_points) +{ + MEDIA_VISION_SUPPORT_CHECK( + _mv_inference_face_check_system_info_feature_supported()); + + MEDIA_VISION_INSTANCE_CHECK(handle); + MEDIA_VISION_NULL_ARG_CHECK(out_num_of_points); + + MEDIA_VISION_FUNCTION_ENTER(); + + int ret = MEDIA_VISION_ERROR_NONE; + + ret = mv_object_detection_3d_get_num_of_points_open(handle, out_num_of_points); + + MEDIA_VISION_FUNCTION_LEAVE(); + + return ret; +} + +int mv_object_detection_3d_get_points(mv_object_detection_3d_h handle, unsigned int **out_x, unsigned int **out_y) +{ + MEDIA_VISION_SUPPORT_CHECK( + _mv_inference_face_check_system_info_feature_supported()); + + MEDIA_VISION_INSTANCE_CHECK(handle); + MEDIA_VISION_NULL_ARG_CHECK(out_x); + MEDIA_VISION_NULL_ARG_CHECK(out_y); + + MEDIA_VISION_FUNCTION_ENTER(); + + int ret = MEDIA_VISION_ERROR_NONE; + + ret = mv_object_detection_3d_get_points_open(handle, out_x, out_y); MEDIA_VISION_FUNCTION_LEAVE(); diff --git a/mv_machine_learning/object_detection/src/mv_object_detection_3d_open.cpp b/mv_machine_learning/object_detection/src/mv_object_detection_3d_open.cpp index 3705a543..16bfe164 100644 --- a/mv_machine_learning/object_detection/src/mv_object_detection_3d_open.cpp +++ b/mv_machine_learning/object_detection/src/mv_object_detection_3d_open.cpp @@ -164,7 +164,7 @@ int mv_object_detection_3d_inference_open(mv_object_detection_3d_h handle, mv_so return MEDIA_VISION_ERROR_NONE; } -int mv_object_detection_3d_get_result_open(mv_object_detection_3d_h handle, mv_object_detection_3d_result_s *out_result) +int mv_object_detection_3d_get_probability_open(mv_object_detection_3d_h handle, unsigned int *out_probability) { LOGD("ENTER"); @@ -177,24 +177,70 @@ int mv_object_detection_3d_get_result_open(mv_object_detection_3d_h handle, mv_o auto context = static_cast(handle); auto task = static_cast(context->__tasks["objectron"]); - object_detection_3d_result_s result = task->getOutput(); + object_detection_3d_result_s *result = task->getOutput(); - out_result->probability = result.probability; - out_result->number_of_points = result.number_of_points; - out_result->number_of_edges = result.number_of_edges; + *out_probability = result->probability; + } catch (const BaseException &e) { + LOGE("%s", e.what()); + return e.getError(); + } + + LOGD("LEAVE"); + + return MEDIA_VISION_ERROR_NONE; +} + +int mv_object_detection_3d_get_num_of_points_open(mv_object_detection_3d_h handle, unsigned int *out_num_of_points) +{ + LOGD("ENTER"); + + if (!handle) { + LOGE("Handle is NULL."); + return MEDIA_VISION_ERROR_INVALID_PARAMETER; + } + + try { + auto context = static_cast(handle); + auto task = static_cast(context->__tasks["objectron"]); + + auto result = task->getOutput(); - for (unsigned int idx = 0; idx < out_result->number_of_points; ++idx) - out_result->points[idx] = result.points[idx]; + *out_num_of_points = result->number_of_points; + } catch (const BaseException &e) { + LOGE("%s", e.what()); + return e.getError(); + } + + LOGD("LEAVE"); + + return MEDIA_VISION_ERROR_NONE; +} + +int mv_object_detection_3d_get_points_open(mv_object_detection_3d_h handle, unsigned int **out_x, unsigned int **out_y) +{ + LOGD("ENTER"); + + if (!handle) { + LOGE("Handle is NULL."); + return MEDIA_VISION_ERROR_INVALID_PARAMETER; + } - for (unsigned int idx = 0; idx < out_result->number_of_edges; ++idx) { - out_result->edge_indexes[idx][0] = result.edge_indexes[idx][0]; - out_result->edge_indexes[idx][1] = result.edge_indexes[idx][1]; - } + try { + Context *context = static_cast(handle); + auto task = static_cast(context->__tasks["objectron"]); + + auto result = task->getOutput(); + + *out_x = result->x; + *out_y = result->y; } catch (const BaseException &e) { LOGE("%s", e.what()); return e.getError(); } + for (unsigned int i = 0; i < 9; ++i) + LOGI("%d %d", (*out_x)[i], (*out_y)[i]); + LOGD("LEAVE"); return MEDIA_VISION_ERROR_NONE; diff --git a/mv_machine_learning/object_detection/src/object_detection_adapter.cpp b/mv_machine_learning/object_detection/src/object_detection_adapter.cpp index 7d95585c..b1b9ce7c 100644 --- a/mv_machine_learning/object_detection/src/object_detection_adapter.cpp +++ b/mv_machine_learning/object_detection/src/object_detection_adapter.cpp @@ -80,7 +80,7 @@ template void ObjectDetectionAdapter::perform() } } -template V& ObjectDetectionAdapter::getOutput() +template V* ObjectDetectionAdapter::getOutput() { return _object_detection->getResult(); } diff --git a/mv_machine_learning/object_detection/src/objectron.cpp b/mv_machine_learning/object_detection/src/objectron.cpp index 9bb7d2b8..df229f0b 100644 --- a/mv_machine_learning/object_detection/src/objectron.cpp +++ b/mv_machine_learning/object_detection/src/objectron.cpp @@ -80,7 +80,7 @@ void Objectron::parseMetaFile() throw InvalidOperation("Fail to ParseMetadata"); } -object_detection_3d_result_s& Objectron::getResult() +object_detection_3d_result_s* Objectron::getResult() { TensorBuffer& tensor_buffer_obj = _inference->GetOutputTensorBuffer(); IETensorBuffer &ie_tensor_buffer = tensor_buffer_obj.getIETensorBuffer(); @@ -108,8 +108,8 @@ object_detection_3d_result_s& Objectron::getResult() float y_scale = static_cast(_inference->getSourceHeight()) / static_cast(_inference->getInputHeight()); for (unsigned int idx = 0; idx < output_size; idx += 2) { - _result.points[result_idx].x = static_cast(keypoints[idx] * x_scale); - _result.points[result_idx++].y = static_cast(keypoints[idx + 1] * y_scale); + _result.x[result_idx] = static_cast(keypoints[idx] * x_scale); + _result.y[result_idx++] = static_cast(keypoints[idx + 1] * y_scale); } _result.number_of_points = output_size / 2; @@ -133,7 +133,7 @@ object_detection_3d_result_s& Objectron::getResult() ::copy(&edges[0][0], &edges[0][0] + 12 * 2, &_result.edge_indexes[0][0]); - return _result; + return &_result; } } diff --git a/test/testsuites/machine_learning/object_detection/test_object_detection_3d.cpp b/test/testsuites/machine_learning/object_detection/test_object_detection_3d.cpp index f3494136..0fc8db75 100644 --- a/test/testsuites/machine_learning/object_detection/test_object_detection_3d.cpp +++ b/test/testsuites/machine_learning/object_detection/test_object_detection_3d.cpp @@ -55,21 +55,26 @@ TEST(ObjectDetection3DTest, InferenceShouldBeOk) ret = mv_object_detection_3d_inference(handle, mv_source); ASSERT_EQ(ret, 0); - mv_object_detection_3d_result_s result; - ret = mv_object_detection_3d_get_result(handle, &result); + unsigned int probability; + + ret = mv_object_detection_3d_get_probability(handle, &probability); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); - std::cout << "Probability = " << result.probability << std::endl; + std::cout << "Probability = " << probability << std::endl; - for (unsigned int idx = 0; idx < result.number_of_points; ++idx) { - std::cout << "index = " << idx + 1 << " : " << result.points[idx].x - << " x " << result.points[idx].y << std::endl; - } + unsigned int num_of_points; + + ret = mv_object_detection_3d_get_num_of_points(handle, &num_of_points); + ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); - std::cout << "Number of edges = " << result.number_of_edges << std::endl; + unsigned int *x_array, *y_array; - for (unsigned int idx = 0; idx < result.number_of_edges; ++idx) - std::cout << result.edge_indexes[idx][0] << " to " << result.edge_indexes[idx][1] << std::endl; + ret = mv_object_detection_3d_get_points(handle, &x_array, &y_array); + ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE); + + for (unsigned int idx = 0; idx < num_of_points; ++idx) { + std::cout << "index = " << idx + 1 << " : " << x_array[idx] << " x " << y_array[idx] << std::endl; + } ret = mv_destroy_source(mv_source); ASSERT_EQ(ret, MEDIA_VISION_ERROR_NONE);