Changeset View
Changeset View
Standalone View
Standalone View
libmv/autotrack/autotrack.cc
| Context not available. | |||||
| bool AutoTrack::TrackMarker(Marker* tracked_marker, | bool AutoTrack::TrackMarker(Marker* tracked_marker, | ||||
| TrackRegionResult* result, | TrackRegionResult* result, | ||||
| KalmanFilterState* predictionState, | |||||
| const TrackRegionOptions* track_options) { | const TrackRegionOptions* track_options) { | ||||
| // Try to predict the location of the second marker. | // Try to predict the location of the second marker. | ||||
| bool predicted_position = false; | bool predicted_position; | ||||
| if (PredictMarkerPosition(tracks_, tracked_marker)) { | if (predictionState) { | ||||
| predicted_position = predictionState->PredictForward(tracked_marker->frame, tracked_marker); | |||||
| } else { | |||||
| predicted_position = PredictMarkerPosition(tracks_, tracked_marker); | |||||
| } | |||||
| if (predicted_position) { | |||||
| LG << "Succesfully predicted!"; | LG << "Succesfully predicted!"; | ||||
| predicted_position = true; | |||||
| } else { | } else { | ||||
| LG << "Prediction failed; trying to track anyway."; | LG << "Prediction failed; trying to track anyway."; | ||||
| } | } | ||||
| Context not available. | |||||
| frame_accessor_->ReleaseImage(reference_key); | frame_accessor_->ReleaseImage(reference_key); | ||||
| frame_accessor_->ReleaseImage(tracked_key); | frame_accessor_->ReleaseImage(tracked_key); | ||||
| // Update the kalman filter with the new measurement | |||||
| if (predictionState && result->is_usable()) { | |||||
| predictionState->Update(*tracked_marker); | |||||
| } | |||||
| // TODO(keir): Possibly the return here should get removed since the results | // TODO(keir): Possibly the return here should get removed since the results | ||||
| // are part of TrackResult. However, eventually the autotrack stuff will have | // are part of TrackResult. However, eventually the autotrack stuff will have | ||||
| // extra status (e.g. prediction fail, etc) that should get included. | // extra status (e.g. prediction fail, etc) that should get included. | ||||
| Context not available. | |||||
| tracks_.AddMarker(marker); | tracks_.AddMarker(marker); | ||||
| } | } | ||||
| void AutoTrack::SetMarkers(vector<Marker>* markers) { | void AutoTrack::SetMarkers(TrackMarkersMap* markers) { | ||||
| tracks_.SetMarkers(markers); | tracks_.SetMarkers(markers); | ||||
| } | } | ||||
| Context not available. | |||||