Subversion Repositories seema-scanner

Rev

Rev 27 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27 Rev 36
Line 3... Line 3...
3
 
3
 
4
#include <vector>
4
#include <vector>
5
#include <opencv2/opencv.hpp>
5
#include <opencv2/opencv.hpp>
6
#include "SMTypes.h"
6
#include "SMTypes.h"
7
 
7
 
8
enum CodecDir {CodecDirNone = 0,
8
enum CodingDir {CodingDirNone = 0,
9
               CodecDirHorizontal = 1 << 0,
9
               CodingDirHorizontal = 1 << 0,
10
               CodecDirVertical = 1 << 1,
10
               CodingDirVertical = 1 << 1,
11
               CodecDirBoth = CodecDirHorizontal | CodecDirVertical};
11
               CodingDirBoth = CodingDirHorizontal | CodingDirVertical};
12
 
12
 
13
// Base class for all encoders
13
// Base class for all Algorithms
14
class Encoder {
14
class Algorithm {
15
    public:
15
    public:
16
        Encoder(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir = CodecDirHorizontal) : N(0),screenCols(_screenCols), screenRows(_screenRows),  dir(_dir){}
16
        Algorithm(unsigned int _screenCols, unsigned int _screenRows, CodingDir _dir = CodingDirHorizontal) : N(0),screenCols(_screenCols), screenRows(_screenRows),  dir(_dir){}
17
        unsigned int getNPatterns(){return N;}
17
        unsigned int getNPatterns(){return N;}
18
        CodecDir getDir(){return dir;}
18
        CodingDir getDir(){return dir;}
19
        // Encoding
19
        // Encoding
20
        virtual cv::Mat getEncodingPattern(unsigned int depth) = 0;
20
        virtual cv::Mat getEncodingPattern(unsigned int depth) = 0;
21
        virtual ~Encoder(){}
21
        virtual ~Algorithm(){}
22
    protected:
22
    protected:
23
        unsigned int N;
23
        unsigned int N;
24
        unsigned int screenCols, screenRows;
24
        unsigned int screenCols, screenRows;
25
        CodecDir dir;
25
        CodingDir dir;
26
};
26
};
27
 
27
 
28
class Decoder {
28
class Algorithm {
29
    public:
29
    public:
30
        Decoder(CodecDir _dir = CodecDirHorizontal) : dir(_dir){}
30
        Algorithm(CodingDir _dir, int _screenCols, int _screenRows) : dir(_dir), screenCols(_screenCols), screenRows(_screenRows){}
31
        CodecDir getDir(){return dir;}
31
        CodingDir getDir(){return dir;}
-
 
32
        int getscreenCols(){return screenCols;}
-
 
33
        int getscreenRows(){return screenRows;}
32
        // Decoding
34
        // Decoding
33
        virtual void decodeFrames(const std::vector<cv::Mat> frames, cv::Mat &up, cv::Mat &vp, cv::Mat &mask, cv::Mat &shading) = 0;
35
        virtual void getCorrespondences(const std::vector<cv::Mat>& frames0, const std::vector<cv::Mat>& frames1, std::vector<cv::Point2f>& q0, std::vector<cv::Point2f>& q1, std::vector<cv::Point3f>& color) = 0;
34
        virtual ~Decoder(){}
36
        virtual ~Algorithm(){}
35
    protected:
37
    protected:
36
        CodecDir dir;
38
        CodingDir dir;
-
 
39
        int screenCols, screenRows;
37
};
40
};
38
 
41
 
39
#endif // CODEC_H
42
#endif // CODEC_H