| 202 | } |
| 203 | |
| 204 | std::vector<int> Frame::SelectFeaturesForTracking() const { |
| 205 | std::vector<int> selected_indices; |
| 206 | |
| 207 | // Select best feature from each grid cell |
| 208 | for (const auto& row : m_feature_grid) { |
| 209 | for (const auto& cell : row) { |
| 210 | if (cell.empty()) continue; |
| 211 | |
| 212 | // Find feature with highest track count |
| 213 | int best_idx = -1; |
| 214 | int max_track_count = -1; |
| 215 | |
| 216 | for (int idx : cell) { |
| 217 | if (idx >= 0 && idx < static_cast<int>(m_features.size()) && m_features[idx]) { |
| 218 | int track_count = m_features[idx]->GetTrackCount(); |
| 219 | if (track_count > max_track_count) { |
| 220 | max_track_count = track_count; |
| 221 | best_idx = idx; |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | if (best_idx >= 0) { |
| 227 | selected_indices.push_back(best_idx); |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | return selected_indices; |
| 233 | } |
| 234 | |
| 235 | // ============ MapPoint Management ============ |
| 236 |
nothing calls this directly
no test coverage detected