⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chpt3.html

📁 klt, a tracking algorithm
💻 HTML
字号:
<title> </title><a href = "../index.html"><IMG SRC="../home_motif.gif" ALIGN=bottom></a><a href = "index.html"><IMG SRC="../toc_motif.gif" ALIGN=bottom></a><a href = "chpt2.html"><IMG SRC="../previous_motif.gif" ALIGN=bottom></a><a href = "chpt4.html"><IMG SRC="../next_motif.gif" ALIGN=bottom></a><hr><h2> Chapter 3: Replacing Lost Features </h2>KLTTrackFeatures() sometimes loses features (either becausethey actually became occluded or go out of bounds, or because the computation failsfor one reason or another).  If it is desired to always maintaina certain number of features, e.g. 100, then the lost features canbe replaced by calling <b>KLTReplaceLostFeatures()</b>.  This functioncalls the same underlying computation asKLTSelectGoodFeatures() tofind all the features in the image and rank them accordingly.Then, if <i>k</i> features have been lost, the <i>k</i> bestfeatures are used to replace them. <p>Below is sample code using this function.<hr><h3> Example 2</h3><pre width=80>/**********************************************************************Finds the 100 best features in an image, tracks thesefeatures to the next image, and replaces the lost features with newfeatures in the second image.  Saves the featurelocations (before and after tracking) to text files and to PPM files.**********************************************************************/#include "pnmio.h"#include "klt.h"void main(){     unsigned char *img1, *img2;     KLT_TrackingContext tc;     KLT_FeatureList fl;     int nFeatures = 100;     int ncols, nrows;     tc = KLTCreateTrackingContext();     fl = KLTCreateFeatureList(nFeatures);     img1 = pgmReadFile("img0.pgm", NULL, &ncols, &nrows);     img2 = pgmReadFile("img1.pgm", NULL, &ncols, &nrows);     KLTSelectGoodFeatures(tc, img1, ncols, nrows, fl);     KLTWriteFeatureListToPPM(fl, img1, ncols, nrows, "feat1.ppm");     KLTWriteFeatureList(fl, "feat1.txt", "%3d");     KLTTrackFeatures(tc, img1, img2, ncols, nrows, fl);     KLTReplaceLostFeatures(tc, img2, ncols, nrows, fl);     KLTWriteFeatureListToPPM(fl, img2, ncols, nrows, "feat2.ppm");     KLTWriteFeatureList(fl, "feat2.txt", "%3d");}</pre><hr><a href = "../index.html"><IMG SRC="../home_motif.gif" ALIGN=bottom></a><a href = "index.html"><IMG SRC="../toc_motif.gif" ALIGN=bottom></a><a href = "chpt2.html"><IMG SRC="../previous_motif.gif" ALIGN=bottom></a><a href = "chpt4.html"><IMG SRC="../next_motif.gif" ALIGN=bottom></a>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -