1 /** \file
2  * \brief Image Processing - Local Operations
3  *
4  * See Copyright Notice in im_lib.h
5  */
6 module im.im_process_loc;
7 
8 version(IM) :
9 
10 import im.im_image : imImage;
11 
12 //version(DigitalMars) version(Windows) { pragma(lib, "im.lib"); } // required anyway
13 
14 extern(C) @nogc nothrow :
15 
16 
17 /** \defgroup resize Image Resize
18  * \par
19  * Operations to change the image size. \n
20  * All size operations include the alpha channel if any.
21  * \par
22  * See \ref im_process_loc.h
23  * \ingroup process */
24 
25 /** Only reduze the image size using the given decimation order. \n
26  * Supported decimation orders:
27  * \li 0 - zero order (mean) [default in Lua for MAP and BINARY]
28  * \li 1 - first order (bilinear decimation)  [default in Lua]
29  * Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0. \n
30  * Returns zero if the counter aborted.
31  *
32  * \verbatim im.ProcessReduce(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5] \endverbatim
33  * \verbatim im.ProcessReduceNew(image: imImage, width, height[, order]: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
34  * \ingroup resize */
35 int imProcessReduce(const(imImage)* src_image, imImage* dst_image, int order);
36 
37 /** Change the image size using the given interpolation order. \n
38  * Supported interpolation orders:
39  * \li 0 - zero order (near neighborhood) [default in Lua for MAP and BINARY]
40  * \li 1 - first order (bilinear interpolation) [default in Lua]
41  * \li 3 - third order (bicubic interpolation)
42  * Images must be of the same type. If image type is IM_MAP or IM_BINARY, must use order=0. \n
43  * Returns zero if the counter aborted.
44  *
45  * \verbatim im.ProcessResize(src_image: imImage, dst_image: imImage, order: number) -> counter: boolean [in Lua 5] \endverbatim
46  * \verbatim im.ProcessResizeNew(image: imImage, width, height[, order]: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
47  * \ingroup resize */
48 int imProcessResize(const(imImage)* src_image, imImage* dst_image, int order);
49 
50 /** Reduze the image area by 4 (w/2,h/2). \n
51  * Images must be of the same type. Target image size must be source image width/2, height/2.
52  * Can not operate on IM_MAP nor IM_BINARY images.
53  *
54  * \verbatim im.ProcessReduceBy4(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
55  * \verbatim im.ProcessReduceBy4New(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
56  * \ingroup resize */
57 void imProcessReduceBy4(const(imImage)* src_image, imImage* dst_image);
58 
59 /** Extract a rectangular region from an image. \n
60  * Images must be of the same type. Target image size must be smaller than source image width-xmin, height-ymin. \n
61  * ymin and xmin must be >0 and <size.
62  *
63  * \verbatim im.ProcessCrop(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
64  * \verbatim im.ProcessCropNew(image: imImage, xmin, xmax, ymin, ymax: number) -> new_image: imImage [in Lua 5] \endverbatim
65  * \ingroup resize */
66 void imProcessCrop(const(imImage)* src_image, imImage* dst_image, int xmin, int ymin);
67 
68 /** Insert a rectangular region in an image. \n
69  * Images must be of the same type. Region image size can be larger than source image. \n
70  * ymin and xmin must be >0 and <size. \n
71  * Source and target must be of the same size. Can be done in-place.
72  *
73  * \verbatim im.ProcessInsert(src_image: imImage, region_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
74  * \verbatim im.ProcessInsertNew(image: imImage, region_image: imImage, xmin: number, ymin: number) -> new_image: imImage [in Lua 5] \endverbatim
75  * \ingroup resize */
76 void imProcessInsert(const(imImage)* src_image, const(imImage)* region_image, imImage* dst_image, int xmin, int ymin);
77 
78 /** Increase the image size by adding pixels with zero value. \n
79  * Images must be of the same type. Target image size must be greatter or equal than source image width+xmin, height+ymin.
80  *
81  * \verbatim im.ProcessAddMargins(src_image: imImage, dst_image: imImage, xmin: number, ymin: number) [in Lua 5] \endverbatim
82  * \verbatim im.ProcessAddMarginsNew(image: imImage, xmin, xmax, ymin, ymax: number) -> new_image: imImage [in Lua 5] \endverbatim
83  * \ingroup resize */
84 void imProcessAddMargins(const(imImage)* src_image, imImage* dst_image, int xmin, int ymin);
85 
86 
87 
88 /** \defgroup geom Geometric Operations
89  * \par
90  * Operations to change the shape of the image. \n
91  * All geometric operations include the alpha channel if any.
92  * \par
93  * See \ref im_process_loc.h
94  * \ingroup process */
95 
96 /** Calculates the size of the new image after rotation.
97  *
98  * \verbatim im.ProcessCalcRotateSize(width: number, height: number, cos0: number, sin0: number) [in Lua 5] \endverbatim
99  * \ingroup geom */
100 void imProcessCalcRotateSize(int width, int height, int* new_width, int* new_height, double cos0, double sin0);
101 
102 /** Rotates the image using the given interpolation order (see \ref imProcessResize). \n
103  * Images must be of the same type. The target size can be calculated using \ref imProcessCalcRotateSize to fit the new image size, 
104  * or can be any size, including the original size. The rotation is relative to the center of the image. \n
105  * Returns zero if the counter aborted.
106  *
107  * \verbatim im.ProcessRotate(src_image: imImage, dst_image: imImage, cos0: number, sin0: number[, order]: number) -> counter: boolean [in Lua 5] \endverbatim
108  * \verbatim im.ProcessRotateNew(image: imImage, cos0, sin0, order: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
109  * \ingroup geom */
110 int imProcessRotate(const(imImage)* src_image, imImage* dst_image, double cos0, double sin0, int order);
111 
112 /** Rotates the image using the given interpolation order (see \ref imProcessResize). \n
113  * Images must be of the same type. Target can have any size, including the original size. \n
114  * The rotation is relative to the reference point. But the result can be shifted to the origin. \n
115  * Returns zero if the counter aborted.
116  *
117  * \verbatim im.ProcessRotateRef(src_image: imImage, dst_image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean, order: number) -> counter: boolean [in Lua 5] \endverbatim
118  * \verbatim im.ProcessRotateRefNew(image: imImage, cos0: number, sin0: number, x: number, y: number, to_origin: boolean[, order]: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
119  * \ingroup geom */
120 int imProcessRotateRef(const(imImage)* src_image, imImage* dst_image, double cos0, double sin0, int x, int y, int to_origin, int order);
121 
122 /** Rotates the image in 90 degrees counterclockwise or clockwise. Swap columns by lines. \n
123  * Images must be of the same type. Target width and height must be source height and width. \n
124  * Direction can be clockwise (1) or counter clockwise (-1).
125  *
126  * \verbatim im.ProcessRotate90(src_image: imImage, dst_image: imImage, dir_clockwise: boolean) [in Lua 5] \endverbatim
127  * \verbatim im.ProcessRotate90New(image: imImage, dir_clockwise: boolean) -> new_image: imImage [in Lua 5] \endverbatim
128  * \ingroup geom */
129 void imProcessRotate90(const(imImage)* src_image, imImage* dst_image, int dir_clockwise);
130 
131 /** Rotates the image in 180 degrees. Swap columns and swap lines. \n
132  * Images must be of the same type and size.
133  *
134  * \verbatim im.ProcessRotate180(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
135  * \verbatim im.ProcessRotate180New(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
136  * \ingroup geom */
137 void imProcessRotate180(const(imImage)* src_image, imImage* dst_image);
138 
139 /** Mirror the image in a horizontal flip. Swap columns. \n
140  * Images must be of the same type and size.
141  * Can be done in-place.
142  *
143  * \verbatim im.ProcessMirror(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
144  * \verbatim im.ProcessMirrorNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
145  * \ingroup geom */
146 void imProcessMirror(const(imImage)* src_image, imImage* dst_image);
147 
148 /** Apply a vertical flip. Swap lines. \n
149  * Images must be of the same type and size.
150  * Can be done in-place.
151  *
152  * \verbatim im.ProcessFlip(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
153  * \verbatim im.ProcessFlipNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
154  * \ingroup geom */
155 void imProcessFlip(const(imImage)* src_image, imImage* dst_image);
156 
157 /** Apply a radial distortion using the given interpolation order (see imProcessResize). \n
158  * Images must be of the same type and size. Returns zero if the counter aborted.
159  *
160  * \verbatim im.ProcessRadial(src_image: imImage, dst_image: imImage, k1: number, order: number) -> counter: boolean [in Lua 5] \endverbatim
161  * \verbatim im.ProcessRadialNew(image: imImage, k1: number[, order]: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
162  * \ingroup geom */
163 int imProcessRadial(const(imImage)* src_image, imImage* dst_image, float k1, int order);
164 
165 /** Apply a swirl distortion using the given interpolation order (see imProcessResize). \n
166  * Images must be of the same type and size. Returns zero if the counter aborted.
167  *
168  * \verbatim im.ProcessSwirl(src_image: imImage, dst_image: imImage, k: number, order: number) -> counter: boolean [in Lua 5] \endverbatim
169  * \verbatim im.ProcessSwirlNew(image: imImage, k: number[, order]: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
170  * \ingroup geom */
171 int imProcessSwirl(const(imImage)* src_image, imImage* dst_image, float k1, int order);
172 
173 /** Split the image in two images, one containing the odd lines and other containing the even lines. \n
174  * Images must be of the same type. Height of the output images must be half the height of the input image.
175  * If the height of the input image is odd then the first image must have height equals to half+1.
176  *
177  * \verbatim im.ProcessInterlaceSplit(src_image: imImage, dst_image1: imImage, dst_image2: imImage) [in Lua 5] \endverbatim
178  * \verbatim im.ProcessInterlaceSplitNew(image: imImage) -> new_image1: imImage, new_image2: imImage [in Lua 5] \endverbatim
179  * \ingroup geom */
180 void imProcessInterlaceSplit(const(imImage)* src_image, imImage* dst_image1, imImage* dst_image2);
181 
182 
183 
184 /** \defgroup morphgray Morphology Operations for Gray Images
185  * \par
186  * See \ref im_process_loc.h
187  * \ingroup process */
188 
189 /** Base gray morphology convolution. \n
190  * Supports all data types except complex. Can be applied on color images. \n
191  * Kernel is always IM_INT. Use kernel size odd for better results. \n
192  * Use -1 for don't care positions in kernel. Kernel values are added to image values, then \n
193  * you can use the maximum or the minimum within the kernel area. \n
194  * No border extensions are used. 
195  * All the gray morphology operations use this function. \n
196  * If the kernel image attribute "Description" exists it is used by the counter.
197  *
198  * \verbatim im.ProcessGrayMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean [in Lua 5] \endverbatim
199  * \verbatim im.ProcessGrayMorphConvolveNew(image: imImage, kernel: imImage, ismax: boolean) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
200  * \ingroup morphgray */
201 int imProcessGrayMorphConvolve(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel, int ismax);
202 
203 /** Gray morphology convolution with a kernel full of "0"s and use minimum value.
204  *
205  * \verbatim im.ProcessGrayMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
206  * \verbatim im.ProcessGrayMorphErodeNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
207  * \ingroup morphgray */
208 int imProcessGrayMorphErode(const(imImage)* src_image, imImage* dst_image, int kernel_size);
209 
210 /** Gray morphology convolution with a kernel full of "0"s and use maximum value.
211  *
212  * \verbatim im.ProcessGrayMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
213  * \verbatim im.ProcessGrayMorphDilateNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
214  * \ingroup morphgray */
215 int imProcessGrayMorphDilate(const(imImage)* src_image, imImage* dst_image, int kernel_size);
216 
217 /** Erode+Dilate.
218  *
219  * \verbatim im.ProcessGrayMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
220  * \verbatim im.ProcessGrayMorphOpenNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
221  * \ingroup morphgray */
222 int imProcessGrayMorphOpen(const(imImage)* src_image, imImage* dst_image, int kernel_size);
223 
224 /** Dilate+Erode.
225  *
226  * \verbatim im.ProcessGrayMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
227  * \verbatim im.ProcessGrayMorphCloseNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
228  * \ingroup morphgray */
229 int imProcessGrayMorphClose(const(imImage)* src_image, imImage* dst_image, int kernel_size);
230 
231 /** Open+Difference.
232  *
233  * \verbatim im.ProcessGrayMorphTopHat(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
234  * \verbatim im.ProcessGrayMorphTopHatNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
235  * \ingroup morphgray */
236 int imProcessGrayMorphTopHat(const(imImage)* src_image, imImage* dst_image, int kernel_size);
237 
238 /** Close+Difference.
239  *
240  * \verbatim im.ProcessGrayMorphWell(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
241  * \verbatim im.ProcessGrayMorphWellNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
242  * \ingroup morphgray */
243 int imProcessGrayMorphWell(const(imImage)* src_image, imImage* dst_image, int kernel_size);
244 
245 /** Difference(Erode, Dilate).
246  *
247  * \verbatim im.ProcessGrayMorphGradient(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
248  * \verbatim im.ProcessGrayMorphGradientNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
249  * \ingroup morphgray */
250 int imProcessGrayMorphGradient(const(imImage)* src_image, imImage* dst_image, int kernel_size);
251 
252 
253 
254 /** \defgroup morphbin Morphology Operations for Binary Images
255  * \par
256  * See \ref im_process_loc.h
257  * \ingroup process */
258 
259 /** Base binary morphology convolution. \n
260  * Images are all IM_BINARY. Kernel is IM_INT, but values can be only 1, 0 or -1. Use kernel size odd for better results. \n
261  * Hit white means hit=1 and miss=0, or else hit=0 and miss=1. \n
262  * Use -1 for don't care positions in kernel. Kernel values are simply compared with image values. \n
263  * The operation can be repeated by a number of iterations.
264  * The border is zero extended. \n
265  * Almost all the binary morphology operations use this function.\n
266  * If the kernel image attribute "Description" exists it is used by the counter.
267  *
268  * \verbatim im.ProcessBinMorphConvolve(src_image: imImage, dst_image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean [in Lua 5] \endverbatim
269  * \verbatim im.ProcessBinMorphConvolveNew(image: imImage, kernel: imImage, hit_white: boolean, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
270  * \ingroup morphbin */
271 int imProcessBinMorphConvolve(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel, int hit_white, int iter);
272 
273 /** Binary morphology convolution with a kernel full of "1"s and hit white.
274  *
275  * \verbatim im.ProcessBinMorphErode(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
276  * \verbatim im.ProcessBinMorphErodeNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
277  * \ingroup morphbin */
278 int imProcessBinMorphErode(const(imImage)* src_image, imImage* dst_image, int kernel_size, int iter);
279 
280 /** Binary morphology convolution with a kernel full of "0"s and hit black.
281  *
282  * \verbatim im.ProcessBinMorphDilate(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
283  * \verbatim im.ProcessBinMorphDilateNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
284  * \ingroup morphbin */
285 int imProcessBinMorphDilate(const(imImage)* src_image, imImage* dst_image, int kernel_size, int iter);
286 
287 /** Erode+Dilate.
288  * When iteration is more than one it means Erode+Erode+Erode+...+Dilate+Dilate+Dilate+...
289  *
290  * \verbatim im.ProcessBinMorphOpen(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
291  * \verbatim im.ProcessBinMorphOpenNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
292  * \ingroup morphbin */
293 int imProcessBinMorphOpen(const(imImage)* src_image, imImage* dst_image, int kernel_size, int iter);
294 
295 /** Dilate+Erode.
296  *
297  * \verbatim im.ProcessBinMorphClose(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
298  * \verbatim im.ProcessBinMorphCloseNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
299  * \ingroup morphbin */
300 int imProcessBinMorphClose(const(imImage)* src_image, imImage* dst_image, int kernel_size, int iter);
301 
302 /** Erode+Difference. \n
303  * The difference from the source image is applied only once.
304  *
305  * \verbatim im.ProcessBinMorphOutline(src_image: imImage, dst_image: imImage, kernel_size: number, iter: number) -> counter: boolean [in Lua 5] \endverbatim
306  * \verbatim im.ProcessBinMorphOutlineNew(image: imImage, kernel_size: number, iter: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
307  * \ingroup morphbin */
308 int imProcessBinMorphOutline(const(imImage)* src_image, imImage* dst_image, int kernel_size, int iter);
309 
310 /** Thins the supplied binary image using Rosenfeld's parallel thinning algorithm. \n
311  * Reference: \n
312  * "Efficient Binary Image Thinning using Neighborhood Maps" \n
313  * by Joseph M. Cychosz, 3ksnn64@ecn.purdue.edu              \n
314  * in "Graphics Gems IV", Academic Press, 1994               \n
315  * Not using OpenMP when enabled.
316  *
317  * \verbatim im.ProcessBinMorphThin(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
318  * \verbatim im.ProcessBinMorphThinNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
319  * \ingroup morphbin */
320 void imProcessBinMorphThin(const(imImage)* src_image, imImage* dst_image);
321 
322 
323 
324 /** \defgroup rank Rank Convolution Operations
325  * \par
326  * All the rank convolution use the same base function. Near the border the base function
327  * includes only the real image pixels in the rank. No border extensions are used.
328  * \par
329  * See \ref im_process_loc.h
330  * \ingroup process */
331 
332 /** Rank convolution using the median value. \n
333  * Returns zero if the counter aborted. \n
334  * Supports all data types except complex. Can be applied on color images.
335  *
336  * \verbatim im.ProcessMedianConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
337  * \verbatim im.ProcessMedianConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
338  * \ingroup rank */
339 int imProcessMedianConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
340 
341 /** Rank convolution using (maximum-minimum) value. \n
342  * Returns zero if the counter aborted. \n
343  * Supports all data types except complex. Can be applied on color images.
344  *
345  * \verbatim im.ProcessRangeConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
346  * \verbatim im.ProcessRangeConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
347  * \ingroup rank */
348 int imProcessRangeConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
349 
350 /** Rank convolution using the closest maximum or minimum value. \n
351  * Returns zero if the counter aborted. \n
352  * Supports all data types except complex. Can be applied on color images.
353  *
354  * \verbatim im.ProcessRankClosestConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
355  * \verbatim im.ProcessRankClosestConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
356  * \ingroup rank */
357 int imProcessRankClosestConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
358 
359 /** Rank convolution using the maximum value. \n
360  * Returns zero if the counter aborted. \n
361  * Supports all data types except complex. Can be applied on color images.
362  *
363  * \verbatim im.ProcessRankMaxConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
364  * \verbatim im.ProcessRankMaxConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
365  * \ingroup rank */
366 int imProcessRankMaxConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
367 
368 /** Rank convolution using the minimum value. \n
369  * Returns zero if the counter aborted. \n
370  * Supports all data types except complex. Can be applied on color images.
371  *
372  * \verbatim im.ProcessRankMinConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
373  * \verbatim im.ProcessRankMinConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
374  * \ingroup rank */
375 int imProcessRankMinConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
376 
377 /** Threshold using a rank convolution with a range contrast function. \n
378  * Supports all integer IM_GRAY images as source, and IM_BINARY as target. \n
379  * Local variable threshold by the method of Bernsen. \n
380  * Extracted from XITE, Copyright 1991, Blab, UiO \n
381  * http://www.ifi.uio.no/~blab/Software/Xite/
382 \verbatim
383   Reference:
384     Bernsen, J: "Dynamic thresholding of grey-level images"
385 		Proc. of the 8th ICPR, Paris, Oct 1986, 1251-1255.
386   Author:     Oivind Due Trier
387 \endverbatim
388  * Returns zero if the counter aborted.
389  *
390  * \verbatim im.ProcessRangeContrastThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_range: number) -> counter: boolean [in Lua 5] \endverbatim
391  * \verbatim im.ProcessRangeContrastThresholdNew(image: imImage, kernel_size: number, min_range: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
392  * \ingroup threshold */
393 int imProcessRangeContrastThreshold(const(imImage)* src_image, imImage* dst_image, int kernel_size, int min_range);
394 
395 /** Threshold using a rank convolution with a local max function.  \n
396  * Returns zero if the counter aborted. \n
397  * Supports all integer IM_GRAY images as source, and IM_BINARY as target.
398  *
399  * \verbatim im.ProcessLocalMaxThreshold(src_image: imImage, dst_image: imImage, kernel_size: number, min_level: number) -> counter: boolean [in Lua 5] \endverbatim
400  * \verbatim im.ProcessLocalMaxThresholdNew(image: imImage, kernel_size: number, min_level: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
401  * \ingroup threshold */
402 int imProcessLocalMaxThreshold(const(imImage)* src_image, imImage* dst_image, int kernel_size, int min_level);
403 
404 
405 
406 /** \defgroup convolve Convolution Operations
407  * \par
408  * See \ref im_process_loc.h
409  * \ingroup process */
410 
411 /** Base Convolution with a kernel. \n
412  * Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results. \n
413  * Supports all data types. The border is mirrored. \n
414  * Returns zero if the counter aborted. Most of the convolutions use this function.\n
415  * If the kernel image attribute "Description" exists it is used by the counter.
416  *
417  * \verbatim im.ProcessConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
418  * \verbatim im.ProcessConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
419  * \ingroup convolve */
420 int imProcessConvolve(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel);
421 
422 /** Base convolution when the kernel is separable. Only the first line and the first column will be used. \n
423  * Returns zero if the counter aborted.\n
424  * If the kernel image attribute "Description" exists it is used by the counter.
425  *
426  * \verbatim im.ProcessConvolveSep(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
427  * \verbatim im.ProcessConvolveSepNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
428  * \ingroup convolve */
429 int imProcessConvolveSep(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel);
430 
431 /** Base Convolution with two kernels. The result is the magnitude of the result of each convolution. \n
432  * Kernel can be IM_INT or IM_FLOAT, but always IM_GRAY. Use kernel size odd for better results. \n
433  * Supports all data types. The border is mirrored. \n
434  * Returns zero if the counter aborted. Most of the convolutions use this function.\n
435  * If the kernel image attribute "Description" exists it is used by the counter.
436  *
437  * \verbatim im.ProcessConvolveDual(src_image: imImage, dst_image: imImage, kernel1, kernel2: imImage) -> counter: boolean [in Lua 5] \endverbatim
438  * \verbatim im.ProcessConvolveDualNew(image: imImage, kernel1, kernel2: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
439  * \ingroup convolve */
440 int imProcessConvolveDual(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel1, const(imImage)* kernel2);
441 
442 /** Repeats the convolution a number of times. \n
443  * Returns zero if the counter aborted.\n
444  * If the kernel image attribute "Description" exists it is used by the counter.
445  *
446  * \verbatim im.ProcessConvolveRep(src_image: imImage, dst_image: imImage, kernel: imImage, count: number) -> counter: boolean [in Lua 5] \endverbatim
447  * \verbatim im.ProcessConvolveRepNew(image: imImage, kernel: imImage, count: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
448  * \ingroup convolve */
449 int imProcessConvolveRep(const(imImage)* src_image, imImage* dst_image, const(imImage)* kernel, int count);
450 
451 /** Convolve with a kernel rotating it 8 times and getting the absolute maximum value. \n
452  * Kernel must be square. \n
453  * The rotation is implemented only for kernel sizes 3x3, 5x5 and 7x7. \n
454  * Supports all data types except complex.
455  * Returns zero if the counter aborted.\n
456  * If the kernel image attribute "Description" exists it is used by the counter.
457  *
458  * \verbatim im.ProcessCompassConvolve(src_image: imImage, dst_image: imImage, kernel: imImage) -> counter: boolean [in Lua 5] \endverbatim
459  * \verbatim im.ProcessCompassConvolveNew(image: imImage, kernel: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
460  * \ingroup convolve */
461 int imProcessCompassConvolve(const(imImage)* src_image, imImage* dst_image, imImage* kernel);
462 
463 /** Utility function to rotate a kernel one time.
464  *
465  * \verbatim im.ProcessRotateKernel(kernel: imImage) [in Lua 5] \endverbatim
466  * \ingroup convolve */
467 void imProcessRotateKernel(imImage* kernel);
468 
469 /** Difference(Gaussian1, Gaussian2). \n
470  * Supports all data types,
471  * but if source is IM_BYTE or IM_USHORT target image must be of type IM_INT.
472  *
473  * \verbatim im.ProcessDiffOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev1: number, stddev2: number) -> counter: boolean [in Lua 5] \endverbatim
474  * \verbatim im.ProcessDiffOfGaussianConvolveNew(image: imImage, stddev1: number, stddev2: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
475  * \ingroup convolve */
476 int imProcessDiffOfGaussianConvolve(const(imImage)* src_image, imImage* dst_image, float stddev1, float stddev2);
477 
478 /** Convolution with a laplacian of a gaussian kernel. \n
479  * Supports all data types,
480  * but if source is IM_BYTE or IM_USHORT target image must be of type IM_INT.
481  *
482  * \verbatim im.ProcessLapOfGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
483  * \verbatim im.ProcessLapOfGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
484  * \ingroup convolve */
485 int imProcessLapOfGaussianConvolve(const(imImage)* src_image, imImage* dst_image, float stddev);
486 
487 /** Convolution with a kernel full of "1"s inside a circle. \n
488  * Supports all data types.
489  *
490  * \verbatim im.ProcessMeanConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
491  * \verbatim im.ProcessMeanConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
492  * \ingroup convolve */
493 int imProcessMeanConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
494 
495 /** Convolution with a float gaussian kernel. \n
496  * If sdtdev is negative its magnitude will be used as the kernel size. \n
497  * Supports all data types.
498  *
499  * \verbatim im.ProcessGaussianConvolve(src_image: imImage, dst_image: imImage, stddev: number) -> counter: boolean [in Lua 5] \endverbatim
500  * \verbatim im.ProcessGaussianConvolveNew(image: imImage, stddev: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
501  * \ingroup convolve */
502 int imProcessGaussianConvolve(const(imImage)* src_image, imImage* dst_image, float stddev);
503 
504 /** Convolution with a barlett kernel. \n
505  * Supports all data types.
506  *
507  * \verbatim im.ProcessBarlettConvolve(src_image: imImage, dst_image: imImage, kernel_size: number) -> counter: boolean [in Lua 5] \endverbatim
508  * \verbatim im.ProcessBarlettConvolveNew(image: imImage, kernel_size: number) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
509  * \ingroup convolve */
510 int imProcessBarlettConvolve(const(imImage)* src_image, imImage* dst_image, int kernel_size);
511 
512 /** Magnitude of the sobel convolution. \n
513  * Supports all data types.
514  *
515  * \verbatim im.ProcessSobelConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
516  * \verbatim im.ProcessSobelConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
517  * \ingroup convolve */
518 int imProcessSobelConvolve(const(imImage)* src_image, imImage* dst_image);
519 
520 /** Magnitude of the prewitt convolution. \n
521  * Supports all data types.
522  *
523  * \verbatim im.ProcessPrewittConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
524  * \verbatim im.ProcessPrewittConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
525  * \ingroup convolve */
526 int imProcessPrewittConvolve(const(imImage)* src_image, imImage* dst_image);
527 
528 /** Spline edge dectection. \n
529  * Supports all data types.
530  *
531  * \verbatim im.ProcessSplineEdgeConvolve(src_image: imImage, dst_image: imImage) -> counter: boolean [in Lua 5] \endverbatim
532  * \verbatim im.ProcessSplineEdgeConvolveNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] \endverbatim
533  * \ingroup convolve */
534 int imProcessSplineEdgeConvolve(const(imImage)* src_image, imImage* dst_image);
535 
536 /** Finds the zero crossings of IM_SHORT, IM_INT, IM_FLOAT and IM_DOUBLE images. Crossings are marked with non zero values
537  * indicating the intensity of the edge. It is usually used after a second derivative, laplace. \n
538  * Extracted from XITE, Copyright 1991, Blab, UiO \n
539  * http://www.ifi.uio.no/~blab/Software/Xite/
540  *
541  * \verbatim im.ProcessZeroCrossing(src_image: imImage, dst_image: imImage) [in Lua 5] \endverbatim
542  * \verbatim im.ProcessZeroCrossingNew(image: imImage) -> new_image: imImage [in Lua 5] \endverbatim
543  * \ingroup convolve */
544 void imProcessZeroCrossing(const(imImage)* src_image, imImage* dst_image);
545 
546 /** First part of the Canny edge detector. Includes the gaussian filtering and the nonmax suppression. \n
547  * After using this you could apply a Hysteresis Threshold, see \ref imProcessHysteresisThreshold. \n
548  * Image must be IM_BYTE/IM_GRAY. \n
549  * Implementation from the book:
550  \verbatim
551     J. R. Parker
552     "Algoritms for Image Processing and Computer Vision"
553     WILEY
554  \endverbatim
555  *
556  * \verbatim im.ProcessCanny(src_image: imImage, dst_image: imImage, stddev: number) [in Lua 5] \endverbatim
557  * \verbatim im.ProcessCannyNew(image: imImage, stddev: number) -> new_image: imImage [in Lua 5] \endverbatim
558  * \ingroup convolve */
559 void imProcessCanny(const(imImage)* src_image, imImage* dst_image, float stddev);
560 
561 /** Calculates the kernel size given the standard deviation. \n
562  * If sdtdev is negative its magnitude will be used as the kernel size.
563  *
564  * \verbatim im.GaussianStdDev2KernelSize(stddev: number) -> kernel_size: number [in Lua 5] \endverbatim
565  * \ingroup convolve */
566 int imGaussianStdDev2KernelSize(float stddev);
567 
568 /** Calculates the standard deviation given the kernel size.
569  *
570  * \verbatim im.GaussianKernelSize2StdDev(kernel_size: number) -> stddev: number [in Lua 5] \endverbatim
571  * \ingroup convolve */
572 float imGaussianKernelSize2StdDev(int kernel_size);
573 
574 /** Edge enhancement using Unsharp mask. stddev control the gaussian filter,
575  *  amount controls how much the edges will enhance the image (0<amount<1), and
576  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
577  *  Although very similar to \ref imProcessSharp, produces better results.
578  *
579  * \verbatim im.ProcessUnsharp(src_image: imImage, dst_image: imImage, stddev: number, amount: number, threshold: number) [in Lua 5] \endverbatim
580  * \verbatim im.ProcessUnsharpNew(image: imImage, stddev: number, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
581  * \ingroup convolve */
582 int imProcessUnsharp(const(imImage)* src_image, imImage* dst_image, float stddev, float amount, float threshold);
583 
584 /** Edge enhancement using Laplacian8 mask.
585  *  amount controls how much the edges will enhance the image (0<amount<1), and
586  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
587  *
588  * \verbatim im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] \endverbatim
589  * \verbatim im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
590  * \ingroup convolve */
591 int imProcessSharp(const(imImage)* src_image, imImage* dst_image, float amount, float threshold);
592 
593 /** Edge enhancement using a given kernel.
594  *  If kernel has all positive values, then the unsharp technique is used, else sharp is used.
595  *  amount controls how much the edges will enhance the image (0<amount<1), and
596  *  threshold controls which edges will be considered, it compares to twice of the absolute size of the edge.
597  *
598  * \verbatim im.ProcessSharp(src_image: imImage, dst_image: imImage, amount: number, threshold: number) [in Lua 5] \endverbatim
599  * \verbatim im.ProcessSharpNew(image: imImage, amount: number, threshold: number) -> new_image: imImage [in Lua 5] \endverbatim
600  * \ingroup convolve */
601 int imProcessSharpKernel(const(imImage)* src_image, const(imImage)* kernel, imImage* dst_image, float amount, float threshold);