@@ -1196,7 +1196,7 @@ def moments(image, moment = MOMENT.FIRST_ORDER):
1196
1196
1197
1197
def canny (image ,
1198
1198
low_threshold , high_threshold = None ,
1199
- treshold_type = CANNY_THRESHOLD .MANUAL ,
1199
+ threshold_type = CANNY_THRESHOLD .MANUAL ,
1200
1200
sobel_window = 3 , is_fast = False ):
1201
1201
"""
1202
1202
Canny edge detector.
@@ -1230,9 +1230,14 @@ def canny(image,
1230
1230
1231
1231
"""
1232
1232
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 )))
1236
1241
return output
1237
1242
1238
1243
def is_image_io_available ():
0 commit comments