@@ -1194,6 +1194,47 @@ def moments(image, moment = MOMENT.FIRST_ORDER):
1194
1194
safe_call (backend .get ().af_moments (c_pointer (output .arr ), image .arr , moment .value ))
1195
1195
return output
1196
1196
1197
+ def canny (image ,
1198
+ low_threshold , high_threshold = None ,
1199
+ treshold_type = CANNY_THRESHOLD .MANUAL ,
1200
+ sobel_window = 3 , is_fast = False ):
1201
+ """
1202
+ Canny edge detector.
1203
+
1204
+ Parameters
1205
+ ----------
1206
+ image : af.Array
1207
+ - A 2 D arrayfire array representing an image
1208
+
1209
+ threshold_type : optional: af.CANNY_THRESHOLD. default: af.CANNY_THRESHOLD.MANUAL.
1210
+ Can be one of:
1211
+ - af.CANNY_THRESHOLD.MANUAL
1212
+ - af.CANNY_THRESHOLD.AUTO_OTSU
1213
+
1214
+ low_threshold : required: float.
1215
+ Specifies the % of maximum in gradient image if threshold_type is MANUAL.
1216
+ Specifies the % of auto dervied high value if threshold_type is AUTO_OTSU.
1217
+
1218
+ high_threshold : optional: float. default: None
1219
+ Specifies the % of maximum in gradient image if threshold_type is MANUAL.
1220
+ Ignored if threshold_type is AUTO_OTSU
1221
+
1222
+ sobel_window : optional: int. default: 3
1223
+ Specifies the size of sobel kernel when computing the gradient image.
1224
+
1225
+ Returns
1226
+ --------
1227
+
1228
+ out : af.Array
1229
+ - A binary image containing the edges
1230
+
1231
+ """
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 )))
1236
+ return output
1237
+
1197
1238
def is_image_io_available ():
1198
1239
"""
1199
1240
Function to check if the arrayfire library was built with Image IO support.
0 commit comments