const double xRightEyeCenter = (2 * eyeAreaRight.x + eyeAreaRight.width) / 2.;
const double yRightEyeCenter = (2 * eyeAreaRight.y + eyeAreaRight.height) / 2.;
- const cv::Rect leftEyeRect(xLeftEyeCenter - eyeAreaLeft.width / 4,
- yLeftEyeCenter - eyeAreaLeft.height / 4,
+ const cv::Rect leftEyeRect((int)(xLeftEyeCenter - (double)eyeAreaLeft.width / 4),
+ (int)(yLeftEyeCenter - (double)eyeAreaLeft.height / 4),
eyeAreaLeft.width / 2,
eyeAreaLeft.height / 2);
- const cv::Rect rightEyeRect(xRightEyeCenter - eyeAreaRight.width / 4,
- yRightEyeCenter - eyeAreaRight.height / 4,
+ const cv::Rect rightEyeRect((int)(xRightEyeCenter - (double)eyeAreaRight.width / 4),
+ (int)(yRightEyeCenter - (double)eyeAreaRight.height / 4),
eyeAreaRight.width / 2,
eyeAreaRight.height / 2);
{
char tempPath[1024];
- sprintf(tempPath, "/tmp/alg_copy_%p_%p", srcAlg.obj, dstAlg.obj);
+ snprintf(tempPath, 1024, "/tmp/alg_copy_%p_%p", srcAlg.obj, dstAlg.obj);
srcAlg->save(tempPath);
dstAlg->load(tempPath);
void FeatureMatcher::setTolerantError(float tolerantError)
{
- m_affectingPart = std::max(0.f, std::min(1.f, tolerantError));
+ m_tolerantError = std::max(0.f, std::min(1.f, tolerantError));
}
size_t FeatureMatcher::getMinimumMatchesNumber() const
void ImageContourStabilizator::reset(void)
{
+ m_tolerantShift = 0.0f;
+ m_tolerantShiftExtra = 0.0f;
m_isPrepared = false;
m_tempContourIndex = -1;
m_currentHistoryAmount = 0;
convertSourceMV2GrayCV(source, scene),
"Failed to convert mv_source.");
+ int ret = MEDIA_VISION_ERROR_NONE;
+
MediaVision::Image::FeaturesExtractingParams featuresExtractingParams;
extractSceneFeaturesExtractingParams(engine_cfg, featuresExtractingParams);
if (isRecognized && (resultContour.size() ==
MediaVision::Image::NumberOfQuadrangleCorners)) {
resultLocations[objectNum] = new mv_quadrangle_s;
+ if (resultLocations[objectNum] == NULL) {
+ ret = MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+ goto ErrorExit;
+ }
+
for (size_t pointNum = 0u;
pointNum < MediaVision::Image::NumberOfQuadrangleCorners;
++pointNum) {
number_of_objects,
user_data);
+ErrorExit:
+
for (int objectNum = 0; objectNum < number_of_objects; ++objectNum) {
if (resultLocations[objectNum] != NULL) {
delete resultLocations[objectNum];
}
}
- return MEDIA_VISION_ERROR_NONE;
+ return ret;
}
int mv_image_track_open(
Name: capi-media-vision
Summary: Media Vision library for Tizen Native API
-Version: 0.3.1
+Version: 0.3.2
Release: 0
Group: Multimedia/Framework
License: Apache-2.0 and BSD-2.0
LOGI("Call the mv_barcode_generate_source() function");
+ mv_engine_config_h mv_engine_config;
+ err = mv_create_engine_config(&mv_engine_config);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ printf("ERROR: Errors were occurred during creating the media engine "
+ "config: %i\n", err);
+ }
+
err = mv_barcode_generate_source(
- NULL,
+ mv_engine_config,
model.message,
model.type,
model.mode,
"Error code: %i\n", err2);
}
+ const int err3 = mv_destroy_engine_config(mv_engine_config);
+ if (MEDIA_VISION_ERROR_NONE != err3) {
+ printf("ERROR: Errors were occurred during destroying the media engine "
+ "config: %i\n", err3);
+ }
+
MEDIA_VISION_FUNCTION_LEAVE();
return err;
"source. Error code: %i\n", err);
}
+ err = mv_destroy_engine_config(mv_engine_config);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ printf("ERROR: Errors were occurred during destroying the media engine "
+ "config: %i\n", err);
+ }
+
MEDIA_VISION_FUNCTION_LEAVE();
return MEDIA_VISION_ERROR_INTERNAL;
if (0 == strcmp(model.file_name + strlen(model.file_name) - 4, ".jpg") ||
0 == strcmp(model.file_name + strlen(model.file_name) - 5, ".jpeg")) {
jpeg_file_name = (char*)malloc(strlen(model.file_name) + 1);
- strcpy(jpeg_file_name, model.file_name);
+ if (jpeg_file_name == NULL) {
+ mv_destroy_source(source);
+ mv_destroy_engine_config(mv_engine_config);
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+ }
+
+ strncpy(jpeg_file_name, model.file_name, strlen(model.file_name) + 1);
jpeg_file_name[strlen(model.file_name)] = '\0';
} else {
jpeg_file_name = (char*)malloc(strlen(model.file_name) + 5);
- strcpy(jpeg_file_name, model.file_name);
- strcpy(jpeg_file_name + strlen(model.file_name), ".jpg");
+ if (jpeg_file_name == NULL) {
+ mv_destroy_source(source);
+ mv_destroy_engine_config(mv_engine_config);
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+ }
+
+ strncpy(jpeg_file_name, model.file_name, strlen(model.file_name) + 5);
+ strncpy(jpeg_file_name + strlen(model.file_name), ".jpg", 5);
jpeg_file_name[strlen(model.file_name) + 4] = '\0';
}
"Error code: %i\n", err2);
}
+ const int err3 = mv_destroy_engine_config(mv_engine_config);
+ if (MEDIA_VISION_ERROR_NONE != err3) {
+ printf("ERROR: Errors were occurred during destroying the media engine "
+ "config: %i\n", err);
+ }
+
MEDIA_VISION_FUNCTION_LEAVE();
return err;
size_t real_string_len = strlen(buffer);
buffer[real_string_len - 1] = '\0';
*string = (char*)malloc(real_string_len * sizeof(char));
- strcpy(*string, buffer);
+ if (*string == NULL) {
+ MEDIA_VISION_FUNCTION_LEAVE();
+ return -1;
+ }
+
+ strncpy(*string, buffer, real_string_len);
size_t str_len = strlen(*string);
size_t real_string_len = strlen(buffer);
buffer[real_string_len - 1] = '\0';
*string = (char*)malloc(real_string_len * sizeof(char));
- strcpy(*string, buffer);
+ if (*string == NULL) {
+ return -1;
+ }
+
+ strncpy(*string, buffer, real_string_len);
return strlen(*string);
}
if (file_name[0] == '.')
continue;
- sprintf(file_path, "%s/%s", in_file_name, file_name);
+ snprintf(file_path, 1024, "%s/%s", in_file_name, file_name);
err = add_single_example(model, file_path, NULL, &face_label);
if (MEDIA_VISION_ERROR_NONE != err) {
if (file_name[0] == '.')
continue;
- sprintf(file_path, "%s/%s", directories[i], file_name);
+ snprintf(file_path, 1024, "%s/%s", directories[i], file_name);
err = load_mv_source_from_file(file_path, source);
if (MEDIA_VISION_ERROR_NONE != err) {
printf(TEXT_RED "Failed to test on example from %s. "
"Error with code %i was occurred during destoy"
TEXT_RESET "\n", err);
}
-
- return err;
} else {
- return MEDIA_VISION_ERROR_NONE;
+ err = MEDIA_VISION_ERROR_NONE;
}
+ break;
default:
sel_opt = 0;
printf("ERROR: Incorrect option was selected.\n");
print_action_result(names[sel_opt - 1], err, notification_type);
- sel_opt = 0;
+ if (sel_opt != 11) {
+ sel_opt = 0;
+ }
}
+
+ return err;
}
int perform_mv_face_tracking_model_save(mv_face_tracking_model_h model)
char str_prompt[100];
while (idx < 4) {
++idx;
- sprintf(str_prompt, "Specify point %i x coordinate: x%i = ",
+ snprintf(str_prompt, 100, "Specify point %i x coordinate: x%i = ",
idx - 1, idx);
while (-1 == input_int(str_prompt, INT_MIN, INT_MAX,
&(roi.points[idx - 1].x))) {
printf("Incorrect input! Try again.\n");
}
- sprintf(str_prompt, "Specify point %i y coordinate: y%i = ",
+ snprintf(str_prompt, 100, "Specify point %i y coordinate: y%i = ",
idx - 1, idx);
while (-1 == input_int(str_prompt, INT_MIN, INT_MAX,
&(roi.points[idx - 1].y))) {
}
char file_path[1024];
- sprintf(file_path, "%s/%05d.jpg", track_output_dir, track_frame_counter);
+ snprintf(file_path, 1024, "%s/%05d.jpg", track_output_dir, track_frame_counter);
if (MEDIA_VISION_ERROR_NONE == save_image_from_buffer(
file_path, out_buffer, &image_data, 100)) {
printf("Frame %i was outputted as %s\n", track_frame_counter, file_path);
"Error with code %i was occurred during destroy"
TEXT_RESET "\n", err);
}
-
- return err;
} else {
- return MEDIA_VISION_ERROR_NONE;
+ err = MEDIA_VISION_ERROR_NONE;
}
+ break;
default:
sel_opt = 0;
printf("ERROR: Incorrect input.\n");
print_action_result(names[sel_opt - 1], err, notification_type);
- sel_opt = 0;
+ if (sel_opt != 6) {
+ sel_opt = 0;
+ }
}
+
+ return err;
}
int perform_eye_condition_recognize()
switch (source_type) {
case SOURCE_TYPE_GENERATION: {
if (OBJECT_TYPE_IMAGE_OBJECT == object_type) {
- sprintf(
+ snprintf(
target->origin_label,
+ testing_object_maximum_label_length,
"generated from \"%s\"",
(char*)source);
} else if (OBJECT_TYPE_IMAGE_TRACKING_MODEL == object_type) {
- sprintf(
+ snprintf(
target->origin_label,
+ testing_object_maximum_label_length,
"generated from image object which is %s",
((testing_object_h)source)->actual_label);
} else {
- sprintf(
+ snprintf(
target->origin_label,
+ testing_object_maximum_label_length,
"generated unknown type of testing object");
}
- strcpy(target->actual_label, target->origin_label);
+ strncpy(target->actual_label, target->origin_label, testing_object_maximum_label_length);
break;
}
case SOURCE_TYPE_LOADING: {
- sprintf(target->origin_label, "loaded from \"%s\"", (char*)source);
- strcpy(target->actual_label, target->origin_label);
+ snprintf(target->origin_label, testing_object_maximum_label_length, "loaded from \"%s\"", (char*)source);
+ strncpy(target->actual_label, target->origin_label, testing_object_maximum_label_length);
break;
}
case SOURCE_TYPE_CLONING: {
testing_object_h source_object = (testing_object_h)source;
- strcpy(target->origin_label, source_object->origin_label);
+ strncpy(target->origin_label, source_object->origin_label, testing_object_maximum_label_length);
target->cloning_counter = source_object->cloning_counter + 1;
char number_of_cloning[10];
number_of_cloning[0] = '\0';
if (1 < target->cloning_counter) {
- sprintf(number_of_cloning, "%s%i%s",
+ snprintf(number_of_cloning, 10, "%s%i%s",
"(x", target->cloning_counter, ")");
}
char type_name[20];
if (OBJECT_TYPE_IMAGE_OBJECT == object_type)
- sprintf(type_name, "image object");
+ snprintf(type_name, 20, "image object");
else if (OBJECT_TYPE_IMAGE_TRACKING_MODEL == object_type)
- sprintf(type_name, "tracking model");
+ snprintf(type_name, 20, "tracking model");
else
- sprintf(type_name, "unknown object");
+ snprintf(type_name, 20, "unknown object");
- sprintf(target->actual_label, "%s%s%s%s%s%s",
+ snprintf(target->actual_label, testing_object_maximum_label_length,
+ "%s%s%s%s%s%s",
"cloned ", number_of_cloning,
" from ", type_name,
" which is ", target->origin_label);
break;
}
case SOURCE_TYPE_EMPTY: {
- strcpy(target->origin_label, "created an empty");
- strcpy(target->actual_label, target->origin_label);
+ strncpy(target->origin_label, "created an empty", testing_object_maximum_label_length);
+ strncpy(target->actual_label, target->origin_label, testing_object_maximum_label_length);
break;
}
default: {
- strcpy(target->origin_label, "having unknown source");
+ strncpy(target->origin_label, "having unknown source", testing_object_maximum_label_length);
break;
}
}