Subversion Repositories seema-scanner

Rev

Rev 98 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 98 Rev 99
Line 1... Line 1...
1
#include "AlgorithmGrayCodeHQ.h"
1
#include "AlgorithmGrayCodeHorzVert.h"
2
#include <cmath>
2
#include <cmath>
3
#include <assert.h>
3
#include <assert.h>
4
#include "cvtools.h"
4
#include "cvtools.h"
5
 
5
 
6
#ifndef log2f
6
#ifndef log2f
Line 92... Line 92...
92
 
92
 
93
    return 1 << exponent;
93
    return 1 << exponent;
94
}
94
}
95
 
95
 
96
// Algorithm
96
// Algorithm
97
AlgorithmGrayCodeHQ::AlgorithmGrayCodeHQ(unsigned int _screenCols, unsigned int _screenRows) : Algorithm(_screenCols, _screenRows){
97
AlgorithmGrayCodeHorzVert::AlgorithmGrayCodeHorzVert(unsigned int _screenCols, unsigned int _screenRows) : Algorithm(_screenCols, _screenRows){
98
 
98
 
99
    NbitsHorz = ceilf(log2f((float)screenCols));
99
    NbitsHorz = ceilf(log2f((float)screenCols));
100
    NbitsVert =  ceilf(log2f((float)screenRows));
100
    NbitsVert =  ceilf(log2f((float)screenRows));
101
    N = 2 + (NbitsHorz+NbitsVert)*2;
101
    N = 2 + (NbitsHorz+NbitsVert)*2;
102
 
102
 
Line 145... Line 145...
145
        patterns.push_back(patternInv);
145
        patterns.push_back(patternInv);
146
    }
146
    }
147
 
147
 
148
}
148
}
149
 
149
 
150
cv::Mat AlgorithmGrayCodeHQ::getEncodingPattern(unsigned int depth){
150
cv::Mat AlgorithmGrayCodeHorzVert::getEncodingPattern(unsigned int depth){
151
    return patterns[depth];
151
    return patterns[depth];
152
}
152
}
153
 
153
 
154
 
154
 
155
static bool sortingLarger(cv::Vec3d i,cv::Vec3d j){ return (i[2]<j[2]);}
155
static bool sortingLarger(cv::Vec3d i,cv::Vec3d j){ return (i[2]<j[2]);}
Line 221... Line 221...
221
                           + (img.at<cv::Vec3b>(y1, x0)[2] * (1.f - a) + img.at<cv::Vec3b>(y1, x1)[2] * a) * c);
221
                           + (img.at<cv::Vec3b>(y1, x0)[2] * (1.f - a) + img.at<cv::Vec3b>(y1, x1)[2] * a) * c);
222
 
222
 
223
    return cv::Vec3b(b, g, r);
223
    return cv::Vec3b(b, g, r);
224
}
224
}
225
 
225
 
226
void AlgorithmGrayCodeHQ::get3DPoints(SMCalibrationParameters calibration, const std::vector<cv::Mat>& frames0, const std::vector<cv::Mat>& frames1, std::vector<cv::Point3f>& Q, std::vector<cv::Vec3b>& color){
226
void AlgorithmGrayCodeHorzVert::get3DPoints(SMCalibrationParameters calibration, const std::vector<cv::Mat>& frames0, const std::vector<cv::Mat>& frames1, std::vector<cv::Point3f>& Q, std::vector<cv::Vec3b>& color){
227
 
227
 
228
    assert(frames0.size() == N);
228
    assert(frames0.size() == N);
229
    assert(frames1.size() == N);
229
    assert(frames1.size() == N);
230
 
230
 
231
    int frameRows = frames0[0].rows;
231
    int frameRows = frames0[0].rows;