So I'm trying do detect a particular circle in an image, I'm using an openCV function, I tried tweaking the parameters but I'm not happy.
So I'm going to bruteforce the 4 parameters.
To do this I wrote this piece of code wich generates a list containing all the values to try on one parameter :
def paramlistgene(increment, fromvalue, tovalue):
paramlist = [fromvalue]
while paramlist[-1] < tovalue:
paramlist.append(paramlist[-1] + increment)
return paramlist
for example paramlistgene(0.1, 0.1, 20) should generate :
[0.1, 0.2, 0.3, 0.4, 0.5, ..., 20]
but it generates this :
[0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6, 0.7, 0.7999999999999999, 0.8999999999999999, 0.9999999999999999, 1.0999999999999999, 1.2, ...]
Why does this happens?
I tried print 0.1+0.1+0.1 and it does print 0.3.
Thanks