嘿,夥計們!我試圖在OpenCV中連續處理大數據。這裏是我的代碼:如何在OpenCV中連續處理大數據
vector<Point2f> up_imagePoints;
vector<Point2f> left_imagePoints;
vector<Point2f> right_imagePoints;
Mat frame1_silhouette;
Mat frame2_silhouette;
Mat frame3_silhouette;
Mat frame1_reconstruction;
Mat frame2_reconstruction;
Mat frame3_reconstruction;
for (int i = 0; i < 16777216; ++i){
//check point range
if (up_imagePoints[i].x >= col_bound || up_imagePoints[i].y >= row_bound) {
coor_test = 1;}
else if (left_imagePoints[i].x >= col_bound || left_imagePoints[i].y >= row_bound) {
coor_test = 1;}
else if (right_imagePoints[i].x >= col_bound || right_imagePoints[i].y >= row_bound) {
coor_test = 1;}
//check silhouette
if (coor_test == 0) {
if (frame1_silhouette.at<uchar>((cvFloor(up_imagePoints[i].x)),(cvFloor(up_imagePoints[i].y))) == 255)
value_test = 1;
else if (frame2_silhouette.at<uchar>((cvFloor(left_imagePoints[i].x)),(cvFloor(left_imagePoints[i].y))) == 255)
value_test = 1;
else if (frame3_silhouette.at<uchar>((cvFloor(right_imagePoints[i].x)),(cvFloor(right_imagePoints[i].y))) == 255)
value_test = 1;
if (value_test == 0) {
frame1_reconstruction.at<uchar>((cvFloor(up_imagePoints[i].x)),(cvFloor(up_imagePoints[i].y))) = 255;
frame2_reconstruction.at<uchar>((cvFloor(left_imagePoints[i].x)),(cvFloor(left_imagePoints[i].y))) = 255;
frame3_reconstruction.at<uchar>((cvFloor(right_imagePoints[i].x)),(cvFloor(right_imagePoints[i].y))) = 255;}
}
value_test = 0;
coor_test = 0;
cout<<"round "<<i<<endl;
}
的up_iamgePoints,left_imagePoints的大小和right_imagePoints是1x16777216。它們包含圖像的座標。 framex_silhouette和framex_reconstruction的尺寸480×640
有三個步驟:
- 檢查x_imagePoints的座標是否在該範圍內:col_bound(640)和row_bound(480)
- 檢查是否相同的位置framex_silhouette的都是255
- 應用255從步驟2中的位置,以framex_reconstruction
該程序總是在故障不同的狀態,就像當我==什麼時候知道如何在OpenCV中連續處理大數據而沒有錯誤?
'z'索引用於什麼?爲什麼你永遠不會初始化'我'? – berak
@berak,我已經重新編寫了明確的解釋代碼。 'x','y','z'索引用於解釋一個大體素 – oilpig