About implementation of progressive probabilistic Hough transform

asked 2018-07-23 22:21:14 -0500

I have two questions about implementation of progressive probabilistic Hough transform in OpenCV, i.e. function HoughLinesProbabilistic in hough.cpp. It's from the latest version(3.4.2). The code I have question is the following, from line 675:

            // for each non-zero point:
            //    update line end,
            //    clear the mask element
            //    reset the gap
            if( *mdata )
            {
                if( good_line )
                {
                    adata = accum.ptr<int>();
                    for( int n = 0; n < numangle; n++, adata += numrho )
                    {
                        int r = cvRound( j1 * ttab[n*2] + i1 * ttab[n*2+1] );
                        r += (numrho - 1) / 2;
                        adata[r]--;
                    }
                }
                *mdata = 0;
            }
  1. if( *mdata ) does not ensure this pixel has voted before. It may be a non-zero pixel but hasn't voted.
  2. It is not consistent with the origin paper(Robust Detection of Lines Using the Progressive Probabilistic Hough Transform ). According to that paper, one should "Unvote" from the accumulator all the pixels from the line that have previously voted no matter whether it is a good line, i.e., whether it is longer than the minimum length.

Can anyone clarify this two issues for me? Thanks very much!

edit retag flag offensive close merge delete