Subversion Repositories seema-scanner

Rev

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

Rev 244 Rev 247
Line 211... Line 211...
211
void AlgorithmPhaseShiftTwoFreq::
211
void AlgorithmPhaseShiftTwoFreq::
212
    get3DPoints(const SMCalibrationParameters & calibration,
212
    get3DPoints(const SMCalibrationParameters & calibration,
213
                const std::vector<cv::Mat>& frames0,
213
                const std::vector<cv::Mat>& frames0,
214
                const std::vector<cv::Mat>& frames1,
214
                const std::vector<cv::Mat>& frames1,
215
                std::vector<cv::Point3f>& Q,
215
                std::vector<cv::Point3f>& Q,
216
                std::vector<cv::Vec3b>& color){
216
                std::vector<cv::Vec3f>& color){
217
 
217
 
218
    assert(frames0.size() == N);
218
    assert(frames0.size() == N);
219
    assert(frames1.size() == N);
219
    assert(frames1.size() == N);
220
 
220
 
221
    StereoRectifyier stereoRect;
221
    StereoRectifyier stereoRect;
Line 248... Line 248...
248
                          stereoRect.map0X, stereoRect.map0Y,
248
                          stereoRect.map0X, stereoRect.map0Y,
249
                          CV_INTER_LINEAR);
249
                          CV_INTER_LINEAR);
250
            }
250
            }
251
 
251
 
252
            // If images are HDR (float), we need to convert to uchar
252
            // If images are HDR (float), we need to convert to uchar
253
            frames0Rect[0].convertTo(color0, CV_8UC3);
253
            frames0Rect[0].convertTo(color0, CV_32FC3);
254
 
254
 
255
            // Occlusion masks
255
            // Occlusion masks
256
            cv::subtract(frames0Rect[0], frames0Rect[1], occlusion0);
256
            cv::subtract(frames0Rect[0], frames0Rect[1], occlusion0);
257
            occlusion0 = (occlusion0 > 25) & (occlusion0 < 250);
257
            occlusion0 = (occlusion0 > 25) & (occlusion0 < 250);
258
 
258
 
Line 326... Line 326...
326
                          stereoRect.map1X, stereoRect.map1Y,
326
                          stereoRect.map1X, stereoRect.map1Y,
327
                          CV_INTER_LINEAR);
327
                          CV_INTER_LINEAR);
328
            }
328
            }
329
 
329
 
330
            // If images are HDR (float), we need to convert to uchar
330
            // If images are HDR (float), we need to convert to uchar
331
            frames1Rect[0].convertTo(color1, CV_8UC3);
331
            frames1Rect[0].convertTo(color1, CV_32FC3);
332
 
332
 
333
            // Occlusion masks
333
            // Occlusion masks
334
            cv::subtract(frames1Rect[0], frames1Rect[1], occlusion1);
334
            cv::subtract(frames1Rect[0], frames1Rect[1], occlusion1);
335
            occlusion1 = (occlusion1 > 25) & (occlusion1 < 250);
335
            occlusion1 = (occlusion1 > 25) & (occlusion1 < 250);
336
 
336
 
Line 409... Line 409...
409
    else {
409
    else {
410
        // Retrieve color information
410
        // Retrieve color information
411
        color.resize(nMatches);
411
        color.resize(nMatches);
412
        for(unsigned int i=0; i<nMatches; i++){
412
        for(unsigned int i=0; i<nMatches; i++){
413
 
413
 
414
            cv::Vec3b c0 = color0.at<cv::Vec3b>(int(q0[i][1]), int(q0[i][0]));
414
            cv::Vec3f c0 = color0.at<cv::Vec3f>(int(q0[i][1]), int(q0[i][0]));
415
            cv::Vec3b c1 = color1.at<cv::Vec3b>(int(q1[i][1]), int(q1[i][0]));
415
            cv::Vec3f c1 = color1.at<cv::Vec3f>(int(q1[i][1]), int(q1[i][0]));
416
 
416
 
417
            color[i] = 0.5*c0 + 0.5*c1;
417
            color[i] = 0.5*c0 + 0.5*c1;
418
        }
418
        }
419
    }
419
    }
420
 
420