Output error dft() function.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Output error dft() function.

  1. #1
    Join Date
    Feb 2013
    Posts
    21

    Output error dft() function.

    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:

    Code:
    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));
        }   
    }
    
    .................
    }

  2. #2
    Join Date
    Feb 2013
    Posts
    21

    Re: Output error dft() function.

    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));
    }
    }

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

  3. #3
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,392

    Re: Output error dft() function.

    Quote Originally Posted by nihad View Post
    Revised code would be

    Code:
    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));
        }   
    }
    .................
    }
    Why do you need so strange "loop"? Why not just write
    Code:
    for(i=0;i<pdf_vector.size ();i++)
    {
           all_vector.push_back (dft_output_vector.at <double>(i, 0));
    }
    Victor Nijegorodov

  4. #4
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,389

    Re: Output error dft() function.

    line 517 in matt.hpp is part of the at method. So the problem is with dft_output_vector.at

    Code:
    all_vector.push_back (dft_output_vector.at <double>(i,j));
    You'll need to debug the code to find the reason.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center