本文整理汇总了C++中KeyFrame::GetTrackedKeypoints方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyFrame::GetTrackedKeypoints方法的具体用法?C++ KeyFrame::GetTrackedKeypoints怎么用?C++ KeyFrame::GetTrackedKeypoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyFrame
的用法示例。
在下文中一共展示了KeyFrame::GetTrackedKeypoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
VideoCapture cap(string(KAI_PATH).append("shield_vid.mp4"));
// VideoCapture cap(string(KAI_PATH).append("indoor.mov"));
// VideoCapture cap(string(MOHIT_PATH).append("indoor.avi"));
// VideoCapture cap("/Users/MohitSridhar/Downloads/kitti_youtube.avi");
// VideoCapture cap("/Users/MohitSridhar/Downloads/VID_20150530_120719.mp4");
if (!cap.isOpened())
{
cout << "failed to open video file" << endl;
return -1;
}
// Initialize visualizer and load initial map
Ptr<VisualizerListener> visualizerListener = new VisualizerListener;
InitializeVisualizer();
RunVisualizationOnly();
// Initialize SLAM
Mat frame;
Size size(640, 480);
vslam::VSlam slam = vslam::VSlam();
while (true) {
cap >> frame;
if (frame.empty()) {
break;
}
resize(frame, frame, size);
clock_t start = clock();
slam.ProcessFrame(frame);
clock_t end = clock();
double processFrameDuration = (end - start) / (double) CLOCKS_PER_SEC;
cout << "processFrameDuration: " << processFrameDuration << endl;
if (waitKey(30) == 27) {
break;
}
// Update visualizer
visualizerListener->update(slam.GetKeyFrames(), slam.GetCameraRot().back(), slam.
GetCameraPose().back());
RunVisualizationOnly();
// Draw translation and rotation information
Augmentor augmentor;
KeyFrame currKeyFrame = slam.GetCurrKeyFrame();
Mat translationMatrix = currKeyFrame.GetTranslation();
augmentor.DisplayTranslation(frame, translationMatrix);
Mat rotationMatrix = currKeyFrame.GetRotation();
augmentor.DisplayRotation(frame, rotationMatrix);
// Draw keypoints
KeypointArray keypoints = currKeyFrame.GetTrackedKeypoints();
Mat trackedFeatures;
Scalar kpColor = Scalar(255, 0, 0);
drawKeypoints(frame, keypoints, trackedFeatures, kpColor);
imshow("Tracked Features", trackedFeatures);
}
waitKey(0);
WaitForVisualizationThread();
return 0;
}