Accumulator matrix, concept and calculation

Accumulator matrix, concept and calculation

by Yifei Song -
Number of replies: 1

I'm confused about the calculation of the accumulator array in Exercise General Hough Transform.

It seems that the accumulator matrix is a matrix, where non-zero M(i, j) indicates a new candidate center point (i,j). Am I right?

Can you elaborate on calculating the accumulator matrix?

Thanks!

In reply to Yifei Song

Re: Accumulator matrix, concept and calculation

by Deniz Sayin Mercadier -
Hello Yifei,

Indeed, the accumulator matrix counts 'votes' for a center point of the template we're searching for.

It's easier to explain if we focus on a simpler version: the circle hough transform (CHT). Let's say we're looking for a circle with radius r. The accumulator matrix is initialized with zeros. The idea is the following: while scanning through the edge image, whenever we find an edge, we think "If this edge was part of the circle I am looking for, where would the center of that circle be?". The answer is also a circle of radius r around the edge we found: i.e. if I assume I am on the edge of a circle, the center of this circle could be any point at distance r from where I am. We then add a +1 vote in the accumulator matrix to all pixels in radius r around the edge as 'possible centers'. 

The figure below (from MATLAB documentation) illustrates this well. The dashed lines show the "voting area" around each edge point we find. In the end, the center of the circle is what gets the most votes, and we can find it by looking for the max in the accumulator array. 
CHT
For the generalized hough transform, it's more complicated, but the core idea is the same. Instead of voting in a circle around the edge, we use the r-table pre-computed based on the template for voting, which also uses the angle of the edges to further optimize the voting process. That's a separate can of worms, but feel free to ask for further clarification about that as well if needed. 

I hope this clears up the core idea somewhat: "If I am on the edge of the shape I am looking for, where could the center of the shape be? Add a vote for each of the possible centers.". 

All the best,
Deniz