Subversion Repositories seema-scanner

Rev

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

Rev 43 Rev 44
Line 176... Line 176...
176
    }
176
    }
177
 
177
 
178
    // color remaps
178
    // color remaps
179
    cv::Mat color0Rect, color1Rect;
179
    cv::Mat color0Rect, color1Rect;
180
    cv::remap(frames0[0], color0Rect, map0X, map0Y, CV_INTER_CUBIC);
180
    cv::remap(frames0[0], color0Rect, map0X, map0Y, CV_INTER_CUBIC);
181
    cv::remap(frames1[0], color1Rect, map0X, map0Y, CV_INTER_CUBIC);
181
    cv::remap(frames1[0], color1Rect, map1X, map1Y, CV_INTER_CUBIC);
182
 
182
 
183
    int frameRectRows = frames0Rect[0].rows;
183
    int frameRectRows = frames0Rect[0].rows;
184
    int frameRectCols = frames0Rect[0].cols;
184
    int frameRectCols = frames0Rect[0].cols;
185
 
185
 
186
    // occlusion maps
186
    // occlusion maps
Line 251... Line 251...
251
    for(int i=0; i<nMatches; i++){
251
    for(int i=0; i<nMatches; i++){
252
 
252
 
253
        cv::Vec3b c0 = color0Rect.at<cv::Vec3b>(q0Rect[i][1], q0Rect[i][0]);
253
        cv::Vec3b c0 = color0Rect.at<cv::Vec3b>(q0Rect[i][1], q0Rect[i][0]);
254
        cv::Vec3b c1 = color1Rect.at<cv::Vec3b>(q1Rect[i][1], q1Rect[i][0]);
254
        cv::Vec3b c1 = color1Rect.at<cv::Vec3b>(q1Rect[i][1], q1Rect[i][0]);
255
 
255
 
256
        color[i] = 0.5*(c0 + c1);
256
        color[i] = 0.5*c0 + 0.5*c1;
257
    }
257
    }
258
 
258
 
259
    // triangulate points
259
    // triangulate points
260
    cv::Mat QMatHomogenous, QMat;
260
    cv::Mat QMatHomogenous, QMat;
-
 
261
//    cv::Mat C0 = P0.clone();
-
 
262
//    cv::Mat C1 = P1.clone();
-
 
263
//    C0.colRange(0, 3) = C0.colRange(0, 3)*R0;
-
 
264
//    C1.colRange(0, 3) = C1.colRange(0, 3)*R1.t();
261
    cv::triangulatePoints(P0, P1, q0Rect, q1Rect, QMatHomogenous);
265
    cv::triangulatePoints(P0, P1, q0Rect, q1Rect, QMatHomogenous);
262
    cvtools::convertMatFromHomogeneous(QMatHomogenous, QMat);
266
    cvtools::convertMatFromHomogeneous(QMatHomogenous, QMat);
-
 
267
 
-
 
268
    // undo rectification
-
 
269
    cv::Mat R0Inv;
-
 
270
    cv::Mat(R0.t()).convertTo(R0Inv, CV_32F);
-
 
271
    QMat = R0Inv*QMat;
-
 
272
 
263
    cvtools::matToPoints3f(QMat, Q);
273
    cvtools::matToPoints3f(QMat, Q);
-
 
274
 
264
}
275
}