【问题标题】:Mat pointer( Mat *arr) initiallizeMat 指针( Mat *array) 初始化
【发布时间】: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 标签!

标签: c++ opencv pointers mat


【解决方案1】:

嗯,Mat 是一个数组类。

使用它的 create() 方法。

【讨论】:

    猜你喜欢
    • 2023-03-30
    • 2018-09-21
    • 2015-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多