-
Notifications
You must be signed in to change notification settings - Fork 15
How we access image objects has changed in vidtk #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -632,13 +632,14 @@ bool vpVidtkTrackIO::WriteTracks( | |||||||
|
|
||||||||
| double lat = 444.0; | ||||||||
| double lon = 444.0; | ||||||||
| vidtk::image_object_sptr obj; | ||||||||
| vidtk::image_object* obj= nullptr; | ||||||||
| vgl_box_2d<unsigned int> imageBox; | ||||||||
| bool validObject = false; | ||||||||
|
|
||||||||
| if (orig_state && !orig_state->latitude_longitude(lat, lon)) | ||||||||
| { | ||||||||
| if (orig_state->image_object(obj)) | ||||||||
| obj = orig_state->get_image_object(); | ||||||||
| if (obj != nullptr) | ||||||||
| { | ||||||||
| validObject = true; | ||||||||
| imageBox = obj->get_bbox(); | ||||||||
|
|
@@ -746,8 +747,7 @@ bool vpVidtkTrackIO::WriteTracks( | |||||||
| new_obj->set_bbox(newBox); | ||||||||
| } | ||||||||
|
|
||||||||
| new_objs[0] = new_obj; | ||||||||
| new_state->data_.set(vidtk::tracking_keys::img_objs, new_objs); | ||||||||
| new_state->set_image_object(new_obj); | ||||||||
|
|
||||||||
| track->add_state(new_state); | ||||||||
| } | ||||||||
|
|
@@ -936,7 +936,7 @@ void vpVidtkTrackIO::ReadTrack( | |||||||
| points.reserve(12); | ||||||||
|
|
||||||||
| bool skippedInterpolationPointSinceLastInsert = false; | ||||||||
| std::vector<vidtk::image_object_sptr> objs; | ||||||||
| vidtk::image_object_sptr obj; | ||||||||
| for (const auto& trackState : trackHistory) | ||||||||
| { | ||||||||
| const auto frameNumber = trackState->time_.frame_number(); | ||||||||
|
|
@@ -973,12 +973,13 @@ void vpVidtkTrackIO::ReadTrack( | |||||||
| timeStamp.SetTime(trackState->time_.time()); | ||||||||
| } | ||||||||
|
|
||||||||
| if (trackState->data_.get(vidtk::tracking_keys::img_objs, objs)) | ||||||||
| obj = trackState->get_image_object(); | ||||||||
| if (obj != nullptr) | ||||||||
|
Comment on lines
+976
to
+977
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, please modernize:
Suggested change
...and remove the prior declaration. (Incidentally, I approve of getting rid of out parameters! Those are awful...) |
||||||||
| { | ||||||||
| double lat, lon; | ||||||||
| if (!trackState->latitude_longitude(lat, lon)) | ||||||||
| { | ||||||||
| const auto& world_loc = objs[0]->get_world_loc(); | ||||||||
| const auto& world_loc = obj->get_world_loc(); | ||||||||
| lon = world_loc[0]; | ||||||||
| lat = world_loc[1]; | ||||||||
| } | ||||||||
|
|
@@ -987,7 +988,7 @@ void vpVidtkTrackIO::ReadTrack( | |||||||
| bool trackPointAvailable = true; | ||||||||
| double minY; | ||||||||
| double maxY; | ||||||||
| const auto& vglBBox = objs[0]->get_bbox(); | ||||||||
| const auto& vglBBox = obj->get_bbox(); | ||||||||
| double pt[4] = {0.0, 0.0, 0.0, 1.0}; | ||||||||
| vpFrame frameMetaData; | ||||||||
| if (this->StorageMode == TSM_TransformedGeoCoords) | ||||||||
|
|
@@ -1005,7 +1006,7 @@ void vpVidtkTrackIO::ReadTrack( | |||||||
| } | ||||||||
| else | ||||||||
| { | ||||||||
| const auto& image_loc = objs[0]->get_image_loc(); | ||||||||
| const auto& image_loc = obj->get_image_loc(); | ||||||||
| pt[0] = image_loc[0]; | ||||||||
| unsigned int imageMaxY = this->Reader.GetImageHeight() - 1; | ||||||||
| if (this->StorageMode == TSM_InvertedImageCoords) | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -397,6 +397,8 @@ void vtkVgTrack::InsertNextPoint(const vtkVgTimeStamp& timeStamp, | |||
| vtkPoints* fromShellPoints, | ||||
| vtkIdType fromShellPtsStart) | ||||
| { | ||||
| vtkDebugMacro("insert next point: " << timeStamp); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intended?
Suggested change
|
||||
|
|
||||
| if (!this->Points) | ||||
| { | ||||
| vtkErrorMacro("Must set Points before inserting track points!"); | ||||
|
|
@@ -709,6 +711,7 @@ void vtkVgTrack::SetPoint(const vtkVgTimeStamp& timeStamp, | |||
| vtkPoints* fromShellPts, | ||||
| vtkIdType fromShellPtsStart) | ||||
| { | ||||
| vtkDebugMacro("set point: " << timeStamp); | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| // if not closed and after the last point, just use InsertNextPoint() | ||||
| if (!this->EndFrame.IsValid() && | ||||
| (this->Internal->PointIdMap.size() == 0 || | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,12 +18,11 @@ | |||||||
| QList<vvTrackState> vvAdapt(const vidtk::track_state& vs) | ||||||||
| { | ||||||||
| QList<vvTrackState> stateList; | ||||||||
| std::vector<vidtk::image_object_sptr> objs; | ||||||||
| if (vs.data_.get(vidtk::tracking_keys::img_objs, objs)) | ||||||||
| vidtk::image_object* obj_sptr = vs.get_image_object(); | ||||||||
| if (obj_sptr != nullptr) | ||||||||
|
Comment on lines
+21
to
+22
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please modernize:
Suggested change
Also, the variable name is wrong:
|
||||||||
| { | ||||||||
| for (size_t i = 0; i < objs.size(); ++i) | ||||||||
| { | ||||||||
| const vidtk::image_object& obj = *objs[i]; | ||||||||
| const vidtk::image_object& obj = *obj_sptr; | ||||||||
|
|
||||||||
| vvTrackState state; | ||||||||
|
|
||||||||
|
|
@@ -38,8 +37,8 @@ QList<vvTrackState> vvAdapt(const vidtk::track_state& vs) | |||||||
| } | ||||||||
|
|
||||||||
| // Set image point and box | ||||||||
| const auto& img_loc = objs[i]->get_image_loc(); | ||||||||
| const auto& bbox = objs[i]->get_bbox(); | ||||||||
| const auto& img_loc = obj_sptr->get_image_loc(); | ||||||||
| const auto& bbox = obj_sptr->get_bbox(); | ||||||||
| state.ImagePoint.X = img_loc[0]; | ||||||||
| state.ImagePoint.Y = img_loc[1]; | ||||||||
| state.ImageBox.TopLeft.X = bbox.min_x(); | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please modernize:
...and remove the prior declaration.