Subversion Repositories seema-scanner

Rev

Rev 97 | Rev 100 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 97 Rev 99
Line 1... Line 1...
1
#include "SMReconstructionWorker.h"
1
#include "SMReconstructionWorker.h"
2
 
2
 
3
#include "AlgorithmGrayCode.h"
3
#include "AlgorithmGrayCode.h"
4
#include "AlgorithmGrayCodeHQ.h"
4
#include "AlgorithmGrayCodeHorzVert.h"
5
#include "AlgorithmPhaseShift.h"
5
#include "AlgorithmPhaseShift.h"
6
 
6
 
7
#include <QCoreApplication>
7
#include <QCoreApplication>
8
#include <QSettings>
8
#include <QSettings>
9
 
9
 
Line 29... Line 29...
29
    int resY = settings.value("projector/resY").toInt();
29
    int resY = settings.value("projector/resY").toInt();
30
    QString codec = settings.value("algorithm", "GrayCode").toString();
30
    QString codec = settings.value("algorithm", "GrayCode").toString();
31
    if(codec == "GrayCode")
31
    if(codec == "GrayCode")
32
        algorithm = new AlgorithmGrayCode(resX, resY);
32
        algorithm = new AlgorithmGrayCode(resX, resY);
33
    else if(codec == "GrayCodeHQ")
33
    else if(codec == "GrayCodeHQ")
34
        algorithm = new AlgorithmGrayCodeHQ(resX, resY);
34
        algorithm = new AlgorithmGrayCodeHorzVert(resX, resY);
35
    else if(codec == "PhaseShift")
35
    else if(codec == "PhaseShift")
36
        algorithm = new AlgorithmPhaseShift(resX, resY);
36
        algorithm = new AlgorithmPhaseShift(resX, resY);
37
    else
37
    else
38
        std::cerr << "SLScanWorker: invalid codec " << codec.toStdString() << std::endl;
38
        std::cerr << "SLScanWorker: invalid codec " << codec.toStdString() << std::endl;
39
 
39
 
Line 52... Line 52...
52
 
52
 
53
void SMReconstructionWorker::reconstructPointCloud(SMFrameSequence frameSequence){
53
void SMReconstructionWorker::reconstructPointCloud(SMFrameSequence frameSequence){
54
 
54
 
55
    time.start();
55
    time.start();
56
 
56
 
-
 
57
    // Decompress frames
-
 
58
    int nFrames = frameSequence.compressedFrames0.size();
-
 
59
    std::vector<cv::Mat> frames0(nFrames), frames1(nFrames);
-
 
60
    for(int i=0; i<nFrames; i++){
-
 
61
        cv::imdecode(frameSequence.compressedFrames0[i], frames0[i]);
-
 
62
        cv::imdecode(frameSequence.compressedFrames1[i], frames1[i]);
-
 
63
    }
-
 
64
 
57
    // Get 3D Points
65
    // Get 3D Points
58
    std::vector<cv::Point3f> Q;
66
    std::vector<cv::Point3f> Q;
59
    std::vector<cv::Vec3b> color;
67
    std::vector<cv::Vec3b> color;
60
    algorithm->get3DPoints(calibration, frameSequence.frames0, frameSequence.frames1, Q, color);
68
    algorithm->get3DPoints(calibration, frames0, frames1, Q, color);
61
 
69
 
62
    // Convert point cloud to PCL format
70
    // Convert point cloud to PCL format
63
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointCloudPCL(new pcl::PointCloud<pcl::PointXYZRGB>);
71
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr pointCloudPCL(new pcl::PointCloud<pcl::PointXYZRGB>);
64
 
72
 
65
    pointCloudPCL->width = Q.size();
73
    pointCloudPCL->width = Q.size();