00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VSVIEW_H
00021 #define VSVIEW_H
00022
00023 #include <videosource.h>
00024 #include <cv.h>
00025 #include <qapplication.h>
00026
00027 #include <QKeyEvent>
00028 #include <QTimerEvent>
00029 #include <QTime>
00030
00031 #include "glbox.h"
00032 #include "ipltexture.h"
00033 #include <polyora/polyora.h>
00034
00035 class vobj_tracker_view : public GLBox {
00036 Q_OBJECT
00037
00038 public:
00039 vobj_tracker_view(QWidget *parent, const char *name, VideoSource *vs);
00040 ~vobj_tracker_view();
00041 VideoSource *vs;
00042
00043 void saveCurrentFrame(const char *filename);
00044
00045 protected slots:
00047 void timerEvent( QTimerEvent *);
00048
00050 void keyPressEvent(QKeyEvent *k);
00051 void mousePressEvent ( QMouseEvent * event );
00052 void mouseReleaseEvent ( QMouseEvent * event );
00053 void mouseDoubleClickEvent ( QMouseEvent * event );
00054
00056 void paintGL();
00057
00058 void show_help();
00059
00060 private:
00061
00062 int timer;
00063 bool filter;
00064 bool viewScores;
00065
00066 public:
00067 bool record;
00068 bool record_movie;
00069 bool auto_index;
00070 bool learning;
00071
00072 bool draw_color_flag, draw_matches_flag, draw_instance_flag;
00073 enum {
00074 DRAW_COLOR = 1,
00075 DRAW_MATCHES = 2,
00076 DRAW_INSTANCE = 4,
00077 DRAW_TRACKS = 8,
00078 DRAW_DARK =16,
00079 DRAW_KEYPOINTS=32
00080 };
00081 unsigned draw_flags;
00082 private:
00083
00084 int nbLev;
00085
00086 IplImage *im, *im2;
00087
00088 vobj_tracker *tracker;
00089 visual_database database;
00090
00091
00092 QTime qtime;
00093 int frameCnt;
00094 int frameno;
00095
00096
00097 public:
00098 const char *tree_fn, *clusters_fn, *descriptors_fn;
00099 const char *visual_db_fn;
00100 float threshold;
00101 int query_flags;
00102 private:
00103
00104 std::list<IplTexture> icon_texture_used, icon_texture_available;
00105
00106 IplTexture entry_tex;
00107 QTime add_frame_time;
00108
00109 int nb_missing_frames;
00110 pyr_keypoint *selected_kpt;
00111
00112 bool selectKeypoint (QMouseEvent *event);
00113 void show_track(pyr_keypoint *k);
00114 void show_tracks();
00115 void createTracker();
00116 void draw_keypoints(pyr_frame *frame);
00117 void draw_all_tracks(pyr_frame *frame);
00118 void draw_selected_track();
00119 void draw_icon(point2d *c, CvArr *image, float w, float h, float max_width, int margin_x=0, int margin_y=0);
00120 void draw_entry_image(visual_object *entry);
00121 void draw_matches(vobj_frame *frame);
00122 void add_current_frame_to_db(const char *name, int flags);
00123
00124 typedef std::map<unsigned, std::pair<double, unsigned> > fps_stat_map;
00125 fps_stat_map fps_stat;
00126 void update_fps_stat(float fr_ms, pyr_frame *pframe);
00127
00128 void summary();
00129 void homography_augment(visual_object *obj, float H[3][3]);
00130 void draw_instances(vobj_frame *frame);
00131 GLuint get_texture_for_obj(visual_object *obj);
00132
00133 QWidget *help_window;
00134 };
00135
00136 #endif
00137