Subversion Repositories seema-scanner

Rev

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

Rev 4 Rev 27
Line 65... Line 65...
65
 
65
 
66
// Encoder
66
// Encoder
67
EncoderGrayCode::EncoderGrayCode(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir) : Encoder(_screenCols, _screenRows, _dir){
67
EncoderGrayCode::EncoderGrayCode(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir) : Encoder(_screenCols, _screenRows, _dir){
68
 
68
 
69
    // Number of horizontal encoding patterns
69
    // Number of horizontal encoding patterns
70
    // Encode every pixel column
70
    Nhorz = 10;
71
    Nhorz = ceilf(log2f((float)screenCols));
-
 
72
 
71
 
73
    // Number of vertical encoding patterns
72
    // Number of vertical encoding patterns
74
    Nvert = ceilf(log2f((float)screenRows));
73
    Nvert = 8;
75
 
74
 
76
    // Set total pattern number
75
    // Set total pattern number
77
    if(dir & CodecDirHorizontal)
76
    if(dir & CodecDirHorizontal)
78
        this->N += Nhorz;
77
        this->N += Nhorz;
79
 
78
 
Line 116... Line 115...
116
cv::Mat EncoderGrayCode::getEncodingPattern(unsigned int depth){
115
cv::Mat EncoderGrayCode::getEncodingPattern(unsigned int depth){
117
    return patterns[depth];
116
    return patterns[depth];
118
}
117
}
119
 
118
 
120
// Decoder
119
// Decoder
121
DecoderGrayCode::DecoderGrayCode(unsigned int _screenCols, unsigned int _screenRows, CodecDir _dir) : Decoder(_screenCols, _screenRows, _dir){
120
DecoderGrayCode::DecoderGrayCode(CodecDir _dir) : Decoder(_dir){
122
 
121
 
123
    // Number of horizontal encoding patterns
122
    // Number of horizontal encoding patterns
124
    Nhorz = ceilf(log2f((float)screenCols));
123
    Nhorz = 10;
125
 
124
 
126
    // Number of vertical encoding patterns
125
    // Number of vertical encoding patterns
127
    Nvert = ceilf(log2f((float)screenRows));
126
    Nvert = 8;
128
 
127
 
129
    if(dir & CodecDirHorizontal)
-
 
130
        this->N += Nhorz;
-
 
131
 
-
 
132
    if(dir & CodecDirVertical)
-
 
133
        this->N += Nvert;
-
 
134
 
-
 
135
    frames.resize(N);
-
 
136
 
-
 
137
}
-
 
138
 
-
 
139
void DecoderGrayCode::setFrame(unsigned int depth, const cv::Mat frame){
-
 
140
    frames[depth] = frame;
-
 
141
}
128
}
142
 
129
 
143
void DecoderGrayCode::decodeFrames(cv::Mat &up, cv::Mat &vp, cv::Mat &mask, cv::Mat &shading){
130
void DecoderGrayCode::decodeFrames(const std::vector<cv::Mat> frames, cv::Mat &up, cv::Mat &vp, cv::Mat &mask, cv::Mat &shading){
144
 
131
 
145
    // Get shading (max) image
132
    // Get shading (max) image
146
    shading = cv::Scalar(0);
133
    shading = cv::Scalar(0);
147
    for(unsigned int f=0; f<frames.size(); f++){
134
    for(unsigned int f=0; f<frames.size(); f++){
148
        shading = cv::max(shading, frames[f]);
135
        shading = cv::max(shading, frames[f]);