I am trying to calculate the HOGDescriptors for a roi of an image but I am getting the following error:
HOG-Descriptor(34411,0x10618d340) malloc: * error for object 0x106654a98: incorrect checksum for freed object - object was probably modified after being freed.
HOGDescriptor h;
h.winSize = Size(windows_n_rows, windows_n_columns);
vector<float> descriptors;
for(int k=0; k<=img.rows-windows_n_rows; k+=Step_slide){
for(int m=0; m<=img.cols-windows_n_columns; m+=Step_slide){
// Resulting window
Rect window(m, k, windows_n_rows, windows_n_columns);
Mat Roi = img(window);
h.compute(Roi, descriptors);
Mat feature(descriptors, true);
Mat k = feature.reshape(1,1);
forest.predict(k, pred, task3_trained_trees, confid);
float classId = pred.at<float>(0,0);
float c = confid.at<float>(0,0);
if (c > 0.5){
if(classId != 3.){
valid_roi.push_back(Roi);
}
}
}
}