GRASS GIS 8 Programmer's Manual 8.4.1(2025)-45ca3179ab
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 */
42
43int del2g(double *img[2], int size, double w)
44{
45 double *g[2]; /* the filter function */
46
47 G_message(_(" taking FFT of image..."));
48 fft(FORWARD, img, size * size, size, size);
49
50 g[0] = (double *)G_malloc(size * size * sizeof(double));
51 g[1] = (double *)G_malloc(size * size * sizeof(double));
52
53 G_message(_(" computing del**2 g..."));
54 getg(w, g, size);
55
56 G_message(_(" taking FFT of del**2 g..."));
57 fft(FORWARD, g, size * size, size, size);
58
59 /* multiply the complex vectors img and g, each of length size*size */
60 G_message(_(" multiplying transforms..."));
61 G_math_complex_mult(img, size * size, g, size * size, img, size * size);
62
63 G_message(_(" taking inverse FFT..."));
64 fft(INVERSE, img, size * size, size, size);
65
66 return 0;
67}
68
69#endif /* HAVE_FFTW */
int getg(double w, double *g[2], int size)
Definition getg.c:15
void G_message(const char *msg,...)
Print a message to stderr.
Definition gis/error.c:89
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Definition mult.c:23
float g
Definition named_colr.c:7