Essays.club - Get Free Essays and Term Papers
Search

Hough Transform Using Hpc

Autor:   •  April 20, 2018  •  7,044 Words (29 Pages)  •  459 Views

Page 1 of 29

...

k =

0.002998B

,

(7)

p

where B = 0.5 T is the magnetic field corresponding to ALICE setup. Figure1 and figure2 shows a typical example of 100 lines generated using the above procedures.For each track, we have generated about 256 data points which corrsponds to the number of pads per trajectory.

1.1. Implementation in GPU

To detect the trajectory parameters, we have implemented the hough transformation using both Eq.2 and Eq.6. In case of the circular hough transform, the independent parameters in hough space are φ0 and pT (k). Similarly under conformal mapping the hough parameters are u and v.Both the methods are implemented using CPU (Intel Core2 Duo, 3.16GHz) and GPU (NVIDIA GeForce GTX 480). For GPU programming, NVIDIA CUDA is used, although it can be implemented in OpenCL as well.

While implementing in GPU, two methods have been followed. In the first method each data point is associated with a given thread. So, N threads are used, spread over several blocks corresponding to N data points. In the second method, N blocks are used each for a given data point, where the threads in a block are used to build the accumulator. Detail description of each method are given below:

1.2. Method1

Circular transform

300

250

200

150

100

0.8

0

5

0.4

10

0

15

20

25

-0.4

P(GeV)

Φ0(Degree)

30

35

-0.8

40

Figure 3. The hough transformation in φ0 and p space. As an example we have considered 10 curves each consisting of 256 data points.

In the following, a pseudo-code of the kernel implementation is given below. We have considered all the data points in a azimuthal sector for 0 ≤ φ0 ≤ 45O.

__global__ void hough_thread(float *R,float *phi,float *sine,int *temp)

{

int i,y2,y1,ip;

float ag,m,c,sinag,p,k,phi0;

int index = threadIdx.x + blockIdx.x * blockDim.x; for(i=0;i

{

phi0=i*0.1; ag=phi[index]*(180.0/3.14)-phi0; if(ag>=0)

{

y1=ag;

y2=y1+1; m=sine[y2]-sine[y1];

Conformal transform

300

280

260

240

220

200

180

160

0.02

0.016

0

0.012

0.1

0.2

0.008

0.3

Intercept

0.4

0.004

0.5

0.6

Slope

0.7

0

0.8

Figure 4. The hough transformation in u and v using conformal mapping for the same points as shown in Fig3.

c=sine[y1]-m*y1; sinag=m*ag+c;

}

if(ag

{

ag=-ag; y1=ag; y2=y1+1;

m=sine[y2]-sine[y1]; c=sine[y1]-m*y1; sinag=-1*(m*ag+c);

}

k=2.0*sinag/R[index]; p=(0.002998*.5)/k; ip=p*B/2+200;

if(ip>=0 && ip

}

}

The variable index varies from 0 to the total number of threads N .In the circular representation (in R and φ coordiantes), the data points are given by phi[index] and R[index].The independent variable phi0 varies from 0 to 45O over 400 bins.The corresponding p variable is also estimated over 400 bins. The appropriate scaling factors have been used to build the accumulator temp as a 400x400 array. It is important to notice that the inbuilt atomicAdd function has been used to avoid the race conditions.The sine calculations are carried out in the CPU and intermediate values are estimated in GPU using a simple linear interpolation.

The following code shows the pseudo-code of the kernel for conformal mapping in linear hough space.

__global__ void linear_hough(float *u,float *v,int *temp)

{

int i,c; float m,k,d;

int index = threadIdx.x + blockIdx.x * blockDim.x; d=v[index]*v[index]+u[index]*u[index]; v[index]=v[index]/d;

...

Download:   txt (45.6 Kb)   pdf (140.8 Kb)   docx (1.4 Mb)  
Continue for 28 more pages »
Only available on Essays.club