00001
00002 #ifndef strk_io_h_
00003 #define strk_io_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vcl_vector.h>
00019 #include <vcl_fstream.h>
00020 #include <vnl/vnl_matrix.h>
00021 #include <vgl/vgl_point_2d.h>
00022 #include <vtol/vtol_face_2d_sptr.h>
00023
00024 class strk_io
00025 {
00026 public:
00027
00028 ~strk_io();
00029
00030
00031 static bool write_histogram_data(const unsigned int start_frame,
00032 const unsigned int n_pixels,
00033 const float diameter,
00034 const float aspect_ratio,
00035 const unsigned int n_int_bins,
00036 const unsigned int n_grad_dir_bins,
00037 const unsigned int n_color_bins,
00038 vcl_vector<vcl_vector<float> >const& data,
00039 vcl_ofstream& strm);
00040
00041
00042 static bool
00043 write_track_data(const unsigned int start_frame,
00044 vcl_vector<vtol_face_2d_sptr> const& tracked_faces,
00045 vcl_ofstream& strm);
00046
00047
00048
00049 static bool read_histogram_data(vcl_ifstream& strm,
00050 unsigned int& start_frame,
00051 unsigned int& n_frames,
00052 unsigned int& n_pixels,
00053 float& diameter,
00054 float& aspect_ratio,
00055 unsigned int& n_int_bins,
00056 unsigned int& n_grad_dir_bins,
00057 unsigned int& n_color_bins,
00058 vnl_matrix<float>& hist_data);
00059
00060 static bool read_track_data(vcl_ifstream& strm,
00061 unsigned int& start_frame,
00062 unsigned int& n_frames,
00063 vcl_vector<vgl_point_2d<double> >& cogs,
00064 vcl_vector<vtol_face_2d_sptr>& tracked_faces);
00065 protected:
00066
00067 static bool write_frame_data(const unsigned int start_frame,
00068 const unsigned int n_frames,
00069 vcl_ofstream& strm);
00070
00071 static bool write_region_data(const unsigned int n_pix,
00072 const float diameter,
00073 const float aspect_ratio,
00074 vcl_ofstream& strm);
00075
00076 static bool read_frame_data(vcl_ifstream& strm,
00077 unsigned int& start_frame,
00078 unsigned int& n_frames);
00079
00080 static bool read_region_data(vcl_ifstream& strm,
00081 unsigned int& n_pix, float& diameter,
00082 float& aspect_ratio);
00083
00084
00085 private:
00086 strk_io();
00087 };
00088
00089 #endif // strk_io_h_