Modules/core/src/matrix.cpp:284: error: (-215) 0 <= _dims && _dims <= 32 in function setSize

Hi, berak. I encountered a similar issue. After debugging, I found that the error was caused by the following code, but I don’t know why. I hope you can help me analyze the reason. Thank you .
The error message:
`OpenCV Error: Assertion failed (0 <= _dims && _dims <= 32) in setSize, file /home/cvslam/Downloads/system/lib/opencv-3.4.0/modules/core/src/matrix.cpp, line 284
terminate called after throwing an instance of ‘cv::Exception’
what(): /home/cvslam/Downloads/system/lib/opencv-3.4.0/modules/core/src/matrix.cpp:284: error: (-215) 0 <= _dims && _dims <= 32 in function setSize

Aborted (core dumped)`

The code that caused the error is located between pos002 and pos00KK. " stereo_frame->pdesc_l = sf->pdesc_l;
"

KeyFrame::KeyFrame( const StereoFrame* sf, int kf_idx_ )
{

    kf_idx    = kf_idx_;
    T_kf_w    = sf->Tfw;
    x_kf_w    = logmap_se3( T_kf_w );
    xcov_kf_w = sf->Tfw_cov;

    stereo_frame = new StereoFrame( sf->img_l, sf->img_r, kf_idx, sf->cam );

    cout << "pos002"<<endl;  
    stereo_frame->pdesc_l   = sf->pdesc_l;
    cout << "pos00KK"<<endl; 
    stereo_frame->pdesc_r   = sf->pdesc_r;
    stereo_frame->ldesc_l   = sf->ldesc_l;
    stereo_frame->ldesc_r   = sf->ldesc_r;



    std::vector<PointFeature*> &stereo_pt = stereo_frame->stereo_pt;
    stereo_pt.resize(sf->stereo_pt.size());


    for (int idx = 0; idx < stereo_pt.size(); ++idx)
        stereo_pt[idx] = sf->stereo_pt[idx]->safeCopy();



    std::vector<LineFeature*> &stereo_ls = stereo_frame->stereo_ls;
    stereo_ls.resize(sf->stereo_ls.size());
 
    for (int idx = 0; idx < stereo_ls.size(); ++idx)
        stereo_ls[idx] = sf->stereo_ls[idx]->safeCopy();

}

sorry, but to actually try something, we need a MRE , not a random snippet

if it throws a proper assert, you should be able to debug this with gdb, really.

also, where is your (3rd party) slam code from ? can you explain any of the goings-on here ?

Hi, everyone. I am running an open-source project on GitHub(https://github.com/rubengooj/pl-slam), and when I run the program, it throws an error.
After debugging, I found that the error was caused by the following code, but I don’t know why. I hope everyone can help me analyze and provide a solution to this problem. Thank you all.

The error message:
`OpenCV Error: Assertion failed (0 <= _dims && _dims <= 32) in setSize, file /home/cvslam/Downloads/system/lib/opencv-3.4.0/modules/core/src/matrix.cpp, line 284
terminate called after throwing an instance of ‘cv::Exception’
what(): /home/cvslam/Downloads/system/lib/opencv-3.4.0/modules/core/src/matrix.cpp:284: error: (-215) 0 <= _dims && _dims <= 32 in function setSize

Aborted (core dumped)`

The code that caused the error has been located between pos002 and pos00KK in the constructor of class KeyFrame. " stereo_frame->pdesc_l = sf->pdesc_l;

KeyFrame::KeyFrame( const StereoFrame* sf, int kf_idx_ )
{

    kf_idx    = kf_idx_;
    T_kf_w    = sf->Tfw;
    x_kf_w    = logmap_se3( T_kf_w );
    xcov_kf_w = sf->Tfw_cov;

    stereo_frame = new StereoFrame( sf->img_l, sf->img_r, kf_idx, sf->cam );

    cout << "pos002"<<endl;  
    stereo_frame->pdesc_l   = sf->pdesc_l;
    cout << "pos00KK"<<endl; 
    stereo_frame->pdesc_r   = sf->pdesc_r;
    stereo_frame->ldesc_l   = sf->ldesc_l;
    stereo_frame->ldesc_r   = sf->ldesc_r;



    std::vector<PointFeature*> &stereo_pt = stereo_frame->stereo_pt;
    stereo_pt.resize(sf->stereo_pt.size());


    for (int idx = 0; idx < stereo_pt.size(); ++idx)
        stereo_pt[idx] = sf->stereo_pt[idx]->safeCopy();



    std::vector<LineFeature*> &stereo_ls = stereo_frame->stereo_ls;
    stereo_ls.resize(sf->stereo_ls.size());
 
    for (int idx = 0; idx < stereo_ls.size(); ++idx)
        stereo_ls[idx] = sf->stereo_ls[idx]->safeCopy();

}

Thank you for your reply and suggestion. I will try to learn how to use GDB to debug the code. Actually, I am running an open-source project on GitHub([https://github.com/rubengooj/pl-slam), and I get the error.
Here are the Prerequisites and dependencies:

sorry, but a screenshot of your code’s dependencies is as useless as the context-less code snippet.

again, nobody can or will try, you’r eon you’re own.
learn how to use a debugger (now, damn!), come back with results