Ask Your Question

Revision history [back]

How to extract all pixels in houghlines top accumulator?

I am running houghlines transform on the edges of an image, and I would like to gather all the pixels found on the perceived line and do a least square method on the pixels. Hence, I would have to extract all the pixels from the top vote of houghlines.

I am doing some adjustments to the source code. I do so by creating a new function in my code. However, I am having trouble understanding this from the source code.

// stage 1. fill accumulator
for( i = 0; i < height; i++ )
    for( j = 0; j < width; j++ )
    {
        if( image[i * step + j] != 0 )
            for(int n = 0; n < numangle; n++ )
            {
                int r = cvRound( j * tabCos[n] + i * tabSin[n] );
                r += (numrho - 1) / 2;
                accum[(n+1) * (numrho+2) + r+1]++;
            }
    }

What does accum[(n+1) * (numrho+2) + r+1] mean? Why is it filling up a whole column?

Anyone know how to save the i and j whereby I can extract the i and j of the highest voted rho and theta?