Subversion Repositories seema-scanner

Rev

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

Rev 113 Rev 114
Line 226... Line 226...
226
    std::vector<cv::Mat> frames0Rect(N);
226
    std::vector<cv::Mat> frames0Rect(N);
227
    std::vector<cv::Mat> frames1Rect(N);
227
    std::vector<cv::Mat> frames1Rect(N);
228
    for(int i=0; i<N; i++){
228
    for(int i=0; i<N; i++){
229
        cv::Mat temp;
229
        cv::Mat temp;
230
        cv::cvtColor(frames0[i], temp, CV_BayerBG2GRAY);
230
        cv::cvtColor(frames0[i], temp, CV_BayerBG2GRAY);
231
        cv::remap(temp, frames0Rect[i], map0X, map0Y, CV_INTER_CUBIC);
231
        cv::remap(temp, frames0Rect[i], map0X, map0Y, CV_INTER_LINEAR);
232
        cv::cvtColor(frames1[i], temp, CV_BayerBG2GRAY);
232
        cv::cvtColor(frames1[i], temp, CV_BayerBG2GRAY);
233
        cv::remap(temp, frames1Rect[i], map1X, map1Y, CV_INTER_CUBIC);
233
        cv::remap(temp, frames1Rect[i], map1X, map1Y, CV_INTER_LINEAR);
234
    }
234
    }
235
 
235
 
236
//    cvtools::writeMat(frames0Rect[0], "frames0Rect_0.mat", "frames0Rect_0");
236
//    cvtools::writeMat(frames0Rect[0], "frames0Rect_0.mat", "frames0Rect_0");
237
//    cvtools::writeMat(frames0Rect[1], "frames0Rect_1.mat", "frames0Rect_1");
237
//    cvtools::writeMat(frames0Rect[1], "frames0Rect_1.mat", "frames0Rect_1");
238
 
238
 
Line 247... Line 247...
247
 
247
 
248
    // color debayer and remap
248
    // color debayer and remap
249
    cv::Mat temp;
249
    cv::Mat temp;
250
    cv::Mat color0Rect, color1Rect;
250
    cv::Mat color0Rect, color1Rect;
251
    cv::cvtColor(frames0[0], temp, CV_BayerBG2RGB);
251
    cv::cvtColor(frames0[0], temp, CV_BayerBG2RGB);
252
    cv::remap(temp, color0Rect, map0X, map0Y, CV_INTER_CUBIC);
252
    cv::remap(temp, color0Rect, map0X, map0Y, CV_INTER_LINEAR);
253
    cv::cvtColor(frames1[0], temp, CV_BayerBG2RGB);
253
    cv::cvtColor(frames1[0], temp, CV_BayerBG2RGB);
254
    cv::remap(temp, color1Rect, map1X, map1Y, CV_INTER_CUBIC);
254
    cv::remap(temp, color1Rect, map1X, map1Y, CV_INTER_LINEAR);
255
 
255
 
256
    int frameRectRows = frames0Rect[0].rows;
256
    int frameRectRows = frames0Rect[0].rows;
257
    int frameRectCols = frames0Rect[0].cols;
257
    int frameRectCols = frames0Rect[0].cols;
258
 
258
 
259
    // occlusion masks
259
    // occlusion masks
260
    cv::Mat occlusion0Rect, occlusion1Rect;
260
    cv::Mat occlusion0Rect, occlusion1Rect;
261
    cv::subtract(frames0Rect[0], frames0Rect[1], occlusion0Rect);
261
    cv::subtract(frames0Rect[0], frames0Rect[1], occlusion0Rect);
262
    occlusion0Rect = occlusion0Rect > 25;
262
    occlusion0Rect = (occlusion0Rect > 25) & (occlusion0Rect < 250);
263
    cv::subtract(frames1Rect[0], frames1Rect[1], occlusion1Rect);
263
    cv::subtract(frames1Rect[0], frames1Rect[1], occlusion1Rect);
264
    occlusion1Rect = occlusion1Rect > 25;
264
    occlusion1Rect = (occlusion1Rect > 25) & (occlusion1Rect < 250);
265
 
265
 
266
    // erode occlusion masks
266
    // erode occlusion masks
267
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3,3));
267
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(2,2));
268
    cv::erode(occlusion0Rect, occlusion0Rect, strel);
268
    cv::erode(occlusion0Rect, occlusion0Rect, strel);
269
    cv::erode(occlusion1Rect, occlusion1Rect, strel);
269
    cv::erode(occlusion1Rect, occlusion1Rect, strel);
270
 
270
 
271
//cvtools::writeMat(occlusion0Rect, "occlusion0Rect.mat", "occlusion0Rect");
271
//cvtools::writeMat(occlusion0Rect, "occlusion0Rect.mat", "occlusion0Rect");
272
//cvtools::writeMat(occlusion1Rect, "occlusion1Rect.mat", "occlusion1Rect");
272
//cvtools::writeMat(occlusion1Rect, "occlusion1Rect.mat", "occlusion1Rect");