MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SetJsonValue

Method SetJsonValue

src/CVTracker.cpp:408–441  ·  view source on GitHub ↗

Load Json::Value into this object

Source from the content-addressed store, hash-verified

406
407// Load Json::Value into this object
408void CVTracker::SetJsonValue(const Json::Value root) {
409
410 // Set data from Json (if key is found)
411 if (!root["protobuf_data_path"].isNull()){
412 protobuf_data_path = (root["protobuf_data_path"].asString());
413 }
414 if (!root["tracker-type"].isNull()){
415 trackerType = (root["tracker-type"].asString());
416 }
417
418 if (!root["region"].isNull()){
419 double x = root["region"]["normalized_x"].asDouble();
420 double y = root["region"]["normalized_y"].asDouble();
421 double w = root["region"]["normalized_width"].asDouble();
422 double h = root["region"]["normalized_height"].asDouble();
423 cv::Rect2d prev_bbox(x,y,w,h);
424 bbox = prev_bbox;
425
426 if (!root["region"]["first-frame"].isNull()){
427 start = root["region"]["first-frame"].asInt64();
428 json_interval = true;
429 }
430 else{
431 processingController->SetError(true, "No first-frame");
432 error = true;
433 }
434
435 }
436 else{
437 processingController->SetError(true, "No initial bounding box selected");
438 error = true;
439 }
440
441}
442
443/*
444||||||||||||||||||||||||||||||||||||||||||||||||||

Callers

nothing calls this directly

Calls 1

SetErrorMethod · 0.80

Tested by

no test coverage detected