calibTree.h
Go to the documentation of this file.
00001 
00006 #include <fstream>
00007 #include <cstdlib>
00008 #include <ros/ros.h>
00009 #include <stdint-gcc.h>
00010 #include <vector>
00011 
00012 #define NOT_SET 5
00013 #define BOTH_CAMERAS 3
00014 
00015 //Colors
00016 #define RED 0
00017 #define GREEN 1
00018 #define BLUE 2
00019 
00020 using namespace std;
00021 
00030 class calibTree
00031 {
00032 public:
00033 
00037   struct calib
00038   {
00039     uint8_t r;
00040     uint8_t g;
00041     uint8_t b;
00042     int camera;
00043     int calibType;
00044     //used to know the order in which calibs were created
00045     int id;
00046 
00047     //Used for the trees created.  
00048 
00049     struct calib * redTreeLeftChild;
00050     struct calib * redTreeRightChild;
00051     struct calib * redTreeParent;
00052   };
00053 
00057   calibTree();
00058 
00062   ~calibTree();
00063 
00072   void newCalibPoint(uint8_t red, uint8_t green, uint8_t blue, int camera, int calibType);
00073 
00078   int getCalibPointsSize();
00079 
00089   int getCalibPointColor(int index, int paramIndex);
00090 
00096   int getCalibPointCamera(int index);
00097 
00109   int getCalibPointType(int index);
00110 
00115   void removeCalibPoint(int index);
00116 
00120   void createTree();
00121 
00130   int parseCalibTree(int R, int G, int B, int camera, int calibAccuracy);
00131 
00136   void orderCalibsByRed();
00137 
00143   bool removeLastNodeFromTree(int cameraShown);
00144 
00148   void freeTree();
00149 
00153   void printTree();
00154 
00155 private:
00156 
00157   //Head of the calibration tree indexed on the red color values
00158   struct calib * treeHead;
00159 
00160   //Structures holding calibration files info use to create the tree.
00161   vector<calib> calibPoints;
00162 
00163   int idCount;
00164 
00165   /*
00166    Private Functions
00167    */
00168 
00175   void createTreeRecursion(int start, int end);
00176 
00187   int parseCalibTreeRecursion(calib * treeNode, int R, int G, int B, int camera, int calibAccuracy);
00188 
00199   bool removeLastNodeFromTreeRecursion(calib * nodePtr, int r, int g, int b, int id);
00200 
00205   void freeTreeRecursion(calib * treeHead);
00206 
00213   void addToTree(int calibNode);
00214 
00225   void createTreeNode(int vectorIndex, calib * nodePtr, calib * parentPtr);
00226 
00232   void printTreeRecursion(calib * node, int level);
00233 };


youbot_overhead_vision
Author(s): Fred Clinckemaillie, Maintained by David Kent
autogenerated on Thu Jan 2 2014 12:14:12