You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Applied code review suggestions
This commit is contained in:
@@ -54,8 +54,14 @@ SUITE(CVStabilizer_Tests)
|
||||
openshot::Clip c1(path.str());
|
||||
c1.Open();
|
||||
|
||||
std::string json_data = R"proto(
|
||||
{
|
||||
"protobuf_data_path": "stabilizer.data",
|
||||
"smoothing-window": 30
|
||||
} )proto";
|
||||
|
||||
// Create stabilizer
|
||||
CVStabilization stabilizer("{\"protobuf_data_path\": \"stabilizer.data\", \"smoothing-window\": 30}", processingController);
|
||||
CVStabilization stabilizer(json_data, processingController);
|
||||
|
||||
// Stabilize clip for frames 0-21
|
||||
stabilizer.stabilizeClip(c1, 0, 21, true);
|
||||
@@ -92,8 +98,14 @@ SUITE(CVStabilizer_Tests)
|
||||
openshot::Clip c1(path.str());
|
||||
c1.Open();
|
||||
|
||||
std::string json_data = R"proto(
|
||||
{
|
||||
"protobuf_data_path": "stabilizer.data",
|
||||
"smoothing-window": 30
|
||||
} )proto";
|
||||
|
||||
// Create first stabilizer
|
||||
CVStabilization stabilizer_1("{\"protobuf_data_path\": \"stabilizer.data\", \"smoothing-window\": 30}", processingController);
|
||||
CVStabilization stabilizer_1(json_data, processingController);
|
||||
|
||||
// Stabilize clip for frames 0-20
|
||||
stabilizer_1.stabilizeClip(c1, 0, 20+1, true);
|
||||
@@ -106,7 +118,7 @@ SUITE(CVStabilizer_Tests)
|
||||
stabilizer_1.SaveStabilizedData();
|
||||
|
||||
// Create second stabilizer
|
||||
CVStabilization stabilizer_2("{\"protobuf_data_path\": \"stabilizer.data\", \"smoothing-window\": 30}", processingController);
|
||||
CVStabilization stabilizer_2(json_data, processingController);
|
||||
|
||||
// Load stabilized data from first stabilizer protobuf data
|
||||
stabilizer_2._LoadStabilizedData();
|
||||
@@ -114,7 +126,7 @@ SUITE(CVStabilizer_Tests)
|
||||
// Get stabilized data
|
||||
TransformParam tp_2 = stabilizer_2.GetTransformParamData(20);
|
||||
CamTrajectory ct_2 = stabilizer_2.GetCamTrajectoryTrackedData(20);
|
||||
|
||||
|
||||
// Compare first stabilizer data with second stabilizer data
|
||||
CHECK_EQUAL((int) (tp_1.dx * 10000), (int) (tp_2.dx *10000));
|
||||
CHECK_EQUAL((int) (tp_1.dy * 10000), (int) (tp_2.dy * 10000));
|
||||
|
||||
@@ -54,17 +54,15 @@ SUITE(CVTracker_Tests)
|
||||
openshot::Clip c1(path.str());
|
||||
c1.Open();
|
||||
|
||||
std::string proto_data = R"proto(
|
||||
std::string json_data = R"proto(
|
||||
{
|
||||
"protobuf_data_path": "",
|
||||
"protobuf_data_path": "kcf_tracker.data",
|
||||
"tracker-type": "KCF",
|
||||
"region": {"x": 294, "y": 102, "width": 180, "height": 166, "first-frame": 0}
|
||||
} )proto";
|
||||
|
||||
// Create tracker
|
||||
//CVTracker kcfTracker("{\"protobuf_data_path\": \"\", \"tracker_type\": \"KCF\", \"bbox\": {\"x\": 294, \"y\": 102, \"w\": 180, \"h\": 166}, \"first_frame\": 0}", processingController);
|
||||
CVTracker kcfTracker(proto_data, processingController);
|
||||
|
||||
CVTracker kcfTracker(json_data, processingController);
|
||||
|
||||
// Track clip for frames 0-20
|
||||
kcfTracker.trackClip(c1, 0, 20, true);
|
||||
@@ -94,18 +92,16 @@ SUITE(CVTracker_Tests)
|
||||
openshot::Clip c1(path.str());
|
||||
c1.Open();
|
||||
|
||||
std::string proto_data = R"proto(
|
||||
std::string json_data = R"proto(
|
||||
{
|
||||
"protobuf_data_path": "kcf_tracker.data",
|
||||
"tracker_type": "KCF",
|
||||
"bbox": {"x": 294, "y": 102, "w": 180, "h": 166},
|
||||
"first_frame": 0
|
||||
"tracker-type": "KCF",
|
||||
"region": {"x": 294, "y": 102, "width": 180, "height": 166, "first-frame": 0}
|
||||
} )proto";
|
||||
|
||||
// Create first tracker
|
||||
//CVTracker kcfTracker_1("{\"protobuf_data_path\": \"kcf_tracker.data\", \"tracker_type\": \"KCF\", \"bbox\": {\"x\": 294, \"y\": 102, \"w\": 180, \"h\": 166}, \"first_frame\": 0}", processingController);
|
||||
CVTracker kcfTracker_1(proto_data, processingController);
|
||||
|
||||
// Create first tracker
|
||||
CVTracker kcfTracker_1(json_data, processingController);
|
||||
|
||||
// Track clip for frames 0-20
|
||||
kcfTracker_1.trackClip(c1, 0, 20, true);
|
||||
@@ -125,15 +121,12 @@ SUITE(CVTracker_Tests)
|
||||
{
|
||||
"protobuf_data_path": "kcf_tracker.data",
|
||||
"tracker_type": "",
|
||||
"bbox": {"x": -1, "y": -1, "w": -1, "h": -1},
|
||||
"first_frame": 0
|
||||
"region": {"x": -1, "y": -1, "width": -1, "height": -1, "first-frame": 0}
|
||||
} )proto";
|
||||
|
||||
// Create second tracker
|
||||
//CVTracker kcfTracker_2("{\"protobuf_data_path\": \"kcf_tracker.data\", \"tracker_type\": \"\", \"bbox\": {\"x\": -1, \"y\": -1, \"w\": -1, \"h\": -1}, \"first_frame\": 0}", processingController);
|
||||
CVTracker kcfTracker_2(proto_data_1, processingController);
|
||||
|
||||
|
||||
// Load tracked data from first tracker protobuf data
|
||||
kcfTracker_2._LoadTrackedData();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user