00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #include <iostream>
00027 #include <highgui.h>
00028
00029 #include <polyora/polyora.h>
00030
00031 using namespace std;
00032
00033 int main(int argc, char *argv[]) {
00034
00035 if (argc<2) {
00036 cerr << "usage: " << argv[0] << " <image> [<image> ...]\n";
00037 return -1;
00038 }
00039
00040
00041 IplImage *first = cvLoadImage(argv[1]);
00042 if (first==0) {
00043 cerr << argv[1] << ": can't load image\n";
00044 return -1;
00045 }
00046 int width = first->width;
00047 int height = first->height;
00048 cvReleaseImage(&first);
00049
00050 kpt_tracker tracker(width, height, 3, 10);
00051
00052
00053 tracker.load_from_db("visual.db");
00054
00055 for (int i=1; i<argc; i++) {
00056
00057
00058 IplImage *im = cvLoadImage(argv[i], 0);
00059 if (!im) {
00060 cerr << argv[i] << ": can't load image\n";
00061 continue;
00062 }
00063
00064
00065 tracker.process_frame(im);
00066
00067
00068 pyr_frame *frame= (pyr_frame *)tracker.get_nth_frame(0);
00069
00070
00071 for (tracks::keypoint_frame_iterator it(frame->points.begin()); !it.end(); ++it) {
00072 pyr_keypoint *k = (pyr_keypoint *) it.elem();
00073
00074 cout << "(" << k->u << "," << k->v << ")";
00075 }
00076 cout << endl;
00077
00078
00079 tracker.remove_unmatched_tracks(tracker.get_nth_frame(2));
00080 }
00081
00082 return 0;
00083 }