プログラムのエラーが出る箇所を以下に抜き出しました。
なお、このプログラムは HOG特徴量の計算に掲載されているものです。
// ある矩形領域の勾配ヒストグラムを求める // ここでいう矩形はHOG特徴量のセルに該当 void calculateHOGInCell(Mat& hogCell, Rect roi, const vector<Mat>& integrals) { int x0 = roi.x, y0 = roi.y; int x1 = x0 + roi.width, y1 = y0 + roi.height; for (int i = 0; i < N_BIN; i++) { Mat integral = integrals[i]; float a = integral.at<double>(y0, x0); float b = integral.at<double>(y1, x1); float c = integral.at<double>(y0, x1); float d = integral.at<double>(y1, x0); hogCell.at<float>(0, i) = (a + b) - (c + d); } } // セルの大きさ(ピクセル数) #define CELL_SIZE 20 // ブロックの大きさ(セル数)奇数 #define BLOCK_SIZE 3 // ブロックの大きさの半分(ピクセル数) #define R (CELL_SIZE*(BLOCK_SIZE)*0.5) // HOG特徴量を計算する // pt: ブロックの中心点 Mat getHOG(Point pt, const vector<Mat>& integrals) { // ブロックが画像からはみ出していないか確認 if (pt.x - R < 0 || pt.y - R < 0 || pt.x + R >= integrals[0].cols || pt.y + R >= integrals[0].rows ) { return Mat(); } // 与点を中心としたブロックで、 // セルごとに勾配ヒストグラムを求めて連結 Mat hist(Size(N_BIN*BLOCK_SIZE*BLOCK_SIZE, 1), CV_32F); Point tl(0, pt.y - R); int c = 0; for (int i = 0; i < BLOCK_SIZE; i++) { tl.x = pt.x - R; for (int j = 0; j < BLOCK_SIZE; j++) { calculateHOGInCell(hist.colRange(c, c+N_BIN), Rect(tl, tl+Point(CELL_SIZE, CELL_SIZE)), integrals); tl.x += CELL_SIZE; c += N_BIN; } tl.y += CELL_SIZE; } // L2ノルムで正規化 normalize(hist, hist, 1, 0, NORM_L2); return hist; }
で以下のようなエラーが出ます。
HOGTest.cpp:114:13: error: no matching function for call to 'calculateHOGInCell' calculateHOGInCell(hist.colRange(c, c+N_BIN), ^~~~~~~~~~~~~~~~~~ HOGTest.cpp:71:6: note: candidate function not viable: expects an l-value for 1st argument void calculateHOGInCell(Mat& hogCell, Rect roi, const vector<Mat>& integrals) { ^ 1 error generated.

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/07 04:41 編集
2017/02/07 04:48
2017/02/07 04:55