@@ -21,7 +21,7 @@ def gradient(image):
2121def load_image (file_name , is_color = False ):
2222 assert (os .path .isfile (file_name ))
2323 image = Array ()
24- safe_call (clib .af_load_image (ct .pointer (image .arr ), \
24+ safe_call (clib .af_load_image (ct .pointer (image .arr ),
2525 ct .c_char_p (file_name .encode ('ascii' )), is_color ))
2626 return image
2727
@@ -41,15 +41,15 @@ def resize(image, scale=None, odim0=None, odim1=None, method=AF_INTERP_NEAREST):
4141 odim1 = int (scale * idims [1 ])
4242
4343 output = Array ()
44- safe_call (clib .af_resize (ct .pointer (output .arr ),\
44+ safe_call (clib .af_resize (ct .pointer (output .arr ),
4545 image .arr , ct .c_longlong (odim0 ), ct .c_longlong (odim1 ), method ))
4646
4747 return output
4848
4949def transform (image , transform , odim0 = 0 , odim1 = 0 , method = AF_INTERP_NEAREST , is_inverse = True ):
5050 output = Array ()
51- safe_call (clib .af_transform (ct .pointer (output .arr ),\
52- image .arr , transform .arr ,\
51+ safe_call (clib .af_transform (ct .pointer (output .arr ),
52+ image .arr , transform .arr ,
5353 ct .c_longlong (odim0 ), ct .c_longlong (odim1 ), method , is_inverse ))
5454 return output
5555
@@ -60,21 +60,21 @@ def rotate(image, theta, is_crop = True, method = AF_INTERP_NEAREST):
6060
6161def translate (image , trans0 , trans1 , odim0 = 0 , odim1 = 0 , method = AF_INTERP_NEAREST ):
6262 output = Array ()
63- safe_call (clib .af_translate (ct .pointer (output .arr ), \
63+ safe_call (clib .af_translate (ct .pointer (output .arr ),
6464 image .arr , trans0 , trans1 , ct .c_longlong (odim0 ), ct .c_longlong (odim1 ), method ))
6565 return output
6666
6767def scale (image , scale0 , scale1 , odim0 = 0 , odim1 = 0 , method = AF_INTERP_NEAREST ):
6868 output = Array ()
69- safe_call (clib .af_scale (ct .pointer (output .arr ),\
70- image .arr , ct .c_double (scale0 ), ct .c_double (scale1 ),\
69+ safe_call (clib .af_scale (ct .pointer (output .arr ),
70+ image .arr , ct .c_double (scale0 ), ct .c_double (scale1 ),
7171 ct .c_longlong (odim0 ), ct .c_longlong (odim1 ), method ))
7272 return output
7373
7474def skew (image , skew0 , skew1 , odim0 = 0 , odim1 = 0 , method = AF_INTERP_NEAREST , is_inverse = True ):
7575 output = Array ()
76- safe_call (clib .af_skew (ct .pointer (output .arr ),\
77- image .arr , ct .c_double (skew0 ), ct .c_double (skew1 ), \
76+ safe_call (clib .af_skew (ct .pointer (output .arr ),
77+ image .arr , ct .c_double (skew0 ), ct .c_double (skew1 ),
7878 ct .c_longlong (odim0 ), ct .c_longlong (odim1 ), method , is_inverse ))
7979
8080 return output
@@ -90,7 +90,7 @@ def histogram(image, nbins, min_val = None, max_val = None):
9090 max_val = af_max (image )
9191
9292 output = Array ()
93- safe_call (clib .af_histogram (ct .pointer (output .arr ),\
93+ safe_call (clib .af_histogram (ct .pointer (output .arr ),
9494 image .arr , ct .c_uint (nbins ), ct .c_double (min_val ), ct .c_double (max_val )))
9595 return output
9696
@@ -141,32 +141,32 @@ def erode3(image, mask = None):
141141
142142def bilateral (image , s_sigma , c_sigma , is_color = False ):
143143 output = Array ()
144- safe_call (clib .af_bilateral (ct .pointer (output .arr ),\
144+ safe_call (clib .af_bilateral (ct .pointer (output .arr ),
145145 image .arr , ct .c_double (s_sigma ), ct .c_double (c_sigma ), is_color ))
146146 return output
147147
148148def mean_shift (image , s_sigma , c_sigma , n_iter , is_color = False ):
149149 output = Array ()
150- safe_call (clib .af_mean_shift (ct .pointer (output .arr ),\
151- image .arr , ct .c_double (s_sigma ), ct .c_double (c_sigma ),\
150+ safe_call (clib .af_mean_shift (ct .pointer (output .arr ),
151+ image .arr , ct .c_double (s_sigma ), ct .c_double (c_sigma ),
152152 ct .c_uint (n_iter ), is_color ))
153153 return output
154154
155155def medfilt (image , w_len = 3 , w_wid = 3 , edge_pad = AF_PAD_ZERO ):
156156 output = Array ()
157- safe_call (clib .af_medfilt (ct .pointer (output .arr ), \
157+ safe_call (clib .af_medfilt (ct .pointer (output .arr ),
158158 image .arr , ct .c_longlong (w_len ), ct .c_longlong (w_wid ), edge_pad ))
159159 return output
160160
161161def minfilt (image , w_len = 3 , w_wid = 3 , edge_pad = AF_PAD_ZERO ):
162162 output = Array ()
163- safe_call (clib .af_minfilt (ct .pointer (output .arr ), \
163+ safe_call (clib .af_minfilt (ct .pointer (output .arr ),
164164 image .arr , ct .c_longlong (w_len ), ct .c_longlong (w_wid ), edge_pad ))
165165 return output
166166
167167def maxfilt (image , w_len = 3 , w_wid = 3 , edge_pad = AF_PAD_ZERO ):
168168 output = Array ()
169- safe_call (clib .af_maxfilt (ct .pointer (output .arr ), \
169+ safe_call (clib .af_maxfilt (ct .pointer (output .arr ),
170170 image .arr , ct .c_longlong (w_len ), ct .c_longlong (w_wid ), edge_pad ))
171171 return output
172172
@@ -178,7 +178,7 @@ def regions(image, connectivity = AF_CONNECTIVITY_4, out_type = f32):
178178def sobel_derivatives (image , w_len = 3 ):
179179 dx = Array ()
180180 dy = Array ()
181- safe_call (clib .af_sobel_operator (ct .pointer (dx .arr ), ct .pointer (dy .arr ),\
181+ safe_call (clib .af_sobel_operator (ct .pointer (dx .arr ), ct .pointer (dy .arr ),
182182 image .arr , ct .c_uint (w_len )))
183183 return dx ,dy
184184
@@ -194,13 +194,13 @@ def sobel_filter(image, w_len = 3, is_fast = False):
194194
195195def rgb2gray (image , r_factor = 0.2126 , g_factor = 0.7152 , b_factor = 0.0722 ):
196196 output = Array ()
197- safe_call (clib .af_rgb2gray (ct .pointer (output .arr ), \
197+ safe_call (clib .af_rgb2gray (ct .pointer (output .arr ),
198198 image .arr , ct .c_float (r_factor ), ct .c_float (g_factor ), ct .c_float (b_factor )))
199199 return output
200200
201201def gray2rgb (image , r_factor = 1.0 , g_factor = 1.0 , b_factor = 1.0 ):
202202 output = Array ()
203- safe_call (clib .af_gray2rgb (ct .pointer (output .arr ), \
203+ safe_call (clib .af_gray2rgb (ct .pointer (output .arr ),
204204 image .arr , ct .c_float (r_factor ), ct .c_float (g_factor ), ct .c_float (b_factor )))
205205 return output
206206
0 commit comments