Updated by Marina Kolpakova almost 13 years ago

The following code in "opencv / modules / contrib / src / chamfermatching.cpp" leaks memory:
<pre><code class="cpp">


ChamferMatcher::Match* is = localChamferDistance(loc, dist_img, orientation_img, tpl, orientation_weight);
if(is)
matches->push_back(*is);
</code></pre>


A modified version of "opencv / samples / cpp /chamfer.cpp" which calls chamerMatching() a hundred times with an increasing memory usage is attached.

It should be like this:
<pre><code class="cpp">
ChamferMatcher::Match* is = localChamferDistance(loc, dist_img, orientation_img, tpl, orientation_weight);
if(is){
matches->push_back(*is);
delete is;
}
</code></pre>


I am testing on :
Windows XP
Visual Studio Professional 2008
OpenCV 2.3.1

Back