diff --git a/src/capture/capture_base.cpp b/src/capture/capture_base.cpp index db12b5847f5a5a5d93a791ba11727947b982b260..5f0ce68802c19668ce77ae1317062f0609f33399 100644 --- a/src/capture/capture_base.cpp +++ b/src/capture/capture_base.cpp @@ -291,7 +291,11 @@ void CaptureBase::setCalibration(const VectorXs& _calib) void CaptureBase::link(FrameBasePtr _frm_ptr) { - assert(this->getFrame() == nullptr && "linking an already linked capture"); + assert((this->getFrame() == nullptr || !this->getFrame()->isKey()) && "linking a capture already linked to a KF"); + + // unlink from previous non-key frame + if (this->getFrame()) + this->getFrame()->removeCapture(shared_from_this()); if(_frm_ptr) {