Subversion Repositories seema-scanner

Rev

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

Rev 207 Rev 236
Line 1... Line 1...
1
#ifndef ALGORITHMTOOLS_H
1
#ifndef ALGORITHMTOOLS_H
2
#define ALGORITHMTOOLS_H
2
#define ALGORITHMTOOLS_H
3
 
3
 
4
#include <opencv2/opencv.hpp>
4
#include <opencv2/opencv.hpp>
-
 
5
#include <opencv2/core/ocl.hpp>
-
 
6
#include <QTime>
5
 
7
 
6
// Convert an unsigned binary number to reflected binary Gray code.
8
// Convert an unsigned binary number to reflected binary Gray code.
7
// Source: http://en.wikipedia.org/wiki/Gray_code
9
// Source: http://en.wikipedia.org/wiki/Gray_code
8
inline unsigned int binaryToGray(unsigned int num) {
10
inline unsigned int binaryToGray(unsigned int num) {
9
    return (num >> 1) ^ num;
11
    return (num >> 1) ^ num;
Line 144... Line 146...
144
    cv::merge(frames, I);
146
    cv::merge(frames, I);
145
    unsigned int w = I.cols;
147
    unsigned int w = I.cols;
146
    unsigned int h = I.rows;
148
    unsigned int h = I.rows;
147
    I = I.reshape(1, h*w);
149
    I = I.reshape(1, h*w);
148
    I.convertTo(I, CV_32F);
150
    I.convertTo(I, CV_32F);
-
 
151
 
-
 
152
    QTime time;
-
 
153
    time.start();
-
 
154
 
149
    cv::Mat fI;
155
    cv::Mat fI;
150
    cv::dft(I, fI, cv::DFT_ROWS + cv::DFT_COMPLEX_OUTPUT);
156
    cv::dft(I, fI, cv::DFT_ROWS + cv::DFT_COMPLEX_OUTPUT);
-
 
157
 
-
 
158
    std::cout << "elapsed: " << time.restart() << std::endl;
-
 
159
 
151
    fI = fI.reshape(N*2, h);
160
    fI = fI.reshape(N*2, h);
152
 
161
 
153
    std::vector<cv::Mat> fIcomp;
162
    std::vector<cv::Mat> fIcomp;
154
    cv::split(fI, fIcomp);
163
    cv::split(fI, fIcomp);
155
 
164