Formatting

This commit is contained in:
Pieter Holtzhausen
2011-08-22 15:33:26 +02:00
parent 055358bde7
commit 54a9deae47
2 changed files with 6 additions and 7 deletions
+4 -5
View File
@@ -19,7 +19,7 @@ cdef double round(double val):
cdef double PI_2 = 1.5707963267948966
cdef double NEG_PI_2 = -PI_2
@cython.cdivision(True)
@cython.boundscheck(False)
def _hough(np.ndarray img, np.ndarray[ndim=1, dtype=np.double_t] theta=None):
@@ -66,8 +66,8 @@ def _hough(np.ndarray img, np.ndarray[ndim=1, dtype=np.double_t] theta=None):
@cython.boundscheck(False)
def _probabilistic_hough(np.ndarray img, int value_threshold, int line_length, int line_gap, \
np.ndarray[ndim=1, dtype=np.double_t] theta=None):
def _probabilistic_hough(np.ndarray img, int value_threshold, int line_length, \
int line_gap, np.ndarray[ndim=1, dtype=np.double_t] theta=None):
if img.ndim != 2:
raise ValueError('The input image must be 2D.')
# compute the array of angles and their sine and cosine
@@ -110,7 +110,6 @@ def _probabilistic_hough(np.ndarray img, int value_threshold, int line_length, i
mask[y_idxs[i], x_idxs[i]] = 1
while 1:
#for i in range(num_indexes):
# select random non-zero point
count = len(points)
if count == 0:
@@ -141,7 +140,7 @@ def _probabilistic_hough(np.ndarray img, int value_threshold, int line_length, i
b = ctheta[max_theta]
x0 = x
y0 = y
# calculate gradient of walks using fixed point math
# calculate gradient of walks using fixed point math
xflag = fabs(a) > fabs(b)
if xflag:
if a > 0:
+2 -2
View File
@@ -59,7 +59,7 @@ except ImportError:
pass
def probabilistic_hough(img, value_threshold=10, line_length=50, line_gap=10, theta=None):
def probabilistic_hough(img, threshold=10, line_length=50, line_gap=10, theta=None):
"""Performs a progressive probabilistic line Hough transform and returns the detected lines.
Parameters
@@ -84,7 +84,7 @@ def probabilistic_hough(img, value_threshold=10, line_length=50, line_gap=10, th
transform for line detection", in IEEE Computer Society Conference on
Computer Vision and Pattern Recognition, 1999.
"""
return _probabilistic_hough(img, value_threshold, line_length, line_gap, theta)
return _probabilistic_hough(img, threshold, line_length, line_gap, theta)
def hough(img, theta=None):