Guest User

Untitled

a guest
Jul 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. for i in range (0, edges.height):
  2.     for j in range (0, edges.width):
  3. #        perpendicular = math.atan2(dx[i][j], dy[i][j])
  4.         perpendicular = float (math.atan2(cv.Get2D(dx, i, j)[0], cv.Get2D(dy, i, j)[0]))
  5.         slope = math.tan(math.pi/2.0 + perpendicular)
  6.         for cy in range (0, edges.height):
  7.             cx = int ((i-cy)*-1*slope / math.pow(a, 2) + j)
  8.             ry = int (math.sqrt(a*a*math.pow(j-cx, 2) + math.pow(i-cy, 2)))
  9.             if cx >= 0 and cx < edges.width and cy >= 0 and cy < edges.height and ry <= edges.height/2 :
  10.                 votes[cx][cy][ry] += 1
  11.                 if votes[cx][cy][ry] > maxVote:
  12.                     maxVote = votes[cx][cy][ry]
  13.                     maxCx = cx
  14.                     maxCy = cy
  15.                     maxRy = ry
Add Comment
Please, Sign In to add comment