Line 228... |
Line 228... |
228 |
std::vector<cv::Mat> frames0Rect(N);
|
228 |
std::vector<cv::Mat> frames0Rect(N);
|
229 |
std::vector<cv::Mat> frames1Rect(N);
|
229 |
std::vector<cv::Mat> frames1Rect(N);
|
230 |
for(int i=0; i<N; i++){
|
230 |
for(int i=0; i<N; i++){
|
231 |
cv::Mat temp;
|
231 |
cv::Mat temp;
|
232 |
cv::cvtColor(frames0[i], temp, CV_BayerBG2GRAY);
|
232 |
cv::cvtColor(frames0[i], temp, CV_BayerBG2GRAY);
|
233 |
cv::remap(temp, frames0Rect[i], map0X, map0Y, CV_INTER_LINEAR);
|
233 |
cv::remap(temp, frames0Rect[i], map0X, map0Y, CV_INTER_CUBIC);
|
234 |
cv::cvtColor(frames1[i], temp, CV_BayerBG2GRAY);
|
234 |
cv::cvtColor(frames1[i], temp, CV_BayerBG2GRAY);
|
235 |
cv::remap(temp, frames1Rect[i], map1X, map1Y, CV_INTER_LINEAR);
|
235 |
cv::remap(temp, frames1Rect[i], map1X, map1Y, CV_INTER_CUBIC);
|
236 |
}
|
236 |
}
|
237 |
|
237 |
|
238 |
//cvtools::writeMat(frames0Rect[0], "frames0Rect_0.mat", "frames0Rect_0");
|
238 |
//cvtools::writeMat(frames0Rect[0], "frames0Rect_0.mat", "frames0Rect_0");
|
239 |
//cvtools::writeMat(frames0Rect[1], "frames0Rect_1.mat", "frames0Rect_1");
|
239 |
//cvtools::writeMat(frames0Rect[1], "frames0Rect_1.mat", "frames0Rect_1");
|
240 |
//cvtools::writeMat(frames0Rect[20], "frames0Rect_20.mat", "frames0Rect_20");
|
240 |
//cvtools::writeMat(frames0Rect[20], "frames0Rect_20.mat", "frames0Rect_20");
|
241 |
//cvtools::writeMat(frames0Rect[21], "frames0Rect_21.mat", "frames0Rect_21");
|
241 |
//cvtools::writeMat(frames0Rect[21], "frames0Rect_21.mat", "frames0Rect_21");
|
242 |
|
242 |
|
243 |
// color debayer and remap
|
243 |
// color debayer and remap
|
244 |
cv::Mat color0Rect, color1Rect;
|
244 |
cv::Mat color0Rect, color1Rect;
|
245 |
cv::cvtColor(frames0[0], color0Rect, CV_BayerBG2RGB);
|
245 |
cv::cvtColor(frames0[0], color0Rect, CV_BayerBG2RGB);
|
246 |
cv::remap(color0Rect, color0Rect, map0X, map0Y, CV_INTER_LINEAR);
|
246 |
cv::remap(color0Rect, color0Rect, map0X, map0Y, CV_INTER_CUBIC);
|
247 |
|
247 |
|
248 |
cv::cvtColor(frames1[0], color1Rect, CV_BayerBG2RGB);
|
248 |
cv::cvtColor(frames1[0], color1Rect, CV_BayerBG2RGB);
|
249 |
cv::remap(color1Rect, color1Rect, map1X, map1Y, CV_INTER_LINEAR);
|
249 |
cv::remap(color1Rect, color1Rect, map1X, map1Y, CV_INTER_CUBIC);
|
250 |
|
250 |
|
251 |
int frameRectRows = frames0Rect[0].rows;
|
251 |
int frameRectRows = frames0Rect[0].rows;
|
252 |
int frameRectCols = frames0Rect[0].cols;
|
252 |
int frameRectCols = frames0Rect[0].cols;
|
253 |
|
253 |
|
254 |
// occlusion masks
|
254 |
// occlusion masks
|
Line 345... |
Line 345... |
345 |
|
345 |
|
346 |
// sorted, unique line centers
|
346 |
// sorted, unique line centers
|
347 |
getlineCenters(lines0.row(row), code0Binary.row(row), lineCenters0);
|
347 |
getlineCenters(lines0.row(row), code0Binary.row(row), lineCenters0);
|
348 |
getlineCenters(lines1.row(row), code1Binary.row(row), lineCenters1);
|
348 |
getlineCenters(lines1.row(row), code1Binary.row(row), lineCenters1);
|
349 |
|
349 |
|
350 |
if(s==0 && row==1300){
|
350 |
// if(s==0 && row==1300){
|
351 |
std::cout << cv::Mat(lineCenters0) << std::endl;
|
351 |
// std::cout << cv::Mat(lineCenters0) << std::endl;
|
352 |
std::cout << cv::Mat(lineCenters1) << std::endl;
|
352 |
// std::cout << cv::Mat(lineCenters1) << std::endl;
|
353 |
|
353 |
|
354 |
cvtools::writeMat(lines0.row(row), "lines0.mat", "lines0");
|
354 |
// cvtools::writeMat(lines0.row(row), "lines0.mat", "lines0");
|
355 |
cvtools::writeMat(lines1.row(row), "lines1.mat", "lines1");
|
355 |
// cvtools::writeMat(lines1.row(row), "lines1.mat", "lines1");
|
356 |
cvtools::writeMat(code0Binary.row(row), "code0Binary.mat", "code0Binary");
|
356 |
// cvtools::writeMat(code0Binary.row(row), "code0Binary.mat", "code0Binary");
|
357 |
cvtools::writeMat(code1Binary.row(row), "code1Binary.mat", "code1Binary");
|
357 |
// cvtools::writeMat(code1Binary.row(row), "code1Binary.mat", "code1Binary");
|
358 |
}
|
358 |
// }
|
359 |
|
359 |
|
360 |
// match and store
|
360 |
// match and store
|
361 |
int i=0, j=0;
|
361 |
int i=0, j=0;
|
362 |
while(i<lineCenters0.size() && j<lineCenters1.size()){
|
362 |
while(i<lineCenters0.size() && j<lineCenters1.size()){
|
363 |
|
363 |
|