Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

HOG-Descriptor Malloc error

I am trying to calculate the hog descriptors of a vector of images but keep getting the following error:

HOG-Descriptor(76121,0x70000f807000) malloc: * error for object 0x106f55c10: incorrect checksum for freed object - object was probably modified after being freed. * set a breakpoint in malloc_error_break to debug

My Code for your reference:

void calcDescriptors(std::vector<Mat> &img_list, Mat &data){
    HOGDescriptor h;
    h.winSize = Size(128, 112);
    vector<float> descriptors;
    for(size_t k=0; k<img_list.size(); k++){
        h.compute(img_list[k], descriptors);
        data.push_back(descriptors);
    }
}

calcDescriptors(img_list, data);
cout<<"Creating and training dtree\n";
Ptr<ml::DTrees> model = ml::DTrees::create();
model->train(ml::TrainData::create(data, ml::ROW_SAMPLE, labels));