/* * This file is part of robotreality * * Copyright(c) sschulz techfak.uni-bielefeld.de * http://opensource.cit-ec.de/projects/robotreality * * This file may be licensed under the terms of the * GNU General Public License Version 3 (the ``GPL''), * or (at your option) any later version. * * Software distributed under the License is distributed * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the GPL for the specific language * governing rights and limitations. * * You should have received a copy of the GPL along with this * program. If not, go to http://www.gnu.org/licenses/gpl.html * or write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The development of this software was supported by the * Excellence Cluster EXC 277 Cognitive Interaction Technology. * The Excellence Cluster EXC 277 is a grant of the Deutsche * Forschungsgemeinschaft (DFG) in the context of the German * Excellence Initiative. * */ #ifndef _DOTTRACKER_H_ #define _DOTTRACKER_H_ #include #include #include #include #include "RGBImageFilter.h" #include "BlobFinder.h" #include "EyeFinder.h" #include "MarkerModel.h" #include "DataOutput.h" #include "DataOutputCSV.h" #include "DataOutputLCM.h" #include "UnitConverter.h" #include "ConfigOptions.h" #include "HeadTracker.h" #include "OutputVisualizer.h" #include "GlobalHelpers.h" using namespace cv; class DotTracker{ public: DotTracker(char *filename); ~DotTracker(); void init_mousehandler(); void do_tracking(); void handle_mouse_event(int event, int x, int y, int flags); void refit_model(); void set_eye_zero(); void set_output(bool state); void calc_head_zero_rot(); void reset_framecounter(); void set_eyefinder_brightness_threshold(int v); private: string image_path; void threaded_cvtColor(Mat source, Mat target, int); void single_cvtColor(Mat source, Mat target, int bayer_mode); double get_angle(Point2d a, Point2d b); Mat get_rotation_translation_matrix(MarkerModel *m, double); void remove_translation_and_rotation(MarkerModel *m, EyeFinder *e, HeadTracker *h); void init_camera(int idx); bool grab_image(); void colorclass_select(int); void colorclass_clear(); void normalize_histogram(Mat *img); VideoCapture *camera; Mat frame_raw; Mat frame_raw_planes[3]; Mat frame_rgb; Mat frame_rgb_roi; Mat frame_rgb_filtered; Mat frame_rgb_filtered_rot; Mat frame_pixelfilter_result; Mat frame_result_eye; Mat frame_rgb_filtered2; Mat frame_raw_roi_upper; Mat resultview_rotated; bool first; RGBImageFilter *rgb_image_filter; BlobFinder *blobfinder; EyeFinder *eyefinder; MarkerModel *marker_model; DataOutput *data_output; UnitConverter *unit_converter; ConfigOptions *cfg; OutputVisualizer *output_vis; HeadTracker *head_tracker; int dummy_eye_radius_x; int dummy_eye_radius_y; int dummy_eyelid_scale_factor; int dummy_orientation_scale_factor_x; int dummy_orientation_scale_factor_y; int dummy_mouth_offset; int dummy_mouth_scale_factor; // int mouth_zero_distance; int angle_tmp_100; // int colorclass_selected; // int frame_number; // int eyefinder_brightness_threshold; // int eyefinder_brightness_threshold2; // // bool debug_show_eyefinder_results; // bool debug_show_pixelfilter_results; // bool debug_show_text; // bool debug_show_results; // bool debug_show_model_results; // bool dump_data_to_stdout; // bool free_running; // bool show_rgb_normalized; // bool rotate_resultview; // bool normalize_resultview_histogram; int last_frame; int calib_index; char *image_source_filename; // bool grab_from_cam; }; // void button_wrapper(int event, int x, int y, int flags, void* ptr); #endif