Corruption of the heap using OpenCV C++ HOG Detector -


hi stackoverflow community,

i've been developing algorithm using opencv library. didn't have memory issues until when i'm integrating algorithm in application. i'm not skilled in c++ , "properly coding" don't know can cause problem.

the error when release code typical "corruption of heap". in code below can see function in breakpoint.

i think problem related mat frametemp. in function send mat parameter, copy mat temporary mat , work 1 (detecting persons in image , marking rectangle in them). return temporary mat. there has wrong memory allocation/deallocation of these mat can't find answer this. wrong in code sure can me solve breakpoint. in advance answering.

mat predetection(mat &frame){      mat rois;     mat frametemp;     frame.copyto(frametemp);      // hog people detections     hogdescriptor hog;     static vector<float> detector = hogdescriptor::getdefaultpeopledetector();     if (!detector.size()) {         fprintf(stderr, "error: getdefaultpeopledetector returned null\n");          }     hog.setsvmdetector(detector);      fflush(stdout);     vector<rect> found, found_filtered;     vector<double> foundweights, foundweights_filtered;      // run detector default parameters. higher hit-rate     // (and more false alarms, respectively), decrease hitthreshold ,     // groupthreshold (set groupthreshold 0 turn off grouping completely).     hog.detectmultiscale(frametemp, found, foundweights, 0, size(8, 8), size(32, 32), 1.05, 2);       size_t i, j;     (i = 0; < found.size(); i++)     {          rect r1 = found[i];         double prescore = foundweights[i];         (j = 0; j < found.size(); j++)             if (j != && (r1 & found[j]) == r1)                 break;         if (j == found.size()){             found_filtered.push_back(r1);             foundweights_filtered.push_back(prescore);         }     }       (i = 0; < found_filtered.size(); i++)     {         rect r2 = found_filtered[i];         double prescore_filtered = foundweights_filtered[i];         int x1, y1, x2, y2;         x1 = r2.x;         y1 = r2.y;         x2 = r2.x + r2.width;         y2 = r2.y + r2.height;          // hog detector returns larger rectangles real objects.         // shrink rectangles nicer output.         r2.x += cvround(r2.width*0.1);         r2.width = cvround(r2.width*0.8);         r2.y += cvround(r2.height*0.07);         r2.height = cvround(r2.height*0.8);         rectangle(frametemp, r2.tl(), r2.br(), cv::scalar(255, 0, 0), 1);     }     return frametemp; } 

and call stack:

ntdll.dll!_rtlpbreakpointheap@4()  + 0x19 bytes  ntdll.dll!rtlpvalidateheapentry()  + 0x3088c bytes   ntdll.dll!_rtldebugfreeheap@12()  + 0xbf bytes   ntdll.dll!rtlpfreeheap()  + 0x44b2f bytes    ntdll.dll!rtlfreeheap()  + 0x1ba bytes   msvcr100.dll!free(void * pblock)  line 51   c diva_detector3.exe!predetection(cv::mat & frame)  line 70 + 0x9e bytes  c++ 

does mat class have appropriate , correct copy constructor? gets called when return frametemp, , if it's got bug can these kinds of problems.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -