/* * 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. * */ #include "ConfigOptions.h" ConfigOptions::ConfigOptions(){ init_defaults(); } ConfigOptions::~ConfigOptions(){ } void ConfigOptions::load(string filename){ //load: tconfig.load(filename); //restore to colorsample vector: colorsample_vector.clear(); colorsample_t colorsample; for(int i=0; i [%d] colorsample.%d = %d,%d,%d\n",i,colorsample.id,colorsample.r,colorsample.g,colorsample.b); colorsample_vector.push_back(colorsample); } } void ConfigOptions::save(string filename){ //copy colorsample vector to id,r,g,b: colorsample_vector_id.clear(); colorsample_vector_r.clear(); colorsample_vector_g.clear(); colorsample_vector_b.clear(); colorsample_vector_t::iterator it; for(it = colorsample_vector.begin(); it colorsample.%d = %d,%d,%d\n",colorsample.id,colorsample.r,colorsample.g,colorsample.b); colorsample_vector_id.push_back(colorsample.id); colorsample_vector_r.push_back(colorsample.r); colorsample_vector_g.push_back(colorsample.g); colorsample_vector_b.push_back(colorsample.b); } tconfig.save(filename); } void ConfigOptions::init_defaults(){ tconfig.add_variable("grab_from_cam", &grab_from_cam, true); tconfig.add_variable("debug_show_eyefinder_results", &debug_show_eyefinder_results, false); tconfig.add_variable("debug_show_pixelfilter_results", &debug_show_pixelfilter_results, true); tconfig.add_variable("debug_show_text", &debug_show_text, false); tconfig.add_variable("debug_show_results", &debug_show_results, true); tconfig.add_variable("debug_show_model_results", &debug_show_model_results, true); tconfig.add_variable("data_output_active", &data_output_active, false); tconfig.add_variable("free_running", &free_running, true); tconfig.add_variable("show_rgb_normalized", &show_rgb_normalized, true); tconfig.add_variable("rotate_resultview", &rotate_resultview, false); tconfig.add_variable("normalize_resultview_histogram", &normalize_resultview_histogram, false); tconfig.add_variable("show_output", &show_output, true); tconfig.add_variable("output_lcm_head", &output_lcm_head, true); tconfig.add_variable("output_lcm_eyes", &output_lcm_eyes, false); tconfig.add_variable("output_lcm_brows", &output_lcm_brows, false); tconfig.add_variable("output_lcm_eyelids", &output_lcm_eyelids, false); tconfig.add_variable("output_lcm_mouth", &output_lcm_mouth, false); tconfig.add_variable("output_lcm_mirror_mode", &output_lcm_mirror_mode, false); tconfig.add_variable("update_markermodel", &update_markermodel, true); tconfig.add_variable("eyelid_fake_mode", &eyelid_fake_mode, false); tconfig.add_variable("eyedetection_by_hough_circles", &eyedetection_by_hough_circles, false); tconfig.add_variable("fixation_2d_correction", &fixation_2d_correction, false); tconfig.add_variable("data_output_class", &data_output_class, 0); tconfig.add_variable("camera_id", &camera_id, 0); tconfig.add_variable("colorclass_selected", &colorclass_selected, 0); tconfig.add_variable("frame_number", &frame_number, 1); tconfig.add_variable("frame_number_end", &frame_number_end, 5000); tconfig.add_variable("eyefinder_brightness_threshold", &eyefinder_brightness_threshold, 4); tconfig.add_variable("eyefinder_brightness_threshold2", &eyefinder_brightness_threshold2, 4); tconfig.add_variable("head_zero_rotation", &head_zero_rotation, 0.0); tconfig.add_variable("calibration_angle_x", &calibration_angle_x, 17.0); tconfig.add_variable("calibration_angle_y", &calibration_angle_y, 17.0); tconfig.add_variable("calibration_r_x", &calibration_r_x, 49.0); tconfig.add_variable("calibration_r_y", &calibration_r_y, 49.0); tconfig.add_variable("eyelid_scale_factor", &eyelid_scale_factor, 1.2); tconfig.add_variable("mouth_search_split_position", &mouth_search_split_position, 640-300); tconfig.add_variable("mouth_scale_factor", &mouth_scale_factor, 0.087); tconfig.add_variable("mouth_offset", &mouth_offset, 24.0); tconfig.add_variable("head_zero_pos", &head_zero_pos, Point2d(0.0, 0.0)); tconfig.add_variable("eye_radius_px", &eye_radius_px, Point2d(38.0, 38.0)); tconfig.add_variable("eye_pos_straight_offset.0", &eye_pos_straight_offset[0], Point2d(640-180,350)); tconfig.add_variable("eye_pos_straight_offset.1", &eye_pos_straight_offset[1], Point2d(640-180,120)); tconfig.add_variable("orientation_scale_factor", &orientation_scale_factor, Point2d(1.0, 1.0)); tconfig.add_variable("mouth_center_pos.0", &mouth_center_pos[0], Point2d(200.0, 350.0)); tconfig.add_variable("mouth_center_pos.1", &mouth_center_pos[1], Point2d(205.0, 251.0)); tconfig.add_variable("mouth_center_pos.2", &mouth_center_pos[2], Point2d(200.0, 159.0)); tconfig.add_variable("image_source_filename", &image_source_filename, "/no/filename/given"); tconfig.add_variable("imu_data_source", &imu_data_source, "/dev/ttyUSB0"); tconfig.add_variable("csv_output_filename", &csv_output_filename, "/tmp/robotreality_dump.csv"); tconfig.add_variable("imu_zero_rotation.x", &imu_zero_rotation.x, 0.0); tconfig.add_variable("imu_zero_rotation.y", &imu_zero_rotation.y, 0.0); tconfig.add_variable("imu_zero_rotation.z", &imu_zero_rotation.z, 0.0); //do not init lookuptable, only allow loading tconfig.add_variable("colorsample_vector_id", &colorsample_vector_id, vector()); tconfig.add_variable("colorsample_vector_r", &colorsample_vector_r, vector()); tconfig.add_variable("colorsample_vector_g", &colorsample_vector_g, vector()); tconfig.add_variable("colorsample_vector_b", &colorsample_vector_b, vector()); } bool ConfigOptions::rgb_lookuptable_from_file(){ return false; } string ConfigOptions::rgb_lookuptable_filename(){ return "./lookuptable.bin"; }