Updated by Marina Kolpakova almost 13 years ago

Hello,

I don't know if it is a defect, but the following 'bug' makes all slow:

In opencv c++ Interface the function <code>cv::Findcontours(...)</code> cv::Findcontours(...) saves the found contours in a data field of type <code>vector<vector<Point>></code>. vector<vector<Point>>.

On my computer that interface makes the computation 10x slower when found 5000-10000 contours (compared to c interface) - i think because of deconstructing the vectors, example:

<pre><code class="cpp">


cv::Mat image;
vector<vector<Point>> contours;
while (do)
{
contours.clear();
cv::findContours(image, contours, ....);
...
}
</code></pre>


<code>contours.clear()</code> contours.clear() takes a lot of time.
if i dont't use .clear command, then memory leaks arise.

Question: I think for now "looped" contour analysis it is better to use c interface or could one expect an optimized c++ variant someday.

Back