## Error in Solution Ex1 houghtransform.m?

Moderator: Computer Vision

schwanal
Erstie
Beiträge: 20
Registriert: 5. Mai 2010 12:56

### Error in Solution Ex1 houghtransform.m?

Dear all,

In the solution of houghtransform.m Line 29 we map the continues Value rho into the predefined bins with

m = round((nBinsRho-1)*(rho+D)/(2*D))+1;

why do we use round and not floor here? e.g. for
nBinsRho = 10
D = 1000
So Intervall is: 1: -1000 -> -801, 2: -800 -> -601, 3: -600 -> -401, 4: -400 -> -201, 5: -200 -> -1, 6: 0 -> 199, 7: 200 -> 399, 8: 400 -> 599, 9: 600 -> 799, 10: 800 -> 1000

If i try with matlab:

>> nBinsRho = 10

nBinsRho =

10

>> D = 1000

D =

1000

>> rho = -850

rho =

-850

>> m = round((nBinsRho-1)*(rho+D)/(2*D))+1;
>> m

m =

2

>>
This seems to produce wrong values due to not using floor or am i incorrect?

Thank u in advance and best regards,

alex

schwanal
Erstie
Beiträge: 20
Registriert: 5. Mai 2010 12:56

### Re: Error in Solution Ex1 houghtransform.m?

Another Problem seems to be in line 50 and 51:

Code: Alles auswählen

                vRho = [vRho, (-D + 2*D * (m-1)/(nBinsRho-1))];
vTheta = [vTheta, (-pi/2 + pi * (n-1)/(nBinsTheta-1))];

mustnt it be (m-0.5) respective (n-0.5) if I refeer to silde 7/8 in slides_ex1.pdf?

diane
Windoof-User
Beiträge: 25
Registriert: 21. Jun 2009 17:33