1
/* Create masks and filter with them.
3
* Copyright: N. Dessipris 1991,
14
This file is part of VIPS.
16
VIPS is free software; you can redistribute it and/or modify
17
it under the terms of the GNU Lesser General Public License as published by
18
the Free Software Foundation; either version 2 of the License, or
19
(at your option) any later version.
21
This program is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
GNU Lesser General Public License for more details.
26
You should have received a copy of the GNU Lesser General Public License
27
along with this program; if not, write to the Free Software
28
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
41
#endif /*HAVE_CONFIG_H*/
42
#include <vips/intl.h>
48
#include <vips/vips.h>
49
#include <vips/internal.h>
54
build_freq_mask( IMAGE *out, int xs, int ys, ImMaskType flag, va_list ap )
56
/* May be fewer than 4 args ... but extract them all anyway. Should be
59
double p0 = va_arg( ap, double );
60
double p1 = va_arg( ap, double );
61
double p2 = va_arg( ap, double );
62
double p3 = va_arg( ap, double );
63
double p4 = va_arg( ap, double );
68
case IM_MASK_IDEAL_HIGHPASS:
69
if( vips_mask_ideal( &t, xs, ys, p0,
75
case IM_MASK_IDEAL_LOWPASS:
76
if( vips_mask_ideal( &t, xs, ys, p0,
81
case IM_MASK_BUTTERWORTH_HIGHPASS:
82
if( vips_mask_butterworth( &t, xs, ys, p0, p1, p2,
88
case IM_MASK_BUTTERWORTH_LOWPASS:
89
if( vips_mask_butterworth( &t, xs, ys, p0, p1, p2,
94
case IM_MASK_GAUSS_HIGHPASS:
95
if( vips_mask_gaussian( &t, xs, ys, p0, p1,
101
case IM_MASK_GAUSS_LOWPASS:
102
if( vips_mask_gaussian( &t, xs, ys, p0, p1,
107
case IM_MASK_IDEAL_RINGPASS:
108
if( vips_mask_ideal_ring( &t, xs, ys, p0, p1,
113
case IM_MASK_IDEAL_RINGREJECT:
114
if( vips_mask_ideal_ring( &t, xs, ys, p0, p1,
120
case IM_MASK_BUTTERWORTH_RINGPASS:
121
if( vips_mask_butterworth_ring( &t, xs, ys, p0, p1, p2, p3,
126
case IM_MASK_BUTTERWORTH_RINGREJECT:
127
if( vips_mask_butterworth_ring( &t, xs, ys, p0, p1, p2, p3,
133
case IM_MASK_GAUSS_RINGPASS:
134
if( vips_mask_gaussian_ring( &t, xs, ys, p0, p1, p2,
139
case IM_MASK_GAUSS_RINGREJECT:
140
if( vips_mask_gaussian_ring( &t, xs, ys, p0, p1, p2,
146
case IM_MASK_FRACTAL_FLT:
147
if( vips_mask_fractal( &t, xs, ys, p0,
152
case IM_MASK_IDEAL_BANDPASS:
153
if( vips_mask_ideal_band( &t, xs, ys, p0, p1, p2,
158
case IM_MASK_IDEAL_BANDREJECT:
159
if( vips_mask_ideal_band( &t, xs, ys, p0, p1, p2,
165
case IM_MASK_BUTTERWORTH_BANDPASS:
166
if( vips_mask_butterworth_band( &t, xs, ys, p0, p1, p2, p3, p4,
171
case IM_MASK_BUTTERWORTH_BANDREJECT:
172
if( vips_mask_butterworth_band( &t, xs, ys, p0, p1, p2, p3, p4,
178
case IM_MASK_GAUSS_BANDPASS:
179
if( vips_mask_gaussian_band( &t, xs, ys, p0, p1, p2, p3,
184
case IM_MASK_GAUSS_BANDREJECT:
185
if( vips_mask_gaussian_band( &t, xs, ys, p0, p1, p2, p3,
192
im_error( "im_freq_mask", "%s", _( "unimplemented mask type" ) );
196
if( im_copy( t, out ) ) {
206
im_flt_image_freq( IMAGE *in, IMAGE *out, ImMaskType flag, ... )
208
IMAGE *mask = im_open_local( out, "tempmask", "p" );
216
va_start( ap, flag );
217
if( build_freq_mask( mask, in->Xsize, in->Ysize, flag, ap ) )
221
if( im_freqflt( in, mask, out ) )
228
im_create_fmask( IMAGE *out, int xsize, int ysize, ImMaskType flag, ... )
232
va_start( ap, flag );
233
if( build_freq_mask( out, xsize, ysize, flag, ap ) )