2 Replies - 440 Views - Last Post: 21 March 2013 - 06:02 AM Rate Topic: -----

#1 nihadkarim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 07-March 13

Output error dft() function.

Posted 21 March 2013 - 03:47 AM

I am trying to use following code, but it gives error. Error message is like : OpenCV Error: Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)si ze.p[0] && (unsigned)(i1DataType<_Tp>::channels) < (unsigned)(size.p[1]channel s()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1 << 3 ) - 1))*4) & 15) == elemSize1()) in unknown function, file c:\program files (x86 )\opencv2.2\include\opencv2\core\mat.hpp, line 517

My code is given below:

int main(.....)
{
vector<double>pdf_vector;
//read data from file and put it in pdf_vector.
vector<double>all_vector;
Mat dft_input_vector(pdf_vector);
Mat dft_output_vector;
dft(dft_input_vector, dft_output_vector);

for(i=0;i<1;i++)
{
   for(j=0;j<pdf_vector.size ();j++)
    {
      all_vector.push_back (dft_output_vector.at <float>(i,j));
    }   
}

.................
}


Is This A Good Question/Topic? 0
  • +

Replies To: Output error dft() function.

#2 nihadkarim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 07-March 13

Re: Output error dft() function.

Posted 21 March 2013 - 04:31 AM

Revised code would be

int main(.....)
{
vector<double>pdf_vector;
//read data from file and put it in pdf_vector.
vector<double>all_vector;
Mat dft_input_vector(pdf_vector);
Mat dft_output_vector;
dft(dft_input_vector, dft_output_vector);

for(i=0;i<pdf_vector.size ();i++)
{
   for(j=0;j<1;j++)
    {
      all_vector.push_back (dft_output_vector.at <double>(i,j));
    }   
}

.................
}

Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3535
  • View blog
  • Posts: 10,943
  • Joined: 05-May 12

Re: Output error dft() function.

Posted 21 March 2013 - 06:02 AM

Have you checked each of the conditions of the assertion? Which one of them is not true?

I remind you again that OpenCV is "open source" you can look at the source code and see what it is doing. When the assertion fires, you can press break on the dialog, and inspect your variables with regards to the assertion.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1