Skip to content

Late initialization causes beginning of the trajectory to be missing  #348

@youknowimcomingwhenyouhearmehumming

Description

Describe the bug

Sometimes the system cannot initialize from the beginning of a video if there are only few features in the images in the first part of the video. Therefore, the system initialized sometimes later - let's say at frame 50. Consequently, the trajectory between frame 0-50 is missing.

Suggested solution

This missing start trajectory can often be recovered by using exploiting the fact that the feature criteria for initialization is stricter than for the subsequently tracking. The recovery progress in this case is done by, at some point after the initialization, the video is set to frame 49 and running backwards with frame 48, 47, 46...0.

This works but there is a twist: the system is not able to handle frames with timestamps from the past. In my case, I use the function feed_monocular_frame(img, timestamp, mask). Instead of using the correct timestamps, when I feed the previous frames (49, 48, 47...0), I have to input timestamps that keep being ahead in time/in the future,

The problem of using timestamps that are in the past occurs in at least two places in the code:

  • in file tracking_module.cc:
    if (curr_frm_.timestamp_ < last_reloc_frm_timestamp_ + 1.0) {
    return false;
    }

  • keyframe_inserter.cc:
    bool min_interval_elapsed = false;
    if (min_interval_ > 0.0) {
    min_interval_elapsed = last_inserted_keyfrm && last_inserted_keyfrm->timestamp_ + min_interval_ <= curr_frm.timestamp_;
    min_interval_elapsed = true;
    }

Environment

  • Hardware: [PC]
  • CPU: [AMD Ryzen 7 5800X 8-Core Processor]
  • OS: [Ubuntu 22.04]
  • In my case it is not necessary to processes the video in real time

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions