GRASS 8 Programmer's Manual
8.5.0(2026)-8d6ceba290
Toggle main menu visibility
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
int
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 */
getg
int getg(double w, double *g[2], int size)
Definition
getg.c:15
G_message
void G_message(const char *msg,...)
Print a message to stderr.
Definition
gis/error.c:89
G_math_complex_mult
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Definition
mult.c:22
g
float g
Definition
named_colr.c:7
gmath
del2g.c
Generated on
for GRASS 8 Programmer's Manual by
1.17.0