Skip to content

Instantly share code, notes, and snippets.

@vbalnt
Created May 29, 2016 19:35
Show Gist options
  • Save vbalnt/a203fd7aaf4d52748ffd53c14f945b73 to your computer and use it in GitHub Desktop.
Save vbalnt/a203fd7aaf4d52748ffd53c14f945b73 to your computer and use it in GitHub Desktop.
Original code from openCV to create the tests that are included in their version of the descriptor. Taken from an old openCV repo.
tests = int(sys.argv[1])
S = 32 # patch size
S2 = S / 2 # Clamp sample coordinates to this
sigma = S / 5.0 # Sampling geometry II
random.seed(42) # Make repeatable for simplicity
def random_coordinate():
coord = int(round(random.gauss(0.0, sigma)))
return min(max(coord, -S2 + 1), S2)+S2-1
for i in range(tests):
x1 = random_coordinate();
y1 = random_coordinate();
x2 = random_coordinate();
y2 = random_coordinate();
print ’# x1,y1,x2 y2’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment