-1

次のコードの実行中:

for(int i = 0; i < result.size(); ++i) {
   for(int j = 0; j < result[i].size(); ++j) {
     if(anchor_map->at<float>(i, j) > 0) {
     }
   }
}

result.size() のサイズが 1200 で、result[i].size() がボード上で 1600 の場合、anchor_map.size() が [1600 x 1200] であるため、i と j の範囲がロックされます。

問題は、i = 1197、j = 1436 で毎回アクセス違反が発生し、アンカーが配置されている右側のピクセルで anchor_map が最初にゼロに設定されていることです。

Windows 7 64ビットのVisual Studio 12で作成されています

4

1 に答える 1

1

これを試して:

using namespace cv;
void main (void)
{
    Mat anchor_map(1200,1600,CV_8UC1);

    for(int i = 0; i < anchor_map.rows; ++i) {
        for(int j = 0; j < anchor_map.cols; ++j) {
            if(anchor_map.at<unsigned char>(i, j) > 0) {
            }
        }
    }
    getchar();
}
于 2013-08-10T17:13:19.677 に答える