Subversion Repositories seema-scanner

Rev

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

Rev 72 Rev 73
Line 5... Line 5...
5
 
5
 
6
#ifndef M_PI
6
#ifndef M_PI
7
    #define M_PI 3.14159265358979323846
7
    #define M_PI 3.14159265358979323846
8
#endif
8
#endif
9
 
9
 
10
static unsigned int nPhases = 40;
10
static unsigned int nPhases = 50;
11
static unsigned int nSteps = 20;
11
static unsigned int nSteps = 10;
12
 
12
 
13
// Algorithm
13
// Algorithm
14
static cv::Mat computePhaseVector(unsigned int length, float phase, float pitch){
14
static cv::Mat computePhaseVector(unsigned int length, float phase, float pitch){
15
 
15
 
16
    cv::Mat phaseVector(length, 1, CV_8UC3);
16
    cv::Mat phaseVector(length, 1, CV_8UC3);
Line 223... Line 223...
223
    cv::subtract(frames0OnRect, frames0OffRect, occlusion0Rect);
223
    cv::subtract(frames0OnRect, frames0OffRect, occlusion0Rect);
224
    occlusion0Rect = occlusion0Rect > 50;
224
    occlusion0Rect = occlusion0Rect > 50;
225
    cv::subtract(frames1OnRect, frames1OffRect, occlusion1Rect);
225
    cv::subtract(frames1OnRect, frames1OffRect, occlusion1Rect);
226
    occlusion1Rect = occlusion1Rect > 50;
226
    occlusion1Rect = occlusion1Rect > 50;
227
 
227
 
228
cvtools::writeMat(occlusion0Rect, "occlusion0Rect.mat", "occlusion0Rect");
-
 
229
cvtools::writeMat(occlusion1Rect, "occlusion1Rect.mat", "occlusion1Rect");
-
 
230
 
-
 
231
    // Erode occlusion masks
228
    // Erode occlusion masks
232
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3,3));
229
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3,3));
233
    cv::erode(occlusion0Rect, occlusion0Rect, strel);
230
    cv::erode(occlusion0Rect, occlusion0Rect, strel);
234
    cv::erode(occlusion1Rect, occlusion1Rect, strel);
231
    cv::erode(occlusion1Rect, occlusion1Rect, strel);
235
 
232
 
236
    // Threshold on gradient of phase
233
    // Threshold on gradient of phase
237
    cv::Mat edges0;
234
    cv::Mat edges0;
238
    cv::Sobel(up0Rect, edges0, -1, 1, 1, 5);
235
    cv::Sobel(up0Rect, edges0, -1, 1, 0, 5);
239
    occlusion0Rect = occlusion0Rect & (abs(edges0) < 5);
236
    occlusion0Rect = occlusion0Rect & (abs(edges0) < 150);
240
 
237
 
241
    cv::Mat edges1;
238
    cv::Mat edges1;
242
    cv::Sobel(up1Rect, edges1, -1, 1, 1, 5);
239
    cv::Sobel(up1Rect, edges1, -1, 1, 0, 5);
243
    occlusion1Rect = occlusion1Rect & (abs(edges1) < 5);
240
    occlusion1Rect = occlusion1Rect & (abs(edges1) < 150);
244
 
241
 
245
cvtools::writeMat(edges0, "edges0.mat", "edges0");
242
cvtools::writeMat(edges0, "edges0.mat", "edges0");
246
cvtools::writeMat(edges1, "edges1.mat", "edges1");
243
cvtools::writeMat(edges1, "edges1.mat", "edges1");
247
 
244
 
-
 
245
cvtools::writeMat(occlusion0Rect, "occlusion0Rect.mat", "occlusion0Rect");
-
 
246
cvtools::writeMat(occlusion1Rect, "occlusion1Rect.mat", "occlusion1Rect");
-
 
247
 
248
    // Match phase maps
248
    // Match phase maps
249
    int frameRectRows = map0X.rows;
249
    int frameRectRows = map0X.rows;
250
    int frameRectCols = map0X.cols;
250
    int frameRectCols = map0X.cols;
251
 
251
 
252
    // camera0 against camera1
252
    // camera0 against camera1