Subversion Repositories seema-scanner

Rev

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

Rev 120 Rev 121
Line 237... Line 237...
237
        // interpolate horizontal coordinate
237
        // interpolate horizontal coordinate
238
        float row = matches[i].row;
238
        float row = matches[i].row;
239
        float col = matches[i].col;
239
        float col = matches[i].col;
240
        float colRight = col+1;
240
        float colRight = col+1;
241
 
241
 
242
        float posHorz = frames[2*levelHorz+2].at<unsigned short>(row, col);
242
        float posHorz = frames[2*levelHorz+2].at<unsigned char>(row, col);
243
        float negHorz = frames[2*levelHorz+3].at<unsigned short>(row, col);
243
        float negHorz = frames[2*levelHorz+3].at<unsigned char>(row, col);
244
        float posHorzRight = frames[2*levelHorz+2].at<unsigned short>(row, colRight);
244
        float posHorzRight = frames[2*levelHorz+2].at<unsigned char>(row, colRight);
245
        float negHorzRight = frames[2*levelHorz+3].at<unsigned short>(row, colRight);
245
        float negHorzRight = frames[2*levelHorz+3].at<unsigned char>(row, colRight);
246
 
246
 
247
        float x = col + (posHorz - negHorz)/(negHorzRight - negHorz - posHorzRight + posHorz);
247
        float x = col + (posHorz - negHorz)/(negHorzRight - negHorz - posHorzRight + posHorz);
248
 
248
 
249
        // interpolate vertical coordinate
249
        // interpolate vertical coordinate
250
        float rowBelow = row+1;
250
        float rowBelow = row+1;
251
 
251
 
252
        float posVert = frames[2*NbitsHorz+2*levelVert+2].at<unsigned short>(row, col);
252
        float posVert = frames[2*NbitsHorz+2*levelVert+2].at<unsigned char>(row, col);
253
        float negVert = frames[2*NbitsHorz+2*levelVert+3].at<unsigned short>(row, col);
253
        float negVert = frames[2*NbitsHorz+2*levelVert+3].at<unsigned char>(row, col);
254
        float posVertBelow = frames[2*NbitsHorz+2*levelVert+2].at<unsigned short>(rowBelow, col);
254
        float posVertBelow = frames[2*NbitsHorz+2*levelVert+2].at<unsigned char>(rowBelow, col);
255
        float negVertBelow = frames[2*NbitsHorz+2*levelVert+3].at<unsigned short>(rowBelow, col);
255
        float negVertBelow = frames[2*NbitsHorz+2*levelVert+3].at<unsigned char>(rowBelow, col);
256
 
256
 
257
        float y = row + (posVert - negVert)/(negVertBelow - negVert - posVertBelow + posVert);
257
        float y = row + (posVert - negVert)/(negVertBelow - negVert - posVertBelow + posVert);
258
 
258
 
259
        // write into return vector
259
        // write into return vector
260
        q[i] = cv::Point2f(x, y);
260
        q[i] = cv::Point2f(x, y);
Line 303... Line 303...
303
        cv::cvtColor(frames1[i], frames1Gray[i], CV_BayerBG2GRAY);
303
        cv::cvtColor(frames1[i], frames1Gray[i], CV_BayerBG2GRAY);
304
    }
304
    }
305
 
305
 
306
    // colors
306
    // colors
307
    cv::Mat color0;
307
    cv::Mat color0;
308
    frames0[0].convertTo(color0, CV_8UC3, 1.0/256.0);
308
//    frames0[0].convertTo(color0, CV_8UC3, 1.0/256.0);
309
    cv::cvtColor(color0, color0, CV_BayerBG2RGB);
309
    cv::cvtColor(frames0[0], color0, CV_BayerBG2RGB);
310
    cv::Mat color1;
310
    cv::Mat color1;
311
    frames1[0].convertTo(color1, CV_8UC3, 1.0/256.0);
311
//    frames1[0].convertTo(color1, CV_8UC3, 1.0/256.0);
312
    cv::cvtColor(color1, color1, CV_BayerBG2RGB);
312
    cv::cvtColor(frames1[0], color1, CV_BayerBG2RGB);
313
 
313
 
314
    // occlusion masks
314
    // occlusion masks
315
    cv::Mat occlusion0, occlusion1;
315
    cv::Mat occlusion0, occlusion1;
316
    cv::subtract(frames0[0], frames0[1], occlusion0);
316
    cv::subtract(frames0[0], frames0[1], occlusion0);
317
    occlusion0 = (occlusion0 > 6400) & (occlusion0 < 60000);
317
    occlusion0 = (occlusion0 > 20) & (occlusion0 < 250);
318
    cv::subtract(frames1[0], frames1[1], occlusion1);
318
    cv::subtract(frames1[0], frames1[1], occlusion1);
319
    occlusion1 = (occlusion1 > 6400) & (occlusion1 < 60000);
319
    occlusion1 = (occlusion1 > 20) & (occlusion1 < 250);
320
 
320
 
321
    // erode occlusion masks
321
    // erode occlusion masks
322
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3,3));
322
    cv::Mat strel = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(3,3));
323
    cv::erode(occlusion0, occlusion0, strel);
323
    cv::erode(occlusion0, occlusion0, strel);
324
    cv::erode(occlusion1, occlusion1, strel);
324
    cv::erode(occlusion1, occlusion1, strel);