@@ -1196,7 +1196,7 @@ def moments(image, moment = MOMENT.FIRST_ORDER):
11961196
11971197def canny (image ,
11981198 low_threshold , high_threshold = None ,
1199- treshold_type = CANNY_THRESHOLD .MANUAL ,
1199+ threshold_type = CANNY_THRESHOLD .MANUAL ,
12001200 sobel_window = 3 , is_fast = False ):
12011201 """
12021202 Canny edge detector.
@@ -1230,9 +1230,14 @@ def canny(image,
12301230
12311231 """
12321232 output = Array ()
1233- safe_call (backend .get ().af_canny (c_pointer (output .arr ), threshold_type .value ,
1234- low_threshold , high_threshold and high_threshold .value or 0 ,
1235- c_uint (sobel_window ), c_bool (is_fast )))
1233+ if threshold_type .value == CANNY_THRESHOLD .MANUAL .value :
1234+ assert (high_threshold is not None )
1235+
1236+ high_threshold = high_threshold if high_threshold else 0
1237+ safe_call (backend .get ().af_canny (c_pointer (output .arr ), image .arr ,
1238+ c_int_t (threshold_type .value ),
1239+ c_float_t (low_threshold ), c_float_t (high_threshold ),
1240+ c_uint_t (sobel_window ), c_bool_t (is_fast )))
12361241 return output
12371242
12381243def is_image_io_available ():
0 commit comments