static_cast<FaceRecognitionModel*>(recognition_model);
const std::set<int>& learnedLabels = pRecModel->getFaceLabels();
- *number_of_labels = learnedLabels.size();
-
- if ((*number_of_labels)) {
- (*labels) = (int*)malloc(sizeof(int) * (*number_of_labels));
-
- std::set<int>::const_iterator it = learnedLabels.begin();
- int i = 0;
- for (; it != learnedLabels.end(); ++it) {
- (*labels)[i] = *it;
- ++i;
+ auto _number_of_labels = learnedLabels.size();
+ int *_pLabels = NULL;
+ if (_number_of_labels) {
+ _pLabels = (int*)malloc(sizeof(int) * (_number_of_labels));
+ if(_pLabels == NULL) {
+ LOGE("Fail to alloc memory for %zu labels", _number_of_labels);
+ return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
}
+
+ std::copy(learnedLabels.begin(), learnedLabels.end(), _pLabels);
}
+ *number_of_labels = _number_of_labels;
+ *labels = _pLabels;
+
LOGD("List of the labels learned by the recognition model has been retrieved");
return MEDIA_VISION_ERROR_NONE;
}
{
LOGI("ENTER");
- if (mMeta.GetLandmarkType() < INFERENCE_LANDMARK_TYPE_2D_SINGLE ||
- mMeta.GetLandmarkType() > INFERENCE_LANDMARK_TYPE_3D_SINGLE) {
- LOGE("Not supported landmark type");
- return MEDIA_VISION_ERROR_INVALID_OPERATION;
- }
-
if (mMeta.GetLandmarkDecodingType() == INFERENCE_LANDMARK_DECODING_TYPE_BYPASS ||
mMeta.GetLandmarkDecodingType() == INFERENCE_LANDMARK_DECODING_TYPE_BYPASS_MULTICHANNEL) {
LOGI("Skip init");
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
-Version: 0.12.3
+Version: 0.12.4
Release: 0
Group: Multimedia/Framework
License: Apache-2.0 and BSD-3-Clause
}
mv_image_object_h *objects_pool = malloc(sizeof(mv_image_object_h) * image_objects->len);
+ if (objects_pool == NULL) {
+ printf("\nFail to alloc memory for %u objects.\n", image_objects->len);
+ break;
+ }
int index = 0;
for (; index < image_objects->len; ++index)
objects_pool[index] = g_array_index(image_objects, testing_object_h, index)->entity;
#include <image_helper.h>
#include "test_inference_helper.hpp"
-TestInference::TestInference()
+TestInference::TestInference() :
+ _use_json_parser(false)
{
EXPECT_EQ(mv_create_engine_config(&engine_cfg), MEDIA_VISION_ERROR_NONE);
EXPECT_EQ(mv_inference_create(&infer), MEDIA_VISION_ERROR_NONE);
PRINT_R("Incorrect input! Try again.");
mv_point_s* roi = (mv_point_s*) malloc(sizeof(mv_point_s) * number_of_roi_points);
+ if (roi == NULL) {
+ PRINT_E("Fail to alloc roi err[%d].", MEDIA_VISION_ERROR_OUT_OF_MEMORY);
+ return;
+ }
int x = 0;
int y = 0;