Added ippiHoughLine_Region to cv::HoughLines
authorAlexander Karsakov <alexander.karsakov@itseez.com>
Fri, 11 Apr 2014 07:31:21 +0000 (11:31 +0400)
committerAlexander Karsakov <alexander.karsakov@itseez.com>
Wed, 23 Apr 2014 07:59:36 +0000 (11:59 +0400)
modules/imgproc/src/hough.cpp

index 061835c..b7a3c38 100644 (file)
@@ -97,6 +97,25 @@ HoughLinesStandard( const Mat& img, float rho, float theta,
     int numangle = cvRound((max_theta - min_theta) / theta);
     int numrho = cvRound(((width + height) * 2 + 1) / rho);
 
+#if (defined(HAVE_IPP) && IPP_VERSION_MAJOR >= 8)
+    IppiSize srcSize = { width, height };
+    IppPointPolar delta = { rho, theta };
+    IppPointPolar dstRoi[2] = {{(Ipp32f) -(width + height), (Ipp32f) min_theta},{(Ipp32f) (width + height), (Ipp32f) max_theta}};
+    int bufferSize;
+    int ipp_linesMax = std::min(linesMax, numangle*numrho);
+    int linesCount = 0;
+    lines.resize(ipp_linesMax);
+    IppStatus ok = ippiHoughLineGetSize_8u_C1R(srcSize, delta, ipp_linesMax, &bufferSize);
+    Ipp8u* buffer = ippsMalloc_8u(bufferSize); 
+    if (ok >= 0) ok = ippiHoughLine_Region_8u32f_C1R(image, step, srcSize, (IppPointPolar*) &lines[0], dstRoi, ipp_linesMax, &linesCount, delta, threshold, buffer);
+    ippsFree(buffer);
+    if (ok >= 0)
+    {
+        lines.resize(linesCount);
+        return;
+    }
+#endif
+
     AutoBuffer<int> _accum((numangle+2) * (numrho+2));
     std::vector<int> _sort_buf;
     AutoBuffer<float> _tabSin(numangle);