Hough Transform Probability with specific degree range

asked 2014-09-18 01:52:48 -0500

zms gravatar image

Hello everyone, I may need help from all of you.. Currently Im debugging the Proabablistic HT code to select the lines on selective degree. With the research, using only HT code there will be no problem, but when I tried to implement to the probabilistic HT code, I don't know where am I going.. Ok here is the code for normal HT,

if 0 // draw lines vertical

for( size_t i = 0; i < lines.size(); i++ )
{
    float rho = lines[i][0], theta = lines[i][1];

    if( theta>CV_PI/180*170 || theta<CV_PI/180*10)
    { Point pt1, pt2;
    double a = cos(theta), b = sin(theta);
    double x0 = a*rho, y0 = b*rho;
    pt1.x = cvRound(x0 + 1000*(-b));
    pt1.y = cvRound(y0 + 1000*(a));
    pt2.x = cvRound(x0 - 1000*(-b));
    pt2.y = cvRound(y0 - 1000*(a));
    line( cdst, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
    }

and here is the proability HT which I don't know how it would work to have only vertical lines.

else

      vector<Vec4i> lines;

      HoughLinesP(dst, lines, 1, CV_PI/180, minthreshold, 50, 10 );
      //imshow("lines",lines);

      for( size_t i = 0; i < lines.size(); i++ )
      {

        Vec4i l = lines[i];
        line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,255,0), 3, CV_AA);
      }

please help

edit retag flag offensive close merge delete