【发布时间】:2016-01-22 11:29:33
【问题描述】:
我在学习opencv,mat结构。
但是,在源代码中,它使用了一个 mat 指针。 (图片)
但是,它发生了错误。 因为, Mat *costVol 没有初始化。 不知道怎么初始化costVol,变量。
代码:
Mat lGray, rGray; Mat tmp; Mat *costVol;
for (int y = 0;y < m_h;y++) {
int index = y * m_w;
for (int x = 0;x < (m_w);x++) {
lB = *pLCode;
double costCensus = 0.0;
for (int dd = 0; dd < m_nr_plane; dd++) {
double* costt = (double*)costVol[dd].ptr<double>(y);
costt[x] = CENCUS_BIT;
if (x - dd >= 0) {
rB = rCode[index + x - dd];
costt[x] = (lB ^ rB).count();
}
costCensus = 1 - exp(-255 * costt[x] / 15);
}
pLCode++;
m_cost_vol[y][x][i] = costAd + costCensus;
}
}
【问题讨论】:
-
@ClaudioCortese:它是 C++!
-
C 不是 C++ 不是 C!不要为 C++ 添加 C 标签!