camshiftKalman
 All Classes Files Functions Variables Enumerations Enumerator Macros
util.h
Go to the documentation of this file.
1 #ifndef UTIL_H
2 #define UTIL_H
3 
4 #include <opencv2/core/core.hpp>
5 #include <string>
6 #include <fstream>
7 
15 void readConfig(char* configFileName, char* videoPath, cv::Rect &box);
16 
23 void writeXML(std::string configFileName, const std::string videoPath, const cv::Rect box);
24 
31 void readXML(std::string configFileName, std::string &videoPath, cv::Rect &box);
32 
38 template <class T> int unique(T* src, int len)
39 {
40  assert(src != NULL);
41 
42  int index = 1, end = 0;
43  for(;index < len; index++){
44  int k = 0;
45  for(;k <= end; k++)
46  if(src[index] == src[k])
47  break;
48  if(k > end){
49  end++;
50  src[end] = src[index];
51  }
52  }
53 
54  return end+1;
55 }
56 #endif // UTIL_H