map_location_alg.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
00024 
00025 #ifndef _map_location_alg_h_
00026 #define _map_location_alg_h_
00027 
00028 #include <iri_map_location/MapLocationConfig.h>
00029 #include "mutex.h"
00030 
00031 #include <opencv/cvwimage.h>
00032 #include <opencv/highgui.h>
00033 //#include <opencv2/imgproc/imgproc.hpp>
00034 //#include <opencv2/highgui/highgui.hpp>
00035 //#include <opencv2/core/core.hpp>
00036 
00037 //include map_location_alg main library
00038 
00039 static const char WINDOW[] = "Image window";
00040 
00046 class MapLocationAlgorithm
00047 {
00048   protected:
00055     CMutex alg_mutex_;
00056 
00057     // private attributes and methods
00058     std::string mapPath;
00059     std::string logoPath;
00060     std::string logo2Path;
00061     cv::Mat mapImage;
00062     cv::Mat logoImage;
00063     cv::Mat logo2Image;
00064     
00065     int t;
00066 
00067     
00068     std::vector< CvScalar         > colorList;
00069     std::vector< std::string      > textList;    
00070     std::vector< CvScalar         > currentColor;
00071     std::vector< std::string      > currentText;
00072     std::vector< std::vector<int> > locations;    
00073 
00074     void initialize();
00075     cv::Mat loadImage(std::string const imagePath, int mode);
00076     void loadCaption();
00077     void loadLocations();
00078 
00079     void initText(cv::Size * textSize, CvFont * font, int const fontFace, double const fontScale, float const fontShare, int const fontThickness, int const fontLineType, std::vector<std::string> const text);
00080     void drawCircle(int x, int y, int r,  CvScalar color);    
00081     void showImage();
00082 
00083   public:
00090     typedef iri_map_location::MapLocationConfig Config;
00091 
00098     Config config_;
00099 
00108     MapLocationAlgorithm(void);
00109 
00115     void lock(void) { alg_mutex_.enter(); };
00116 
00122     void unlock(void) { alg_mutex_.exit(); };
00123 
00131     bool try_enter(void) { return alg_mutex_.try_enter(); };
00132 
00144     void config_update(Config& new_cfg, uint32_t level=0);
00145 
00146     // here define all map_location_alg interface methods to retrieve and set
00147     // the driver parameters
00148     cv::Mat image;
00149     cv::Mat getImage();
00150     void loadFiles();
00151     void mapIteration();
00152     void logoIteration();
00153     void addLocation(float xpos, float ypos, int colorindex);
00154     void addLocationWithCode(int code);
00155     
00156     std::string path;
00157 
00164     ~MapLocationAlgorithm(void);
00165 };
00166 
00167 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


iri_map_location
Author(s): fherrero
autogenerated on Tue Jan 15 2013 15:09:06