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的大小为480x640
有三个步骤:
程序总是以不同的状态失败,例如当i == 1900566
时是否有人知道如何在OpenCV中连续处理大数据而不出错?
答案 0 :(得分:0)
您有图像480(行)x 640(cols),但您正尝试从Mat.at<uchar>(colNumber, rowNumber)
获取Mat值。在某些时候,Mat::at()
会抛出错误,因为您将尝试获取超出Mat
范围的值。