I am not familiar with the Hough transform, so posting some pseudo code can help here. But if you are interested in voting, you may consider using CUDA's internal voting instructions to expedite this.
Note. This requires 2.0 or later computing power (Fermi or later).
If you want to count the number of threads in a block for which a specific condition is specified, you can simply use __syncthreads_count() .
bool condition = ...;
If you want to count the number of threads in the grid for which the condition is true, you can do atomicAdd
bool condition = ...;
If you need to count the number of threads in a group smaller than the block for which the condition is true, you can use __ballot() and __popc() (population count).
// get the count of threads within each warp for which the condition is true bool condition = ...; // compute the condition in each thread int warpCount = __popc(__ballot()); // see the CUDA programming guide for details
Hope this helps.
source share