Ask Your Question

andreadc's profile - activity

2016-11-21 01:18:14 -0600 commented question cvFindContours is faster than cv::findcontours

And also cv::approxPolyDP allocate each time a CvMemStorage. I think I need to upgrade to 3.0 version to solve that issue, am I wrong?

2016-11-18 05:05:25 -0600 received badge  Editor (source)
2016-11-18 04:57:13 -0600 commented question cvFindContours is faster than cv::findcontours

Hi, I have just tried with 2.4.13 version but nothing changes. I have verified that isn't only cv::findcontours to slow down, but in general all c++ function are a little slower. For example after finding contours I use several cv::approxPolyDP to try other contours approximation and also them are slower.

How could attach a source code file I have used to test it? Anyway, doing 10000 cv::findcountours over a generic sample image and then running each contour several approximations take nearly 1 seconds more than doing it with C functions. Is it possible? Is it only C++ overhead?

2016-11-17 10:29:11 -0600 commented question cvFindContours is faster than cv::findcontours

I have checked it with a complex application, I need to isolate some code to post it. Let me try with 2.4.13 version, then I'll give you another feedback

2016-11-17 10:21:27 -0600 received badge  Student (source)
2016-11-17 10:17:13 -0600 asked a question cvFindContours is faster than cv::findcontours

Hi, I'm using 2.4.13 opencv in a VS application and I have just updated source code changing old C functions with new C++ functions. In particular I have verified that cv::findcontours is slower than cvFindContours.

For example I have tried with that code:

for( i=0; i<10000; i++ ) {
    cvThreshold(gray, tmp, 225, 255, CV_THRESH_BINARY);
    cvFindContours(tmp, storage, &contours, sizeof(CvContour), CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);

    cvInitTreeNodeIterator(&iterator, contours, 2);
    while( src_cc= (CvSeq*)cvNextTreeNode(&iterator) ) {
        for( approxParam=1.5; approxParam<=10.0; approxParam+=0.5 )
            dst_cc = cvApproxPoly(src_cc, sizeof(CvContour), temp_storage, CV_POLY_APPROX_DP, approxParam);
    }
}

vs

for( i=0; i<10000; i++ )
{
    cv::threshold(mat_gray, mat_tmp, 225, 255, CV_THRESH_BINARY);
    cv::findContours(mat_tmp, mat_contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);

    for( ic=0; ic<mat_contours.size(); ic++ ) {
        for( approxParam=1.5; approxParam<=10.0; approxParam+=0.5 )
            cv::approxPolyDP(mat_contours[ic], dst_contour, approxParam, true);
    }
}

C++ source has a RELEASE execution time nearly 1 second greater than C source. Is it possible? Is it only C++ overhead? I have used an opencv sample image (baboon.jpg) and C source needs thereabouts 4 seconds while C++ source 5 seconds

regards Andrea

2016-11-17 02:42:32 -0600 received badge  Scholar (source)
2016-11-17 02:26:38 -0600 asked a question cv::findContours crash with release dlls

Hi, I'm building a VS application linking opencv 2.4.13 release dlls even for RELEASE and DEBUG configuration. In DEBUG configuration it crashes on cv::findContours. I have already checked that using opencv debug dlls it doesn't happen, but it let my application slow down due to opencv debugging. My question is, if I don't need to debug opencv code, there is a way to link anyway release dlls? Or am I bounded to use debug dlls?

thank you for the attention, regards Andrea