Skip to content

Commit 2715d1c

Browse files
committed
Clean-up of whitespace
1 parent 5fdb3ac commit 2715d1c

File tree

5 files changed

+64
-64
lines changed

5 files changed

+64
-64
lines changed

src/Clip.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ QTransform Clip::get_transform(std::shared_ptr<Frame> frame, int width, int heig
14391439

14401440
// Get parentTrackedObject's parent clip's properties
14411441
std::map<std::string, float> trackedObjectParentClipProperties =
1442-
parentTrackedObject->GetParentClipProperties(timeline_frame_number);
1442+
parentTrackedObject->GetParentClipProperties(timeline_frame_number);
14431443

14441444
// Get the attached object's parent clip's properties
14451445
if (!trackedObjectParentClipProperties.empty())

src/TrackedObjectBBox.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void TrackedObjectBBox::ScalePoints(double time_scale){
235235
// Load the bounding-boxes information from the protobuf file
236236
bool TrackedObjectBBox::LoadBoxData(std::string inputFilePath)
237237
{
238-
using std::ios;
238+
using std::ios;
239239

240240
// Variable to hold the loaded data
241241
pb_tracker::Tracker bboxMessage;
@@ -282,7 +282,7 @@ bool TrackedObjectBBox::LoadBoxData(std::string inputFilePath)
282282
if (bboxMessage.has_last_updated())
283283
{
284284
std::cout << " Loaded Data. Saved Time Stamp: "
285-
<< TimeUtil::ToString(bboxMessage.last_updated()) << std::endl;
285+
<< TimeUtil::ToString(bboxMessage.last_updated()) << std::endl;
286286
}
287287

288288
// Delete all global objects allocated by libprotobuf.
@@ -382,7 +382,7 @@ void TrackedObjectBBox::SetJsonValue(const Json::Value root)
382382

383383
// Set the id of the child clip
384384
if (!root["child_clip_id"].isNull() && root["child_clip_id"].asString() != Id()){
385-
ChildClipId(root["child_clip_id"].asString());
385+
ChildClipId(root["child_clip_id"].asString());
386386
}
387387

388388
// Set the Keyframes by the given JSON object

src/TrackedObjectBase.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
namespace openshot {
2424

25-
// Forward decls
26-
class ClipBase;
25+
// Forward decls
26+
class ClipBase;
2727

2828
/**
2929
* @brief This abstract class is the base class of all Tracked Objects.
@@ -50,8 +50,8 @@ namespace openshot {
5050
/// Constructor which takes an object ID
5151
TrackedObjectBase(std::string _id);
5252

53-
/// Destructor
54-
virtual ~TrackedObjectBase() = default;
53+
/// Destructor
54+
virtual ~TrackedObjectBase() = default;
5555

5656
/// Get the id of this object
5757
std::string Id() const { return id; }

src/effects/ObjectDetection.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i
7878
}
7979

8080
// Initialize the Qt rectangle that will hold the positions of the bounding-box
81-
std::vector<QRectF> boxRects;
82-
// Initialize the image of the TrackedObject child clip
83-
std::vector<std::shared_ptr<QImage>> childClipImages;
81+
std::vector<QRectF> boxRects;
82+
// Initialize the image of the TrackedObject child clip
83+
std::vector<std::shared_ptr<QImage>> childClipImages;
8484

8585
// Check if track data exists for the requested frame
8686
if (detectionsData.find(frame_number) != detectionsData.end()) {
@@ -152,7 +152,7 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i
152152

153153
if (childClip){
154154
// Get the image of the child clip for this frame
155-
std::shared_ptr<Frame> childClipFrame = childClip->GetFrame(frame_number);
155+
std::shared_ptr<Frame> childClipFrame = childClip->GetFrame(frame_number);
156156
childClipImages.push_back(childClipFrame->GetImage());
157157

158158
// Set the Qt rectangle with the bounding-box properties
@@ -172,8 +172,8 @@ std::shared_ptr<Frame> ObjectDetection::GetFrame(std::shared_ptr<Frame> frame, i
172172
// Update Qt image with new Opencv frame
173173
frame->SetImageCV(cv_image);
174174

175-
// Set the bounding-box image with the Tracked Object's child clip image
176-
if(boxRects.size() > 0){
175+
// Set the bounding-box image with the Tracked Object's child clip image
176+
if(boxRects.size() > 0){
177177
// Get the frame image
178178
QImage frameImage = *(frame->GetImage());
179179
for(int i; i < boxRects.size();i++){
@@ -352,7 +352,7 @@ bool ObjectDetection::LoadObjDetectdData(std::string inputFilePath){
352352

353353
std::shared_ptr<TrackedObjectBBox> trackedObjPtr = std::make_shared<TrackedObjectBBox>(trackedObj);
354354
ClipBase* parentClip = this->ParentClip();
355-
trackedObjPtr->ParentClip(parentClip);
355+
trackedObjPtr->ParentClip(parentClip);
356356

357357
// Create a temp ID. This ID is necessary to initialize the object_id Json list
358358
// this Id will be replaced by the one created in the UI

src/effects/Tracker.cpp

+49-49
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ using google::protobuf::util::TimeUtil;
3434
/// Blank constructor, useful when using Json to load the effect properties
3535
Tracker::Tracker(std::string clipTrackerDataPath)
3636
{
37-
// Init effect properties
37+
// Init effect properties
3838
init_effect_details();
39-
// Instantiate a TrackedObjectBBox object and point to it
39+
// Instantiate a TrackedObjectBBox object and point to it
4040
TrackedObjectBBox trackedDataObject;
4141
trackedData = std::make_shared<TrackedObjectBBox>(trackedDataObject);
4242
// Tries to load the tracked object's data from protobuf file
@@ -85,16 +85,16 @@ void Tracker::init_effect_details()
8585
// modified openshot::Frame object
8686
std::shared_ptr<Frame> Tracker::GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number)
8787
{
88-
// Get the frame's image
88+
// Get the frame's image
8989
cv::Mat frame_image = frame->GetImageCV();
9090

9191
// Initialize the Qt rectangle that will hold the positions of the bounding-box
9292
QRectF boxRect;
9393
// Initialize the image of the TrackedObject child clip
9494
std::shared_ptr<QImage> childClipImage = nullptr;
9595

96-
// Check if frame isn't NULL
97-
if(!frame_image.empty() &&
96+
// Check if frame isn't NULL
97+
if(!frame_image.empty() &&
9898
trackedData->Contains(frame_number) &&
9999
trackedData->visible.GetValue(frame_number) == 1)
100100
{
@@ -105,8 +105,8 @@ std::shared_ptr<Frame> Tracker::GetFrame(std::shared_ptr<Frame> frame, int64_t f
105105
// Get the bounding-box of given frame
106106
BBox fd = trackedData->GetBox(frame_number);
107107

108-
// Check if track data exists for the requested frame
109-
if (trackedData->draw_box.GetValue(frame_number) == 1)
108+
// Check if track data exists for the requested frame
109+
if (trackedData->draw_box.GetValue(frame_number) == 1)
110110
{
111111
std::vector<int> stroke_rgba = trackedData->stroke.GetColorRGBA(frame_number);
112112
int stroke_width = trackedData->stroke_width.GetValue(frame_number);
@@ -144,10 +144,10 @@ std::shared_ptr<Frame> Tracker::GetFrame(std::shared_ptr<Frame> frame, int64_t f
144144
}
145145
}
146146

147-
}
147+
}
148148

149149
// Set image with drawn box to frame
150-
// If the input image is NULL or doesn't have tracking data, it's returned as it came
150+
// If the input image is NULL or doesn't have tracking data, it's returned as it came
151151
frame->SetImageCV(frame_image);
152152

153153
// Set the bounding-box image with the Tracked Object's child clip image
@@ -211,23 +211,23 @@ void Tracker::DrawRectangleRGBA(cv::Mat &frame_image, cv::RotatedRect box, std::
211211
// Get the indexes and IDs of all visible objects in the given frame
212212
std::string Tracker::GetVisibleObjects(int64_t frame_number) const{
213213

214-
// Initialize the JSON objects
215-
Json::Value root;
216-
root["visible_objects_index"] = Json::Value(Json::arrayValue);
217-
root["visible_objects_id"] = Json::Value(Json::arrayValue);
218-
219-
// Iterate through the tracked objects
220-
for (const auto& trackedObject : trackedObjects){
221-
// Get the tracked object JSON properties for this frame
222-
Json::Value trackedObjectJSON = trackedObject.second->PropertiesJSON(frame_number);
223-
if (trackedObjectJSON["visible"]["value"].asBool()){
224-
// Save the object's index and ID if it's visible in this frame
225-
root["visible_objects_index"].append(trackedObject.first);
226-
root["visible_objects_id"].append(trackedObject.second->Id());
227-
}
228-
}
229-
230-
return root.toStyledString();
214+
// Initialize the JSON objects
215+
Json::Value root;
216+
root["visible_objects_index"] = Json::Value(Json::arrayValue);
217+
root["visible_objects_id"] = Json::Value(Json::arrayValue);
218+
219+
// Iterate through the tracked objects
220+
for (const auto& trackedObject : trackedObjects){
221+
// Get the tracked object JSON properties for this frame
222+
Json::Value trackedObjectJSON = trackedObject.second->PropertiesJSON(frame_number);
223+
if (trackedObjectJSON["visible"]["value"].asBool()){
224+
// Save the object's index and ID if it's visible in this frame
225+
root["visible_objects_index"].append(trackedObject.first);
226+
root["visible_objects_id"].append(trackedObject.second->Id());
227+
}
228+
}
229+
230+
return root.toStyledString();
231231
}
232232

233233
// Generate JSON string of this object
@@ -252,12 +252,12 @@ Json::Value Tracker::JsonValue() const {
252252

253253
// Add trackedObjects IDs to JSON
254254
Json::Value objects;
255-
for (auto const& trackedObject : trackedObjects){
256-
Json::Value trackedObjectJSON = trackedObject.second->JsonValue();
257-
// add object json
258-
objects[trackedObject.second->Id()] = trackedObjectJSON;
259-
}
260-
root["objects"] = objects;
255+
for (auto const& trackedObject : trackedObjects){
256+
Json::Value trackedObjectJSON = trackedObject.second->JsonValue();
257+
// add object json
258+
objects[trackedObject.second->Id()] = trackedObjectJSON;
259+
}
260+
root["objects"] = objects;
261261

262262
// return JsonValue
263263
return root;
@@ -313,23 +313,23 @@ void Tracker::SetJsonValue(const Json::Value root) {
313313
}
314314
}
315315

316-
if (!root["objects"].isNull()){
317-
for (auto const& trackedObject : trackedObjects){
318-
std::string obj_id = std::to_string(trackedObject.first);
319-
if(!root["objects"][obj_id].isNull()){
320-
trackedObject.second->SetJsonValue(root["objects"][obj_id]);
321-
}
322-
}
316+
if (!root["objects"].isNull()){
317+
for (auto const& trackedObject : trackedObjects){
318+
std::string obj_id = std::to_string(trackedObject.first);
319+
if(!root["objects"][obj_id].isNull()){
320+
trackedObject.second->SetJsonValue(root["objects"][obj_id]);
321+
}
322+
}
323323
}
324324

325-
// Set the tracked object's ids
326-
if (!root["objects_id"].isNull()){
327-
for (auto const& trackedObject : trackedObjects){
328-
Json::Value trackedObjectJSON;
329-
trackedObjectJSON["box_id"] = root["objects_id"][trackedObject.first].asString();
330-
trackedObject.second->SetJsonValue(trackedObjectJSON);
331-
}
332-
}
325+
// Set the tracked object's ids
326+
if (!root["objects_id"].isNull()){
327+
for (auto const& trackedObject : trackedObjects){
328+
Json::Value trackedObjectJSON;
329+
trackedObjectJSON["box_id"] = root["objects_id"][trackedObject.first].asString();
330+
trackedObject.second->SetJsonValue(trackedObjectJSON);
331+
}
332+
}
333333

334334
return;
335335
}
@@ -345,8 +345,8 @@ std::string Tracker::PropertiesJSON(int64_t requested_frame) const {
345345
for (auto const& trackedObject : trackedObjects){
346346
Json::Value trackedObjectJSON = trackedObject.second->PropertiesJSON(requested_frame);
347347
// add object json
348-
objects[trackedObject.second->Id()] = trackedObjectJSON;
349-
}
348+
objects[trackedObject.second->Id()] = trackedObjectJSON;
349+
}
350350
root["objects"] = objects;
351351

352352
// Append effect's properties

0 commit comments

Comments
 (0)