Corrupted double linked-list for imshow function !!!

asked 2014-04-03 10:38:16 -0600

Parsa gravatar image

updated 2019-01-25 13:07:12 -0600

Hi I've written this simple program

Main.cpp

std::vector<cv::Mat> PD_Classifier_VEC;
#define Folder_Address ""
int Main()
{
        int overall_counter=0;

        for(int j = 0 ; j < 600 ; j++)
          {
               QString address = Folder_Address + QString::number(overall_counter++) +".jpg";
               cv::Mat image = cv::imread(address.toUtf8().constData(),0);
               PD_Classifier_VEC.push_back(image);
               PD();
          }
}

PD Function

void PD()
{
            static int Total_Frame_Number=0;
            Total_Frame_Number++;
            cv::Mat Point_MAT = cv::Mat(PD_Classifier_VEC[0].size(),CV_8UC1,cv::Scalar::all(0)); 

   ....//Some Calculation //

       PD_Classifier_VEC[0].release();
       PD_Classifier_VEC.erase(PD_Classifier_VEC.begin());

}

this code works fine till j=56, after that Qt display this error and quits !!!

*** Error in `/home/parsa/QtProjects/QtVLPR/QtVLPR': corrupted double-linked list: 0x0000000000dcf880 ***

I ran the code in debugger mode and added this if statement code to PD() Function:

void PD()
{
            static int Total_Frame_Number=0;
            Total_Frame_Number++;
            cv::Mat Point_MAT = cv::Mat(PD_Classifier_VEC[0].size(),CV_8UC1,cv::Scalar::all(0)); 

   ....//Some Calculation //

        if(Total_Frame_Number==56)
        {
        std::cout<<Point_MAT<<"\n";            //it displays the elements perfectly
        int Nonz = cv::countNonZero(Point_MAT);  //it runs too
        cv::imshow("Point_MAT",Point_MAT);          //here the error appears !!!
        cv::moveWindow("New_Frame",100,300);
        cv::waitKey();
        }
       PD_Classifier_VEC[0].release();
       PD_Classifier_VEC.erase(PD_Classifier_VEC.begin());

}

As you can see, the comments provided above the first two lines works fine but when I try to show the image using imshow the program crashes and it displays the corrupted double linked list error !!! what's wrong here?

Why I can't display this image and if the POINT_MAT image is corrupted how the first two lines works fine ?

P.S If I start the program from j=57, it works fine till it finishes and no error appears so the

//some calculation

code works fine and I'm sure about it. I've tested this code both on opencv 2.4.7 and 2.4.8 !! and both of them shows the same error !! (I've built them on my linux OS)

edit retag flag offensive close merge delete