-2

I was studying opencv, mat structure.

But, In source code, it used a mat pointer. (Image)

But, It occured error. because, Mat *costVol isn't initiallized. I don't know how to initialize the costVol, variable.

code:

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;
        }
    }
too honest for this site
  • 12,050
  • 4
  • 30
  • 52

1 Answers1

0

Well, Mat is an array-class.

Use its create() method.

A.Franzen
  • 725
  • 4
  • 10