Is findContours fast enough ?

asked 2014-05-02 03:01:25 -0500

glupescu gravatar image

updated 2014-05-02 03:39:36 -0500

For current vision algorithms (e.g. object detection, object enhancing) does findCountours perform fast enough ? I've studied the algorithm behind it [1] and by a first look it's rather difficult to perform in parallel especially on SIMD units like GPUs. I took a usage example from [2] and did a simple trace of findCountours on [3] and [4]. While [3] requires 1ms, [4] requires about 40ms (AMD 5400K @3.6ghz). If high resolution video processing frame by frame is considered these results could be problematic. I think i may have an ideea for a faster algorithm oriented towards SIMD units. So i would like some feedback from people who have worked in vision problems to the question:

Is findCountours fast enough for current problems on current hardware ? Would improving it help in a significant way any specific algorithm ?

Thank you in advance, Grigore

[1] [2] [3] [4]

edit retag flag offensive close merge delete


I am wondering how object detection and findContours work together. I am working fulltime on object detection using the viola-jones cascade classification, the latentSVM of felzenszwalb and the dollar channelftrs framework which are all state of the art techniques and none of them need findContours ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-02 03:18:03 -0500 )edit

It was more of an assumption than a confirmation. I previously worked on image vectorization (raster->vector, e.g. algorithm [1],[2]) and noticed that contour extraction was one of the problems on large scale images (such as maps). The question is actually more oriented towards "are there any problems that require fast contour extraction" or is there a scenario where "contour extraction is the slowest step" ? I think image vectorization is not enough for me to continue and invest time into this topic.

[1] [2]

glupescu gravatar imageglupescu ( 2014-05-02 03:44:36 -0500 )edit

So you want insight in the fact 'is it interesting to improve the findContours algorithm' ?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-02 05:30:49 -0500 )edit

Yes. I mean i have an idea how to make it faster but would like to write it for GPUs using OpenCL and that would take some time. And if i manage to improve it by a % margin why would anyone bother integrating it or checking it out if contour extraction itself isn't very used (assuming) hence the current OpenCV findCountour would be enough for most people.

glupescu gravatar imageglupescu ( 2014-05-02 06:54:52 -0500 )edit

It is usefull in many other cases. I for example use it to detect blobs after an optimized segmentation. Increasing the blob detection process is always usefull.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-02 07:11:12 -0500 )edit

Thank you, I am also meet this problem. Does UMat can do it?

eatcosmos gravatar imageeatcosmos ( 2018-08-26 22:23:05 -0500 )edit