GRASS 8 Programmer's Manual 8.6.0dev(2026)-1d1e47ad9d
Loading...
Searching...
No Matches
del2g.c
Go to the documentation of this file.
1/* Name: del2g
2
3 Created: Tue Mar 5 09:22:27 1985
4 Last modified: Tue May 6 21:21:41 1986
5
6 Purpose: Take the Laplacian of a gaussian of the image.
7
8 Details: This routine does a convolution of the Marr-Hildreth operator
9 (Laplacian of a gaussian) with the given image, and returns
10 the result. Uses the array processor. Does the convolution
11 in the frequency domain (ie, multiplies the fourier transforms
12 of the image and the filter together, and takes the inverse
13 transform).
14
15 Author: Bill Hoff,2-114C,8645,3563478 (hoff) at uicsl
16 */
17
18#include <grass/config.h>
19
20#if defined(HAVE_FFTW_H) || defined(HAVE_DFFTW_H) || defined(HAVE_FFTW3_H)
21
22#include <stdio.h>
23#include <grass/gmath.h>
24#include <grass/gis.h>
25#include <grass/glocale.h>
26
27#define FORWARD 1
28#define INVERSE -1
29#define SCALE 1
30#define NOSCALE 0
31
32/*!
33 * \fn int del2g (double *img[2], int size, double w)
34 *
35 * \brief
36 *
37 * \param img
38 * \param size
39 * \param w
40 * \return int
41 */
42int del2g(double *img[2], int size, double w)
43{
44 double *g[2]; /* the filter function */
45
46 G_message(_(" taking FFT of image..."));
47 fft(FORWARD, img, size * size, size, size);
48
49 g[0] = (double *)G_malloc(size * size * sizeof(double));
50 g[1] = (double *)G_malloc(size * size * sizeof(double));
51
52 G_message(_(" computing del**2 g..."));
53 getg(w, g, size);
54
55 G_message(_(" taking FFT of del**2 g..."));
56 fft(FORWARD, g, size * size, size, size);
57
58 /* multiply the complex vectors img and g, each of length size*size */
59 G_message(_(" multiplying transforms..."));
60 G_math_complex_mult(img, size * size, g, size * size, img, size * size);
61
62 G_message(_(" taking inverse FFT..."));
63 fft(INVERSE, img, size * size, size, size);
64
65 return 0;
66}
67
68#endif /* HAVE_FFTW */
#define G_malloc(n)
Definition defs/gis.h:139
void G_message(const char *,...) __attribute__((format(printf
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Definition mult.c:22
int fft(int, double *[2], int, int, int)
Fast Fourier Transform for two-dimensional array.
Definition fft.c:120
int getg(double, double *[2], int)
Definition getg.c:15
int del2g(double *img[2], int size, double w)
Definition del2g.c:42
#define FORWARD
Definition del2g.c:27
#define INVERSE
Definition del2g.c:28
#define _(str)
Definition glocale.h:10
float g
Definition named_colr.c:7