How to solve this exception?

asked 2014-11-04 16:13:18 -0600

goez2k12 gravatar image

updated 2014-11-05 08:09:39 -0600

please help me, I have this code and it throws me that exception.

* Error in `/home/sony/Desktop/recognizingObjects/detectingShapes/chamfer': corrupted double-linked list: 0x0000000002620ee0 * Aborted (core dumped)

I guess it is when i call the function "chamerMatching( img, tpl, results, costs );"

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/contrib/contrib.hpp"

#include <iostream>

using namespace cv;
using namespace std;


const char* keys =
{
    "{1| |logo_in_clutter.png|image edge map    }"
    "{2| |logo.png               |template edge map}"
};

int main( int argc, const char** argv )
{

    CommandLineParser parser(argc, argv, keys);

    string image = parser.get<string>("1");
    string templ = parser.get<string>("2");
    Mat img = imread(image.c_str(), 0);
    Mat tpl = imread(templ.c_str(), 0);

    if (img.empty() || tpl.empty())
    {
        cout << "Could not read image file " << image << " or " << templ << "." << endl;
        return -1;
    }
    Mat cimg;
    cvtColor(img, cimg, CV_GRAY2BGR);

    // if the image and the template are not edge maps but normal grayscale images,
    // you might want to uncomment the lines below to produce the maps. You can also
    // run Sobel instead of Canny.

     Canny(img, img, 5, 50, 3);
     Canny(tpl, tpl, 5, 50, 3);

    vector<vector<Point> > results;
    vector<float> costs;
    int best = chamerMatching( img, tpl, results, costs );
    if( best < 0 )
    {
        cout << "matching not found" << endl;
        return -1;
    }

    size_t i, n = results[best].size();
    for( i = 0; i < n; i++ )
    {
        Point pt = results[best][i];
        if( pt.inside(Rect(0, 0, cimg.cols, cimg.rows)) )
           cimg.at<Vec3b>(pt) = Vec3b(0, 255, 0);
    }

    imshow("result", cimg);

    waitKey();

    return 0;
}
edit retag flag offensive close merge delete

Comments

Why do you guess? Let's debug to find out where it crashes.

boaz001 gravatar imageboaz001 ( 2014-11-05 06:26:19 -0600 )edit

Simply said, that function does NOT exist ... So I am guessing your definition of that function is not included here or you copied someones code without knowing this is a own written code.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-11-05 06:28:19 -0600 )edit
1
boaz001 gravatar imageboaz001 ( 2014-11-05 07:01:42 -0600 )edit

Ok excuse me. Weird that the search doesnt work on it...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-11-05 08:12:26 -0600 )edit

I have the same problem. Anyone know how to solve it?

fortes_23 gravatar imagefortes_23 ( 2015-01-06 19:03:04 -0600 )edit

I m also using this code but getting debug assertion failed error... Expression :_Block_type_is_valid(pHead-->nBlockuse)..

NoOne gravatar imageNoOne ( 2015-02-10 05:57:14 -0600 )edit
1

Do you know how to use a debugger?

boaz001 gravatar imageboaz001 ( 2015-02-15 16:36:22 -0600 )edit

I am having the same problem, for reference, here is the backtrace (not enough space for all of it):

5 0x00007ffff6d9c1ce in cv::ChamferMatcher::Template::~Template() () from /usr/local/lib/libopencv_contrib.so.2.4

6 0x00007ffff6da4400 in cv::chamerMatching(cv::Mat&, cv::Mat&, std::vector<std::vector<cv::point_<int>, std::allocator<cv::point_<int> > >, std::allocator<std::vector<cv::point_<int>, std::allocator<cv::point_<int> > > > >&, std::vector<float, std::allocator<float=""> >&, double, int, double, int, int, int, double, double, double, double) () from /usr/local/lib/libopencv_contrib.so.2.4

7 0x0000000000404987 in main (argc=3, argv=0x7fffffffde88) at ...chamfer.cpp:55

offending line: int best = chamerMatching( img, tpl, results, costs );

mjsobrep gravatar imagemjsobrep ( 2015-12-09 15:06:39 -0600 )edit

@mjsobrep, please open a new topic. This one is more than one year old ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-12-10 02:09:00 -0600 )edit