30 std::lock_guard<std::mutex> lck(
mtx);
42 std::lock_guard<std::mutex> lck(
mtx);
47 feat.
featid = temp->featid;
54 feat.
p_FinA = temp->p_FinA;
55 feat.
p_FinG = temp->p_FinG;
62 std::lock_guard<std::mutex> lck(
mtx);
67 feat->uvs[cam_id].push_back(Eigen::Vector2f(u, v));
68 feat->uvs_norm[cam_id].push_back(Eigen::Vector2f(u_n, v_n));
69 feat->timestamps[cam_id].push_back(timestamp);
77 std::shared_ptr<Feature> feat = std::make_shared<Feature>();
79 feat->uvs[cam_id].push_back(Eigen::Vector2f(u, v));
80 feat->uvs_norm[cam_id].push_back(Eigen::Vector2f(u_n, v_n));
81 feat->timestamps[cam_id].push_back(timestamp);
90 std::vector<std::shared_ptr<Feature>> feats_old;
93 std::lock_guard<std::mutex> lck(
mtx);
96 if (skip_deleted && (*it).second->to_delete) {
102 bool has_newer_measurement =
false;
103 for (
auto const &pair : (*it).second->timestamps) {
104 has_newer_measurement = (!pair.second.empty() && pair.second.at(pair.second.size() - 1) >= timestamp);
105 if (has_newer_measurement) {
110 if (!has_newer_measurement) {
111 feats_old.push_back((*it).second);
131 std::vector<std::shared_ptr<Feature>> feats_old;
134 std::lock_guard<std::mutex> lck(
mtx);
137 if (skip_deleted && (*it).second->to_delete) {
143 bool found_containing_older =
false;
144 for (
auto const &pair : (*it).second->timestamps) {
145 found_containing_older = (!pair.second.empty() && pair.second.at(0) < timestamp);
146 if (found_containing_older) {
151 if (found_containing_older) {
152 feats_old.push_back((*it).second);
172 std::vector<std::shared_ptr<Feature>> feats_has_timestamp;
175 std::lock_guard<std::mutex> lck(
mtx);
178 if (skip_deleted && (*it).second->to_delete) {
184 bool has_timestamp =
false;
185 for (
auto const &pair : (*it).second->timestamps) {
186 has_timestamp = (std::find(pair.second.begin(), pair.second.end(), timestamp) != pair.second.end());
193 feats_has_timestamp.push_back((*it).second);
208 return feats_has_timestamp;
214 std::lock_guard<std::mutex> lck(
mtx);
217 if ((*it).second->to_delete) {
227 std::lock_guard<std::mutex> lck(
mtx);
230 (*it).second->clean_older_measurements(timestamp);
233 for (
const auto &pair : (*it).second->timestamps) {
234 ct_meas += (int)(pair.second.size());
246 std::lock_guard<std::mutex> lck(
mtx);
247 std::vector<double> timestamps = {timestamp};
250 (*it).second->clean_invalid_measurements(timestamps);
253 for (
const auto &pair : (*it).second->timestamps) {
254 ct_meas += (int)(pair.second.size());
266 std::lock_guard<std::mutex> lck(
mtx);
267 double oldest_time = -1;
269 for (
auto const &camtimepair : feat.second->timestamps) {
270 if (!camtimepair.second.empty() && (oldest_time == -1 || oldest_time > camtimepair.second.at(0))) {
271 oldest_time = camtimepair.second.at(0);
279 std::lock_guard<std::mutex> lck(
mtx);
283 for (
const auto &feat : database->get_internal_data()) {
288 for (
const auto × : feat.second->timestamps) {
291 size_t cam_id = times.first;
292 if (temp->timestamps.find(cam_id) == temp->timestamps.end()) {
293 temp->timestamps[cam_id] = feat.second->timestamps.at(cam_id);
294 temp->uvs[cam_id] = feat.second->uvs.at(cam_id);
295 temp->uvs_norm[cam_id] = feat.second->uvs_norm.at(cam_id);
297 auto temp_times = temp->timestamps.at(cam_id);
298 for (
size_t i = 0; i < feat.second->timestamps.at(cam_id).
size(); i++) {
299 double time_to_find = feat.second->timestamps.at(cam_id).at(i);
300 if (std::find(temp_times.begin(), temp_times.end(), time_to_find) == temp_times.end()) {
301 temp->timestamps.at(cam_id).push_back(feat.second->timestamps.at(cam_id).at(i));
302 temp->uvs.at(cam_id).push_back(feat.second->uvs.at(cam_id).at(i));
303 temp->uvs_norm.at(cam_id).push_back(feat.second->uvs_norm.at(cam_id).at(i));
312 std::shared_ptr<Feature> temp = std::make_shared<Feature>();
313 temp->featid = feat.second->featid;
314 temp->timestamps = feat.second->timestamps;
315 temp->uvs = feat.second->uvs;
316 temp->uvs_norm = feat.second->uvs_norm;