30.07.2015 Views

Actas JP2011 - Universidad de La Laguna

Actas JP2011 - Universidad de La Laguna

Actas JP2011 - Universidad de La Laguna

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Actas</strong> XXII Jornadas <strong>de</strong> Paralelismo (<strong>JP2011</strong>) , <strong>La</strong> <strong>La</strong>guna, Tenerife, 7-9 septiembre 2011processors and locality of reference are required withineach processor. In this way, programmers shouldcarefully analyze the memory access patterns, in or<strong>de</strong>r toavoid penalties due to uncoalescing or bank conflicts.Idle threads and warp divergence should be minimizedby properly planning of work distribution and loadbalancing across threads and blocks.III. PARALLELIZING A COMPLEX IMAGE AND VIDEOPROCESSING APPLICATIONThis work illustrates different strategies to cope withsparse data array access, divergent execution paths andirregular memory access patterns in GPU applicationsusing, as a case study, a version of the GeneralizedHough Transform, called Fast GHT. As it is explainednext, this technique presents regular as well as irregularcomponents.A. The Generalized Hough TransformTemplate matching is a difficult problem with highcomputational requirements. One of the most popularalgorithms for <strong>de</strong>tecting shapes in images is the HoughTransform [8]. Ballard [1] generalized the HoughTransform (GHT) to <strong>de</strong>tect arbitrary shapes, which arerepresented by a template. In the original formulation,called Classic GHT, a feature space (composed of thetemplate contour points and their vectors to a referencepoint) is transformed into a four-dimensional Houghspace (the rotation, scale and displacement of thetemplate in the image). The maximum value in thisHough space corresponds to the rotation, scale anddisplacement parameters of the template in the image.The size of the Hough space and the number of votingoperations can be enormous. Thus, the computation timeof the Classic GHT is very high, making it inappropriatefor real-time applications. A solution to reduce thememory and computational requirements were presentedby Guil et al [6]. In that work, the <strong>de</strong>tection process issplit into three stages by uncoupling the rotation, scaleand displacement calculation using invariantinformation. Three transforms are applied in thisversion, called Fast GHT, to obtain the rotation, scaleand displacement parameters.The invariant features selected in that work arepairings of contour points, p i and p j , whose gradientangles, θ i and θ j, are separated by a given differenceangle ξ . For every pairing a spatial angle, α ij, adistance value, d ij , and reference vectors, r i and r j, arecomputed as shown in Figure 1. The feature space(composed of the pairings with their gradient angles,spatial angles, distances and vectors) is transformed in atwo-dimensional Hough space (the gradient and spatialangles) with every pairing voting in the bin with thesame gradient and spatial angle. The Hough spaces ofthe template and the image can be compared using aspecial cross-correlation function whose maximumvalue is located in the rotation value, β , of the templatein the image.Next, the gradient angles of the pairings in thetemplate are rotated β <strong>de</strong>grees and a new transform in aone-dimensional Hough space (the scale parameter) isapplied. Every pairing in the template and the imagefeature space with the same gradient and spatial anglesare selected and the quotient of their distances is used tovote in the Hough space. The position of the maximumof the Hough space is the scale parameter. Finally, thereference vectors of the pairings in the template arerotated and scaled using the calculated parameters, and atransform in a two-dimensional Hough space (thedisplacement coordinates) is computed. Pairings withthe same gradient and spatial angles are selected and thevectors superimposed to vote in the Hough space whosemaximum corresponds to the position of the template inthe image.Fig. 1. Variables <strong>de</strong>fined in the GHTLet T be the template, I the image, (x i , y i ) thecoordinates of an edge point p i , ξ the difference angle,O , S and D the Hough spaces to computeorientation, scale and displacement respectively, andmaxi(Μ) a function that returns the in<strong>de</strong>x where themaximum value of Μ takes place, the algorithm steps inpseudo-co<strong>de</strong> are1. Compute contour points pi = { xi, yi, θi}in TT T2. For each pairing { pi, pj} with θ i − θ j = ξ ,<strong>de</strong>fT compute p = { α , d , r, r }ijTij ij i j3. For each p T ij increment O ( θi, αij)4. Repeat steps 1, 2, 3 for I to obtain p I ij ,IT<strong>de</strong>fp IijandOI T5. β = maxi( corr( O , O ))6. Rotate template contour points<strong>de</strong>fTpi = { xi, yi, θi+ β}7.T IFor each { pij, pkl} with θ i = θ k and α ij − α klincrement S ( dij, dkl)8. ς = maxi( S )9. Scale vectors in p Tij using ςT I10. For each { pij, pkl} with θ i = θ k and α ij − α kl,increment D (( xk, yk) + ri), D (( xk, yk) + rj),D (( x , y ) + r) and D (( x , y ) + r)11. ( )i i iδx, δ y = maxi( D )i i jB. Regular computation within the GHTEdge <strong>de</strong>tection and correlation, applied in steps 1 and5 respectively, exhibit a regular parallelism, since asimple workload distribution guarantees a good load<strong>JP2011</strong>-306

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!