-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
I think I'm misunderstanding how to use the offline slam tracker. Here's some sample code that I wrote based on my understanding of the API. However, it always produces pure rotational transformations that are very close to the identity.
#include "ocean/base/PluginManager.h"
#include "ocean/media/FrameMedium.h"
#include "ocean/media/ImageFileSequence.h"
#include "ocean/media/ImageSequenceFrameProviderInterface.h"
#include "ocean/media/Manager.h"
#include "ocean/media/imageio/ImageIO.h"
#include "ocean/tracking/offline/SLAMTracker.h"
int main(int argc, char **argv) {
auto tracker = std::make_shared<Ocean::Tracking::Offline::SLAMTracker>();
Ocean::Media::ImageIO::registerImageIOLibrary();
Ocean::PluginManager::get().loadPlugins(Ocean::PluginManager::TYPE_MEDIA);
Ocean::Media::FrameMediumRef frameMedium =
Ocean::Media::Manager::get().newMedium(
"./output/C3464225073010_000000.png",
Ocean::Media::Medium::Type::IMAGE_SEQUENCE, true);
if (!frameMedium) {
std::cerr << "no medium" << std::endl;
Ocean::Media::ImageIO::unregisterImageIOLibrary();
return -1;
}
int width = 960;
int height = 540;
float focal_x = 443.7213934872656;
float focal_y = 443.7213934872656;
float principal_x = width / 2;
float principal_y = height / 2;
Ocean::PinholeCamera pinholeCamera(width, height, focal_x, focal_y,
principal_x, principal_y);
auto frameProviderInterface = Ocean::CV::FrameProviderInterfaceRef(
new Ocean::Media::ImageSequenceFrameProviderInterface(frameMedium));
tracker->setFrameProviderInterface(frameProviderInterface);
tracker->setTrackingFrameRange(0, 100, 0);
tracker->setCamera(pinholeCamera, -1, false);
tracker->setRegionOfInterest(Ocean::CV::SubRegion(0, 0, width, height),
false);
tracker->setAbstractMotionType(Ocean::Tracking::Offline::OfflineTracker::
AbstractMotionType::AMT_COMPLEX);
tracker->start();
frameMedium->start();
while (tracker->running()) {
}
tracker->succeeded();
auto poses = tracker->poses();
for (const auto &pose : poses) {
std::cerr << pose.transformation() << std::endl;
}
Ocean::Media::ImageIO::unregisterImageIOLibrary();
return 0;
}
t3h32eKK
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation