1 /** \file 2 * \brief Kernel Generators 3 * Creates several known kernels 4 * 5 * See Copyright Notice in im_lib.h 6 */ 7 module im.im_kernel; 8 9 version(IM) : 10 11 import core.stdc.config : c_long; 12 import im.im_image : imImage; 13 14 //version(DigitalMars) version(Windows) { pragma(lib, "im.lib"); } // required anyway 15 16 extern(C) @nogc nothrow : 17 18 19 /** \defgroup kernel Kernel Generators 20 * \par 21 * Creates several known kernels 22 * \par 23 * See \ref im_kernel.h 24 * \ingroup convolve */ 25 26 27 /** Creates a kernel with the following values: 28 * 29 \verbatim 30 1 2 1 31 0 0 0 32 -1 -2 -1 33 \endverbatim 34 * 35 * \verbatim im.KernelSobel() -> kernel: imImage [in Lua 5] \endverbatim 36 * \ingroup kernel */ 37 imImage* imKernelSobel(); 38 39 /** Creates a kernel with the following values: 40 * 41 \verbatim 42 1 1 1 43 0 0 0 44 -1 -1 -1 45 \endverbatim 46 * 47 * \verbatim im.KernelPrewitt() -> kernel: imImage [in Lua 5] \endverbatim 48 * \ingroup kernel */ 49 imImage* imKernelPrewitt(); 50 51 /** Creates a kernel with the following values: 52 * 53 \verbatim 54 5 5 5 55 -3 0 -3 56 -3 -3 -3 57 \endverbatim 58 * 59 * \verbatim im.KernelKirsh() -> kernel: imImage [in Lua 5] \endverbatim 60 * \ingroup kernel */ 61 imImage* imKernelKirsh(); 62 63 /** Creates a kernel with the following values: 64 * 65 \verbatim 66 0 -1 0 67 -1 4 -1 68 0 -1 0 69 \endverbatim 70 * 71 * \verbatim im.KernelLaplacian4() -> kernel: imImage [in Lua 5] \endverbatim 72 * \ingroup kernel */ 73 imImage* imKernelLaplacian4(); 74 75 /** Creates a kernel with the following values: 76 * 77 \verbatim 78 -1 -1 -1 79 -1 8 -1 80 -1 -1 -1 81 \endverbatim 82 * 83 * \verbatim im.KernelLaplacian8() -> kernel: imImage [in Lua 5] \endverbatim 84 * \ingroup kernel */ 85 imImage* imKernelLaplacian8(); 86 87 /** Creates a kernel with the following values: 88 * 89 \verbatim 90 0 -1 -1 -1 0 91 -1 0 1 0 -1 92 -1 1 8 1 -1 93 -1 0 1 0 -1 94 0 -1 -1 -1 0 95 \endverbatim 96 * 97 * \verbatim im.KernelLaplacian5x5() -> kernel: imImage [in Lua 5] \endverbatim 98 * \ingroup kernel */ 99 imImage* imKernelLaplacian5x5(); 100 101 /** Creates a kernel with the following values: 102 * 103 \verbatim 104 -1 -1 -1 -1 -1 -1 -1 105 -1 -1 -1 -1 -1 -1 -1 106 -1 -1 -1 -1 -1 -1 -1 107 -1 -1 -1 48 -1 -1 -1 108 -1 -1 -1 -1 -1 -1 -1 109 -1 -1 -1 -1 -1 -1 -1 110 -1 -1 -1 -1 -1 -1 -1 111 \endverbatim 112 * 113 * \verbatim im.KernelLaplacian7x7() -> kernel: imImage [in Lua 5] \endverbatim 114 * \ingroup kernel */ 115 imImage* imKernelLaplacian7x7(); 116 117 /** Creates a kernel with the following values: 118 * 119 \verbatim 120 0 -1 0 121 0 1 0 122 0 0 0 123 \endverbatim 124 * 125 * \verbatim im.KernelGradian3x3() -> kernel: imImage [in Lua 5] \endverbatim 126 * \ingroup kernel */ 127 imImage* imKernelGradian3x3(); 128 129 /** Creates a kernel with the following values: 130 * 131 \verbatim 132 0 -1 -1 0 1 1 0 133 -1 -2 -2 0 2 2 1 134 -1 -2 -3 0 3 2 1 135 -1 -2 -3 0 3 2 1 136 -1 -2 -3 0 3 2 1 137 -1 -2 -2 0 2 2 1 138 0 -1 -1 0 1 1 0 139 \endverbatim 140 * 141 * \verbatim im.KernelGradian7x7() -> kernel: imImage [in Lua 5] \endverbatim 142 * \ingroup kernel */ 143 imImage* imKernelGradian7x7(); 144 145 /** Creates a kernel with the following values: 146 * 147 \verbatim 148 -1 0 0 149 0 0 0 150 0 0 1 151 \endverbatim 152 * 153 * \verbatim im.KernelSculpt() -> kernel: imImage [in Lua 5] \endverbatim 154 * \ingroup kernel */ 155 imImage* imKernelSculpt(); 156 157 /** Creates a kernel with the following values: 158 * 159 \verbatim 160 1 1 1 161 1 1 1 162 1 1 1 163 \endverbatim 164 * 165 * \verbatim im.KernelMean3x3() -> kernel: imImage [in Lua 5] \endverbatim 166 * \ingroup kernel */ 167 imImage* imKernelMean3x3(); 168 169 /** Creates a kernel with the following values: 170 * 171 \verbatim 172 1 1 1 1 1 173 1 1 1 1 1 174 1 1 1 1 1 175 1 1 1 1 1 176 1 1 1 1 1 177 \endverbatim 178 * 179 * \verbatim im.KernelMean5x5() -> kernel: imImage [in Lua 5] \endverbatim 180 * \ingroup kernel */ 181 imImage* imKernelMean5x5(); 182 183 /** Creates a kernel with the following values: 184 * 185 \verbatim 186 0 1 1 1 0 187 1 1 1 1 1 188 1 1 1 1 1 189 1 1 1 1 1 190 0 1 1 1 0 191 \endverbatim 192 * 193 * \verbatim im.KernelMean5x5() -> kernel: imImage [in Lua 5] \endverbatim 194 * \ingroup kernel */ 195 imImage* imKernelCircularMean5x5(); 196 197 /** Creates a kernel with the following values: 198 * 199 \verbatim 200 1 1 1 1 1 1 1 201 1 1 1 1 1 1 1 202 1 1 1 1 1 1 1 203 1 1 1 1 1 1 1 204 1 1 1 1 1 1 1 205 1 1 1 1 1 1 1 206 1 1 1 1 1 1 1 207 \endverbatim 208 * 209 * \verbatim im.KernelMean7x7() -> kernel: imImage [in Lua 5] \endverbatim 210 * \ingroup kernel */ 211 imImage* imKernelMean7x7(); 212 213 /** Creates a kernel with the following values: 214 * 215 \verbatim 216 0 0 1 1 1 0 0 217 0 1 1 1 1 1 0 218 1 1 1 1 1 1 1 219 1 1 1 1 1 1 1 220 1 1 1 1 1 1 1 221 0 1 1 1 1 1 0 222 0 0 1 1 1 0 0 223 \endverbatim 224 * 225 * \verbatim im.KernelCircularMean7x7() -> kernel: imImage [in Lua 5] \endverbatim 226 * \ingroup kernel */ 227 imImage* imKernelCircularMean7x7(); 228 229 /** Creates a kernel with the following values: 230 * 231 \verbatim 232 1 2 1 233 2 4 2 234 1 2 1 235 \endverbatim 236 * 237 * \verbatim im.KernelGaussian3x3() -> kernel: imImage [in Lua 5] \endverbatim 238 * \ingroup kernel */ 239 imImage* imKernelGaussian3x3(); 240 241 /** Creates a kernel with the following values: 242 * 243 \verbatim 244 1 4 6 4 1 245 4 16 24 16 4 246 6 24 36 24 6 247 4 16 24 16 4 248 1 4 6 4 1 249 \endverbatim 250 * 251 * \verbatim im.KernelGaussian5x5() -> kernel: imImage [in Lua 5] \endverbatim 252 * \ingroup kernel */ 253 imImage* imKernelGaussian5x5(); 254 255 /** Creates a kernel with the following values: 256 * 257 \verbatim 258 1 2 3 2 1 259 2 4 6 4 2 260 3 6 9 6 3 261 2 4 6 4 2 262 1 2 3 2 1 263 \endverbatim 264 * 265 * \verbatim im.KernelBarlett5x5() -> kernel: imImage [in Lua 5] \endverbatim 266 * \ingroup kernel */ 267 imImage* imKernelBarlett5x5(); 268 269 /** Creates a kernel with the following values: 270 * 271 \verbatim 272 0 -1 -1 -1 0 273 -1 -1 3 -1 -1 274 -1 3 4 3 -1 275 -1 -1 3 -1 -1 276 0 -1 -1 -1 0 277 \endverbatim 278 * 279 * \verbatim im.KernelTopHat5x5() -> kernel: imImage [in Lua 5] \endverbatim 280 * \ingroup kernel */ 281 imImage* imKernelTopHat5x5(); 282 283 /** Creates a kernel with the following values: 284 * 285 \verbatim 286 0 0 -1 -1 -1 0 0 287 0 -1 -1 -1 -1 -1 0 288 -1 -1 3 3 3 -1 -1 289 -1 -1 3 4 3 -1 -1 290 -1 -1 3 3 3 -1 -1 291 0 -1 -1 -1 -1 -1 0 292 0 0 -1 -1 -1 0 0 293 \endverbatim 294 * 295 * \verbatim im.KernelTopHat7x7() -> kernel: imImage [in Lua 5] \endverbatim 296 * \ingroup kernel */ 297 imImage* imKernelTopHat7x7(); 298 299 /** Creates a kernel with the following values: 300 * 301 \verbatim 302 0 -1 -2 -1 0 303 -1 -4 0 -4 -1 304 -2 0 40 0 -2 305 -1 -4 0 -4 -1 306 0 -1 -2 -1 0 307 \endverbatim 308 * 309 * \verbatim im.KernelEnhance() -> kernel: imImage [in Lua 5] \endverbatim 310 * \ingroup kernel */ 311 imImage* imKernelEnhance();