Blame view

include/matcell.h 982 Bytes
b0bb08d1c   tristan   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  #ifndef MATCELL_H
  #define MATCELL_H
  
  #include <math.h>
  #include <iostream>
  #include <opencv2/core/core.hpp>
  #include <opencv2/highgui/highgui.hpp>
  
  class MatCell
  {
  public:
      MatCell();
      MatCell(int nbElements);
      ~MatCell();
  
      operator cv::Mat_<double>() const;
  
      void eachAssign( const cv::Mat &m);
      void eachMultiplyRight(const cv::Mat &m);
      void eachMultiplyLeft(const cv::Mat &m);
  
      friend std::ostream &operator<<(std::ostream &os, const MatCell &A){
          MatCell m = A;
          for (int i = 0; i < m.size(); i++){
              os << m[i] << "
  ";
          }
          return os;
      }
  
      int size(){ return (int)_elements.size();}
  
      cv::Mat_<double> &operator[] (const int index);
      void add(cv::Mat_<double> mat){ _elements.push_back(mat); }
  
  
  private:
      cv::Mat toMat();
      std::vector<cv::Mat_<double>> _elements;
  };
  
  //std::ostream &operator<<(std::ostream &os, const MatCell &m)
  //{
  //    return os << (cv::Mat) m;
  //}
  
  #endif // MATCELL_H