Ask Your Question

meleagrosy's profile - activity

2016-11-30 13:42:48 -0600 received badge  Student (source)
2014-11-25 16:42:17 -0600 asked a question dft DFT_ROWS: half of the result is uninitialized (2.49)

Hi,

I am not sure, if I am doing something wrong. I use the following code:

Mat C = (Mat_<float>(1, 16) << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
Mat Cf;
dft(C, Cf, DFT_ROWS | DFT_COMPLEX_OUTPUT);

But columns 9-15 of Cf after dft are not initialized (still containing the values of the memory before dft).

Is this a bug or did I use dft incorrectly?

2014-11-17 08:14:17 -0600 asked a question cv::Ptr of Mat[]: How?

Hello, I am new to OpenCV and would have the following question:

I have several methods which have to be applied to 31 feature channels separately. Thus, I wanted to use an array of Mats:

Mat features[31];

Obviously, this array is only useable in the current scope. I would like to return it with automatic memory management:

Ptr<Mat> matPtr = new Mat[31];
matPtr[0] = M1;
matPtr[1] = M2;
matPtr[2] = M3;

This does not work and stops with an assertion. What is the correct syntax to achieve automatic memory management with arrays of matrices?

PS.:

struct Features

{ Mat channels[3]; };

int main(int, char**) {

Ptr<features> matPtr = new Features();

{
    Mat M(3, 3, CV_8UC3, Scalar(0, 0, 255));
    matPtr->channels[0] = M;
    matPtr->channels[1] = M;
    matPtr->channels[2] = M;
}

std::cout << matPtr->channels[0] << endl;
return 0;

}

seems to work. Is this code correct?