ruby-vips 0.3.14 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +22 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +46 -31
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +101 -145
- data/Rakefile +45 -0
- data/TODO +8 -32
- data/VERSION +1 -0
- data/example/annotate.rb +17 -0
- data/example/daltonize8.rb +75 -0
- data/example/example1.rb +84 -0
- data/example/example2.rb +31 -0
- data/example/example3.rb +19 -0
- data/example/example4.rb +18 -0
- data/example/example5.rb +31 -0
- data/example/trim8.rb +41 -0
- data/example/watermark.rb +44 -0
- data/example/wobble.rb +36 -0
- data/lib/vips.rb +151 -14
- data/lib/vips/access.rb +14 -0
- data/lib/vips/align.rb +11 -0
- data/lib/vips/angle.rb +12 -0
- data/lib/vips/angle45.rb +16 -0
- data/lib/vips/argument.rb +163 -0
- data/lib/vips/bandformat.rb +20 -0
- data/lib/vips/call.rb +302 -0
- data/lib/vips/coding.rb +14 -0
- data/lib/vips/demandstyle.rb +35 -0
- data/lib/vips/direction.rb +11 -0
- data/lib/vips/error.rb +30 -0
- data/lib/vips/extend.rb +22 -0
- data/lib/vips/foreignflags.rb +20 -0
- data/lib/vips/image.rb +1382 -0
- data/lib/vips/interpolate.rb +37 -0
- data/lib/vips/interpretation.rb +28 -0
- data/lib/vips/methods.rb +1807 -0
- data/lib/vips/operation.rb +19 -0
- data/ruby-vips8.gemspec +112 -0
- data/spec/image_spec.rb +515 -0
- data/spec/samples/balloon.v +0 -0
- data/spec/samples/ghost.ppm +405 -0
- data/spec/samples/huge.jpg +0 -0
- data/spec/samples/icc.jpg +0 -0
- data/spec/samples/lcd.icc +0 -0
- data/spec/samples/lion.svg +154 -0
- data/spec/samples/sample.csv +7 -0
- data/spec/samples/sample.exr +0 -0
- data/spec/samples/wagon.jpg +0 -0
- data/spec/samples/wagon.v +0 -0
- data/spec/spec_helper.rb +49 -0
- data/spec/vips_spec.rb +74 -0
- metadata +110 -70
- data/ext/extconf.rb +0 -31
- data/ext/header.c +0 -457
- data/ext/header.h +0 -9
- data/ext/image.c +0 -629
- data/ext/image.h +0 -72
- data/ext/image_arithmetic.c +0 -936
- data/ext/image_arithmetic.h +0 -38
- data/ext/image_boolean.c +0 -301
- data/ext/image_boolean.h +0 -8
- data/ext/image_colour.c +0 -590
- data/ext/image_colour.h +0 -36
- data/ext/image_conversion.c +0 -884
- data/ext/image_conversion.h +0 -38
- data/ext/image_convolution.c +0 -368
- data/ext/image_convolution.h +0 -13
- data/ext/image_freq_filt.c +0 -740
- data/ext/image_freq_filt.h +0 -27
- data/ext/image_histograms_lut.c +0 -643
- data/ext/image_histograms_lut.h +0 -28
- data/ext/image_morphology.c +0 -327
- data/ext/image_morphology.h +0 -13
- data/ext/image_mosaicing.c +0 -554
- data/ext/image_mosaicing.h +0 -15
- data/ext/image_relational.c +0 -384
- data/ext/image_relational.h +0 -8
- data/ext/image_resample.c +0 -249
- data/ext/image_resample.h +0 -9
- data/ext/interpolator.c +0 -106
- data/ext/interpolator.h +0 -7
- data/ext/mask.c +0 -347
- data/ext/mask.h +0 -18
- data/ext/reader.c +0 -261
- data/ext/reader.h +0 -2
- data/ext/ruby_vips.c +0 -188
- data/ext/ruby_vips.h +0 -72
- data/ext/tags +0 -450
- data/ext/writer.c +0 -371
- data/ext/writer.h +0 -2
- data/lib/vips/reader.rb +0 -272
- data/lib/vips/version.rb +0 -3
- data/lib/vips/writer.rb +0 -342
- data/ruby-vips.gemspec +0 -100
- data/ruby.supp +0 -134
data/ext/image_conversion.h
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
VALUE img_to_mask(VALUE);
|
2
|
-
VALUE img_dup(VALUE);
|
3
|
-
VALUE img_copy_swap(VALUE);
|
4
|
-
VALUE img_copy_native(VALUE, VALUE);
|
5
|
-
VALUE img_copy_file(VALUE);
|
6
|
-
VALUE img_clip2fmt(VALUE, VALUE);
|
7
|
-
VALUE img_scale(VALUE);
|
8
|
-
VALUE img_msb(int, VALUE*, VALUE);
|
9
|
-
VALUE img_c2amph(VALUE);
|
10
|
-
VALUE img_c2rect(VALUE);
|
11
|
-
VALUE img_ri2c(VALUE, VALUE);
|
12
|
-
VALUE img_c2imag(VALUE);
|
13
|
-
VALUE img_c2real(VALUE);
|
14
|
-
VALUE img_scaleps(VALUE);
|
15
|
-
VALUE img_falsecolour(VALUE);
|
16
|
-
VALUE img_s_gaussnoise(VALUE, VALUE, VALUE, VALUE, VALUE);
|
17
|
-
VALUE img_s_black(VALUE, VALUE, VALUE, VALUE);
|
18
|
-
VALUE img_s_text(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
19
|
-
VALUE img_extract_band(int, VALUE*, VALUE);
|
20
|
-
VALUE img_extract_area(int, VALUE*, VALUE);
|
21
|
-
VALUE img_embed(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
22
|
-
VALUE img_tile_cache(VALUE, VALUE, VALUE, VALUE);
|
23
|
-
VALUE img_bandjoin(int, VALUE *argv, VALUE);
|
24
|
-
VALUE img_insert_noexpand(VALUE, VALUE, VALUE, VALUE);
|
25
|
-
VALUE img_insert(int, VALUE *argv, VALUE);
|
26
|
-
VALUE img_lrjoin(VALUE, VALUE);
|
27
|
-
VALUE img_tbjoin(VALUE, VALUE);
|
28
|
-
VALUE img_replicate(VALUE, VALUE, VALUE);
|
29
|
-
VALUE img_grid(VALUE, VALUE, VALUE, VALUE);
|
30
|
-
VALUE img_wrap(VALUE, VALUE, VALUE);
|
31
|
-
VALUE img_fliphor(VALUE);
|
32
|
-
VALUE img_flipver(VALUE);
|
33
|
-
VALUE img_rot90(VALUE);
|
34
|
-
VALUE img_rot180(VALUE);
|
35
|
-
VALUE img_rot270(VALUE);
|
36
|
-
VALUE img_subsample(int, VALUE*, VALUE);
|
37
|
-
VALUE img_zoom(int, VALUE*, VALUE);
|
38
|
-
void init_Image_conversion();
|
data/ext/image_convolution.c
DELETED
@@ -1,368 +0,0 @@
|
|
1
|
-
#include "ruby_vips.h"
|
2
|
-
|
3
|
-
/*
|
4
|
-
* call-seq:
|
5
|
-
* im.conv(mask) -> image
|
6
|
-
*
|
7
|
-
* Convolve *self* with <i>mask</i>. The output image always has the same band format
|
8
|
-
* as *self*. Non-complex images only.
|
9
|
-
*
|
10
|
-
* Each output pixel is calculated as sigma[i]{pixel[i] * <i>mask</i>[i]} /
|
11
|
-
* scale + offset, where scale and offset are part of <i>mask</i>. For integer
|
12
|
-
* *self*, the division by scale includes round-to-nearest.
|
13
|
-
*
|
14
|
-
* <i>mask</i> can be an array in which case scale defaults to 1 and offset
|
15
|
-
* defaults to zero. <i>mask</i> can also be a Mask object.
|
16
|
-
*/
|
17
|
-
|
18
|
-
VALUE
|
19
|
-
img_conv(VALUE obj, VALUE m)
|
20
|
-
{
|
21
|
-
DOUBLEMASK *dmask;
|
22
|
-
INTMASK *imask;
|
23
|
-
|
24
|
-
GetImg(obj, data, im);
|
25
|
-
OutImg2(obj, m, new, data_new, im_new);
|
26
|
-
|
27
|
-
mask_arg2mask(m, &imask, &dmask);
|
28
|
-
|
29
|
-
if (imask) {
|
30
|
-
if (im_conv(im, im_new, imask))
|
31
|
-
vips_lib_error();
|
32
|
-
} else if (im_conv_f(im, im_new, dmask))
|
33
|
-
vips_lib_error();
|
34
|
-
|
35
|
-
return new;
|
36
|
-
}
|
37
|
-
|
38
|
-
/*
|
39
|
-
* call-seq:
|
40
|
-
* im.convsep(mask) -> image
|
41
|
-
*
|
42
|
-
* Perform a separable convolution of *self* with <i>mask</i> using integer
|
43
|
-
* arithmetic.
|
44
|
-
*
|
45
|
-
* <i>mask</i> must be 1xn or nx1 elements.
|
46
|
-
*
|
47
|
-
* The output image always has the same band format as *self*. Non-complex
|
48
|
-
* images only.
|
49
|
-
*
|
50
|
-
* The image is convolved twice: once with <i>mask</i> and then again with
|
51
|
-
* <i>mask</i> rotated by 90 degrees. This is much faster for certain types of
|
52
|
-
* mask (gaussian blur, for example) than doing a full 2D convolution.
|
53
|
-
*
|
54
|
-
* Each output pixel is calculated as sigma[i]{pixel[i] * <i>mask</i>[i]} /
|
55
|
-
* scale + offset, where scale and offset are part of <i>mask</i>. For integer
|
56
|
-
* *self*, the division by scale includes round-to-nearest.
|
57
|
-
*
|
58
|
-
* <i>mask</i> can be an array in which case scale defaults to 1 and offset
|
59
|
-
* defaults to zero. <i>mask</i> can also be a Mask object.
|
60
|
-
*/
|
61
|
-
|
62
|
-
VALUE
|
63
|
-
img_convsep(VALUE obj, VALUE mask)
|
64
|
-
{
|
65
|
-
DOUBLEMASK *dmask;
|
66
|
-
INTMASK *imask;
|
67
|
-
|
68
|
-
GetImg(obj, data, im);
|
69
|
-
OutImg2(obj, mask, new, data_new, im_new);
|
70
|
-
|
71
|
-
mask_arg2mask(mask, &imask, &dmask);
|
72
|
-
|
73
|
-
if(imask) {
|
74
|
-
if (im_convsep(im, im_new, imask))
|
75
|
-
vips_lib_error();
|
76
|
-
} else if (im_convsep_f(im, im_new, dmask))
|
77
|
-
vips_lib_error();
|
78
|
-
|
79
|
-
return new;
|
80
|
-
}
|
81
|
-
|
82
|
-
/*
|
83
|
-
* call-seq:
|
84
|
-
* im.compass(mask) -> image
|
85
|
-
*
|
86
|
-
* *self* is convolved 8 times with <i>mask</i>, each time <i>mask</i> is
|
87
|
-
* rotated by 45 degrees. Each output pixel is the largest absolute value of
|
88
|
-
* the 8 convolutions.
|
89
|
-
*
|
90
|
-
* <i>mask</i> can be an array or a Mask object.
|
91
|
-
*/
|
92
|
-
|
93
|
-
VALUE
|
94
|
-
img_compass(VALUE obj, VALUE mask)
|
95
|
-
{
|
96
|
-
INTMASK *imask;
|
97
|
-
GetImg(obj, data, im);
|
98
|
-
OutImg2(obj, mask, new, data_new, im_new);
|
99
|
-
|
100
|
-
mask_arg2mask(mask, &imask, NULL);
|
101
|
-
|
102
|
-
if (im_compass(im, im_new, imask))
|
103
|
-
vips_lib_error();
|
104
|
-
|
105
|
-
return new;
|
106
|
-
}
|
107
|
-
|
108
|
-
/*
|
109
|
-
* call-seq:
|
110
|
-
* im.gradient(mask) -> image
|
111
|
-
*
|
112
|
-
* *self* is convolved with <i>mask</i> and with <i>mask</i> after a 90 degree
|
113
|
-
* rotation. The result is the sum of the absolute value of the two
|
114
|
-
* convolutions.
|
115
|
-
*
|
116
|
-
* <i>mask</i> can be an array or a Mask object.
|
117
|
-
*/
|
118
|
-
|
119
|
-
VALUE
|
120
|
-
img_gradient(VALUE obj, VALUE mask)
|
121
|
-
{
|
122
|
-
INTMASK *imask;
|
123
|
-
|
124
|
-
GetImg(obj, data, im);
|
125
|
-
OutImg2(obj, mask, new, data_new, im_new);
|
126
|
-
|
127
|
-
mask_arg2mask(mask, &imask, NULL);
|
128
|
-
|
129
|
-
if (im_gradient(im, im_new, imask) )
|
130
|
-
vips_lib_error();
|
131
|
-
|
132
|
-
return new;
|
133
|
-
}
|
134
|
-
|
135
|
-
/*
|
136
|
-
* call-seq:
|
137
|
-
* im.lindetect(mask) -> image
|
138
|
-
*
|
139
|
-
* *self* is convolved four times with @mask, each time @mask is rotated by 45
|
140
|
-
* degrees. Each output pixel is the largest absolute value of the four
|
141
|
-
* convolutions.
|
142
|
-
*
|
143
|
-
* <i>mask</i> can be an array or a Mask object.
|
144
|
-
*/
|
145
|
-
|
146
|
-
VALUE
|
147
|
-
img_lindetect(VALUE obj, VALUE mask)
|
148
|
-
{
|
149
|
-
INTMASK *imask;
|
150
|
-
|
151
|
-
GetImg(obj, data, im);
|
152
|
-
OutImg2(obj, mask, new, data_new, im_new);
|
153
|
-
|
154
|
-
mask_arg2mask(mask, &imask, NULL);
|
155
|
-
|
156
|
-
if (im_lindetect(im, im_new, imask))
|
157
|
-
vips_lib_error();
|
158
|
-
|
159
|
-
return new;
|
160
|
-
}
|
161
|
-
|
162
|
-
/*
|
163
|
-
* call-seq:
|
164
|
-
* im.sharpen(mask_size, x1, y2, y3, m1, m2) -> image
|
165
|
-
*
|
166
|
-
* Selectively sharpen the L channel of a LAB image. Works for :LABQ coding and
|
167
|
-
* LABS images.
|
168
|
-
*
|
169
|
-
* The operation performs a gaussian blur of size <i>mask_size</i> and
|
170
|
-
* subtract from *self* to generate a high-frequency signal. This signal is
|
171
|
-
* passed through a lookup table formed from the five parameters and added back
|
172
|
-
* to *self*.
|
173
|
-
*
|
174
|
-
*
|
175
|
-
* For printing, we recommend the following settings:
|
176
|
-
*
|
177
|
-
* mask_size == 7
|
178
|
-
* x1 == 1.5
|
179
|
-
* y2 == 20 (don't brighten by more than 20 L*)
|
180
|
-
* y3 == 50 (can darken by up to 50 L*)
|
181
|
-
*
|
182
|
-
* m1 == 1 (some sharpening in flat areas)
|
183
|
-
* m2 == 2 (more sharpening in jaggy areas)
|
184
|
-
*
|
185
|
-
* If you want more or less sharpening, we suggest you just change the
|
186
|
-
* <i>m1</i> and <i>m2</i> parameters.
|
187
|
-
*
|
188
|
-
* The <i>mask_size</i> parameter changes the width of the fringe and can be
|
189
|
-
* adjusted according to the output printing resolution. As an approximate
|
190
|
-
* guideline, use 3 for 4 pixels/mm (CRT display resolution), 5 for 8
|
191
|
-
* pixels/mm, 7 for 12 pixels/mm and 9 for 16 pixels/mm (300 dpi == 12
|
192
|
-
* pixels/mm). These figures refer to the image raster, not the half-tone
|
193
|
-
* resolution.
|
194
|
-
*/
|
195
|
-
|
196
|
-
VALUE
|
197
|
-
img_sharpen(VALUE obj, VALUE mask_size, VALUE x1, VALUE y2, VALUE y3, VALUE m1,
|
198
|
-
VALUE m2)
|
199
|
-
{
|
200
|
-
GetImg(obj, data, im);
|
201
|
-
OutImg(obj, new, data_new, im_new);
|
202
|
-
|
203
|
-
if (im_sharpen(im, im_new, NUM2INT(mask_size), NUM2DBL(x1), NUM2DBL(y2),
|
204
|
-
NUM2DBL(y3), NUM2DBL(m1), NUM2DBL(m2)))
|
205
|
-
vips_lib_error();
|
206
|
-
|
207
|
-
return new;
|
208
|
-
}
|
209
|
-
|
210
|
-
/*
|
211
|
-
* call-seq:
|
212
|
-
* im.grad_x -> image
|
213
|
-
*
|
214
|
-
* Find horizontal differences between adjacent pixels.
|
215
|
-
*
|
216
|
-
* Generates an image where the value of each pixel is the difference between
|
217
|
-
* it and the pixel to its right. The output has the same height as the input
|
218
|
-
* and one pixel less width. One-band integer formats only. The result is
|
219
|
-
* always band format :INT.
|
220
|
-
*
|
221
|
-
* This operation is much faster than (though equivalent to) Image#conv with
|
222
|
-
* the mask [[-1, 1]].
|
223
|
-
*/
|
224
|
-
|
225
|
-
VALUE
|
226
|
-
img_grad_x(VALUE obj)
|
227
|
-
{
|
228
|
-
RUBY_VIPS_UNARY(im_grad_x);
|
229
|
-
}
|
230
|
-
|
231
|
-
/*
|
232
|
-
* call-seq:
|
233
|
-
* im.grad_y -> image
|
234
|
-
*
|
235
|
-
* Find vertical differences between adjacent pixels.
|
236
|
-
*
|
237
|
-
* Generates an image where the value of each pixel is the difference between
|
238
|
-
* it and the pixel below it. The output has the same width as the input
|
239
|
-
* and one pixel less height. One-band integer formats only. The result is
|
240
|
-
* always band format :INT.
|
241
|
-
*
|
242
|
-
* This operation is much faster than (though equivalent to) Image#conv with
|
243
|
-
* the mask [[-1], [1]].
|
244
|
-
*/
|
245
|
-
|
246
|
-
VALUE
|
247
|
-
img_grad_y(VALUE obj)
|
248
|
-
{
|
249
|
-
RUBY_VIPS_UNARY(im_grad_y);
|
250
|
-
}
|
251
|
-
|
252
|
-
/*
|
253
|
-
* call-seq:
|
254
|
-
* im.fastcor(other_image) -> image
|
255
|
-
*
|
256
|
-
* Calculate a fast correlation surface.
|
257
|
-
*
|
258
|
-
* <i>other_image</i> is placed at every position in *self* and the sum of
|
259
|
-
* squares of differences calculated. One-band, 8-bit unsigned images only. The
|
260
|
-
* output image is always band format :UINT. <i>other_image</i> must be smaller
|
261
|
-
* than or equal to *self*. The output image is the same size as the input.
|
262
|
-
*/
|
263
|
-
|
264
|
-
VALUE
|
265
|
-
img_fastcor(VALUE obj, VALUE obj2)
|
266
|
-
{
|
267
|
-
RUBY_VIPS_BINARY(im_fastcor);
|
268
|
-
}
|
269
|
-
|
270
|
-
/*
|
271
|
-
* call-seq:
|
272
|
-
* im.spcor(other_image) -> image
|
273
|
-
*
|
274
|
-
* Calculate a correlation surface.
|
275
|
-
*
|
276
|
-
* <i>other_image</i> is placed at every position in *self* and the correlation
|
277
|
-
* coefficient calculated. One-band, 8 or 16-bit images only. *self* and
|
278
|
-
* <i>other_image</i> must have the same band format.. The output image is
|
279
|
-
* always band format :FLOAT. <i>other_image</i> must be smaller than or equal
|
280
|
-
* to *self*. The output image is the same size as *self*.
|
281
|
-
*
|
282
|
-
* The correlation coefficient is calculated as:
|
283
|
-
*
|
284
|
-
* sumij (ref(i,j)-mean(ref))(inkl(i,j)-mean(inkl))
|
285
|
-
* c(k,l) = ------------------------------------------------
|
286
|
-
* sqrt(sumij (ref(i,j)-mean(ref))^2) *
|
287
|
-
* sqrt(sumij (inkl(i,j)-mean(inkl))^2)
|
288
|
-
*
|
289
|
-
* where inkl is the area of *self* centred at position (k,l).
|
290
|
-
*
|
291
|
-
* from Niblack "An Introduction to Digital Image Processing", Prentice/Hall,
|
292
|
-
* pp 138.
|
293
|
-
*/
|
294
|
-
|
295
|
-
VALUE
|
296
|
-
img_spcor(VALUE obj, VALUE obj2)
|
297
|
-
{
|
298
|
-
RUBY_VIPS_BINARY(im_spcor);
|
299
|
-
}
|
300
|
-
|
301
|
-
/*
|
302
|
-
* call-seq:
|
303
|
-
* im.gradcor(other_image) -> image
|
304
|
-
*
|
305
|
-
* Calculate a correlation surface.
|
306
|
-
*
|
307
|
-
* <i>other_image</i> is placed at every position in *self* and a correlation
|
308
|
-
* coefficient calculated. One-band, integer images only. *self* and
|
309
|
-
* <i>other_image</i> must have the same band format. The output image is
|
310
|
-
* always band format :FLOAT. <i>other_image</i> must be smaller than *self*.
|
311
|
-
* The output image is the same size as the input.
|
312
|
-
*
|
313
|
-
* The method takes the gradient images of the two images then takes the
|
314
|
-
* dot-product correlation of the two vector images. The vector expression of
|
315
|
-
* this method is my (tcv) own creation. It is equivalent to the complex-number
|
316
|
-
* method of:
|
317
|
-
*
|
318
|
-
* ARGYRIOU, V. et al. 2003. Estimation of sub-pixel motion using gradient
|
319
|
-
* cross correlation. Electronics Letters, 39 (13).
|
320
|
-
*/
|
321
|
-
|
322
|
-
VALUE
|
323
|
-
img_gradcor(VALUE obj, VALUE obj2)
|
324
|
-
{
|
325
|
-
RUBY_VIPS_BINARY(im_gradcor);
|
326
|
-
}
|
327
|
-
|
328
|
-
/*
|
329
|
-
* call-seq:
|
330
|
-
* im.contrast_surface(half_win_size, spacing) -> image
|
331
|
-
*
|
332
|
-
* Generate an image where the value of each pixel represents the contrast
|
333
|
-
* within a window of half_win_size from the corresponsing point in the input
|
334
|
-
* image. Sub-sample by a factor of spacing.
|
335
|
-
*/
|
336
|
-
|
337
|
-
VALUE
|
338
|
-
img_contrast_surface(VALUE obj, VALUE half_win_size, VALUE spacing)
|
339
|
-
{
|
340
|
-
GetImg(obj, data, im);
|
341
|
-
OutImg(obj, new, data_new, im_new);
|
342
|
-
|
343
|
-
if (im_contrast_surface(im, im_new, NUM2INT(half_win_size),
|
344
|
-
NUM2INT(spacing)))
|
345
|
-
vips_lib_error();
|
346
|
-
|
347
|
-
return new;
|
348
|
-
}
|
349
|
-
|
350
|
-
/*
|
351
|
-
* call-seq:
|
352
|
-
* im.addgnoise(sigma) -> image
|
353
|
-
*
|
354
|
-
* Add gaussian noise with mean 0 and variance sigma to *self*. The noise is
|
355
|
-
* generated by averaging 12 random numbers, see page 78, PIETGEN, 1989.
|
356
|
-
*/
|
357
|
-
|
358
|
-
VALUE
|
359
|
-
img_addgnoise(VALUE obj, VALUE sigma)
|
360
|
-
{
|
361
|
-
GetImg(obj, data, im);
|
362
|
-
OutImg(obj, new, data_new, im_new);
|
363
|
-
|
364
|
-
if (im_addgnoise(im, im_new, NUM2INT(sigma)))
|
365
|
-
vips_lib_error();
|
366
|
-
|
367
|
-
return new;
|
368
|
-
}
|
data/ext/image_convolution.h
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
VALUE img_conv(VALUE, VALUE);
|
2
|
-
VALUE img_convsep(VALUE, VALUE);
|
3
|
-
VALUE img_compass(VALUE, VALUE);
|
4
|
-
VALUE img_gradient(VALUE, VALUE);
|
5
|
-
VALUE img_lindetect(VALUE, VALUE);
|
6
|
-
VALUE img_sharpen(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
|
7
|
-
VALUE img_grad_x(VALUE);
|
8
|
-
VALUE img_grad_y(VALUE);
|
9
|
-
VALUE img_fastcor(VALUE, VALUE);
|
10
|
-
VALUE img_spcor(VALUE, VALUE);
|
11
|
-
VALUE img_gradcor(VALUE, VALUE);
|
12
|
-
VALUE img_contrast_surface(VALUE, VALUE, VALUE);
|
13
|
-
VALUE img_addgnoise(VALUE, VALUE);
|
data/ext/image_freq_filt.c
DELETED
@@ -1,740 +0,0 @@
|
|
1
|
-
#include "ruby_vips.h"
|
2
|
-
|
3
|
-
/*
|
4
|
-
* call-seq:
|
5
|
-
* im.fwfft -> image
|
6
|
-
*
|
7
|
-
* Transform an image to Fourier space.
|
8
|
-
*
|
9
|
-
* VIPS uses the fftw3 or fftw2 Fourier transform libraries if possible. If
|
10
|
-
* they were not available when VIPS was built, it falls back to its own
|
11
|
-
* FFT functions which are slow and only work for square images whose sides
|
12
|
-
* are a power of two.
|
13
|
-
*/
|
14
|
-
|
15
|
-
VALUE
|
16
|
-
img_fwfft(VALUE obj)
|
17
|
-
{
|
18
|
-
RUBY_VIPS_UNARY(im_fwfft);
|
19
|
-
}
|
20
|
-
|
21
|
-
/*
|
22
|
-
* call-seq:
|
23
|
-
* im.invfft -> image
|
24
|
-
*
|
25
|
-
* Transform an image from Fourier space to real space. The result is complex.
|
26
|
-
* If you are OK with a real result, use Image#invfftr instead, it's quicker.
|
27
|
-
*
|
28
|
-
* VIPS uses the fftw3 or fftw2 Fourier transform libraries if possible. If
|
29
|
-
* they were not available when VIPS was built, it falls back to its own FFT
|
30
|
-
* functions which are slow and only work for square images whose sides are a
|
31
|
-
* power of two.
|
32
|
-
*/
|
33
|
-
|
34
|
-
VALUE
|
35
|
-
img_invfft(VALUE obj)
|
36
|
-
{
|
37
|
-
RUBY_VIPS_UNARY(im_invfft);
|
38
|
-
}
|
39
|
-
|
40
|
-
/*
|
41
|
-
* call-seq:
|
42
|
-
* im.rotquad -> image
|
43
|
-
*
|
44
|
-
* Rotate the quadrants of the image so that the point that was at the
|
45
|
-
* top-left is now in the centre. Handy for moving Fourier images to optical
|
46
|
-
* space.
|
47
|
-
*/
|
48
|
-
|
49
|
-
VALUE
|
50
|
-
img_rotquad(VALUE obj)
|
51
|
-
{
|
52
|
-
RUBY_VIPS_UNARY(im_rotquad);
|
53
|
-
}
|
54
|
-
|
55
|
-
/*
|
56
|
-
* call-seq:
|
57
|
-
* im.invfftr -> image
|
58
|
-
*
|
59
|
-
* Transform an image from Fourier space to real space, giving a real result.
|
60
|
-
* This is faster than Image#invfft, which gives a complex result.
|
61
|
-
*
|
62
|
-
* VIPS uses the fftw3 or fftw2 Fourier transform libraries if possible. If
|
63
|
-
* they were not available when VIPS was built, it falls back to it's own
|
64
|
-
* FFT functions which are slow and only work for square images whose sides
|
65
|
-
* are a power of two.
|
66
|
-
*/
|
67
|
-
|
68
|
-
VALUE
|
69
|
-
img_invfftr(VALUE obj)
|
70
|
-
{
|
71
|
-
RUBY_VIPS_UNARY(im_invfftr);
|
72
|
-
}
|
73
|
-
|
74
|
-
#if ATLEAST_VIPS( 7, 22 )
|
75
|
-
|
76
|
-
/*
|
77
|
-
* call-seq:
|
78
|
-
* Image.fmask_ideal_lowpass(x, y, frequency_cutoff) -> image
|
79
|
-
*
|
80
|
-
* This operation creates a one-band float image of the size <i>x</i> by
|
81
|
-
* <i>y</i>. The image must be square, and the sides must be a power of two.
|
82
|
-
* The image has values in the range [0, 1] and is typically used for
|
83
|
-
* multiplying against frequency domain images to filter them.
|
84
|
-
*
|
85
|
-
* All masks are created with the DC component at (0, 0), so you might want to
|
86
|
-
* rotate the quadrants with im_rotquad() before viewing. The DC pixel always
|
87
|
-
* has the value 1.0.
|
88
|
-
*
|
89
|
-
* Unless noted below, all parameters are expressed as percentages, scaled to
|
90
|
-
* [0, 1].
|
91
|
-
*
|
92
|
-
* * High-pass, low-pass masks: A high pass filter mask filters the low
|
93
|
-
* frequencies while allowing the high frequencies to get through.
|
94
|
-
* The reverse happens with a low pass filter mask.
|
95
|
-
*
|
96
|
-
* * Ring-pass, ring-reject masks: A ring filter passes or rejects a range of
|
97
|
-
* frequencies. The range is specified by the <i>frequency_cutoff</i> and
|
98
|
-
* the <i>width</i>.
|
99
|
-
*
|
100
|
-
* * Band-pass, band-reject masks: These masks are used to pass or remove
|
101
|
-
* spatial frequencies around a given frequency. The position of the
|
102
|
-
* frequency to pass or remove is given by <i>frequency_cutoffx</i> and
|
103
|
-
* <i>frequency_cutoffy</i>. The size of the region around the point is
|
104
|
-
* given by <i>radius</i>.
|
105
|
-
*
|
106
|
-
* * Ideal filters: These filters pass or reject frequencies with a sharp
|
107
|
-
* cutoff at the transition.
|
108
|
-
*
|
109
|
-
* * Butterworth filters: These filters use a Butterworth function to separate
|
110
|
-
* the frequencies (see Gonzalez and Wintz, Digital Image Processing, 1987).
|
111
|
-
* The shape of the curve is controlled by <i>order</i>: higher values give
|
112
|
-
* a sharper transition.
|
113
|
-
*
|
114
|
-
* * Gaussian filters: These filters have a smooth Gaussian shape,
|
115
|
-
* controlled by <i>amplitude_cutoff</i>.
|
116
|
-
*/
|
117
|
-
|
118
|
-
VALUE
|
119
|
-
img_s_fmask_ideal_highpass(VALUE obj, VALUE x, VALUE y, VALUE frequency_cutoff)
|
120
|
-
{
|
121
|
-
OutPartial(new, data, im);
|
122
|
-
|
123
|
-
if (im_create_fmask(im, NUM2INT(x), NUM2INT(y), VIPS_MASK_IDEAL_HIGHPASS,
|
124
|
-
NUM2DBL(frequency_cutoff)))
|
125
|
-
vips_lib_error();
|
126
|
-
|
127
|
-
return new;
|
128
|
-
}
|
129
|
-
|
130
|
-
/*
|
131
|
-
* call-seq:
|
132
|
-
* Image.fmask_ideal_lowpass(x, y, frequency_cutoff) -> image
|
133
|
-
*
|
134
|
-
* See Image.fmask_ideal_highpass
|
135
|
-
*
|
136
|
-
*/
|
137
|
-
|
138
|
-
VALUE
|
139
|
-
img_s_fmask_ideal_lowpass(VALUE obj, VALUE x, VALUE y, VALUE frequency_cutoff)
|
140
|
-
{
|
141
|
-
OutPartial(new, data, im);
|
142
|
-
|
143
|
-
if (im_create_fmask(im, NUM2INT(x), NUM2INT(y),
|
144
|
-
VIPS_MASK_IDEAL_LOWPASS, NUM2DBL(frequency_cutoff)))
|
145
|
-
vips_lib_error();
|
146
|
-
|
147
|
-
return new;
|
148
|
-
}
|
149
|
-
|
150
|
-
/*
|
151
|
-
* call-seq:
|
152
|
-
* Image.fmask_butterworth_highpass(x, y, order, frequency_cutoff,
|
153
|
-
* amplitude_cutoff) -> image
|
154
|
-
*
|
155
|
-
* See Image.fmask_ideal_highpass
|
156
|
-
*/
|
157
|
-
|
158
|
-
VALUE
|
159
|
-
img_s_fmask_butterworth_highpass(VALUE obj, VALUE x, VALUE y,
|
160
|
-
VALUE order, VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
161
|
-
{
|
162
|
-
OutPartial(new, data, im);
|
163
|
-
|
164
|
-
if (im_create_fmask(im,
|
165
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_HIGHPASS, NUM2DBL(order),
|
166
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(amplitude_cutoff)))
|
167
|
-
vips_lib_error();
|
168
|
-
|
169
|
-
return new;
|
170
|
-
}
|
171
|
-
|
172
|
-
/*
|
173
|
-
* call-seq:
|
174
|
-
* Image.fmask_butterworth_lowpass(x, y, order, frequency_cutoff,
|
175
|
-
* amplitude_cutoff)
|
176
|
-
*
|
177
|
-
* See Image.fmask_ideal_highpass
|
178
|
-
*/
|
179
|
-
|
180
|
-
VALUE
|
181
|
-
img_s_fmask_butterworth_lowpass(VALUE obj, VALUE x, VALUE y,
|
182
|
-
VALUE order, VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
183
|
-
{
|
184
|
-
OutPartial(new, data, im);
|
185
|
-
|
186
|
-
if (im_create_fmask(im,
|
187
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_LOWPASS, NUM2DBL(order),
|
188
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(amplitude_cutoff)))
|
189
|
-
vips_lib_error();
|
190
|
-
|
191
|
-
return new;
|
192
|
-
}
|
193
|
-
|
194
|
-
/*
|
195
|
-
* call-seq:
|
196
|
-
* Image.fmask_gauss_highpass(x, y, frequency_cutoff, amplitude_cutoff) ->
|
197
|
-
* image
|
198
|
-
*
|
199
|
-
* See Image.fmask_ideal_highpass
|
200
|
-
*/
|
201
|
-
|
202
|
-
VALUE
|
203
|
-
img_s_fmask_gauss_highpass(VALUE obj, VALUE x, VALUE y,
|
204
|
-
VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
205
|
-
{
|
206
|
-
OutPartial(new, data, im);
|
207
|
-
|
208
|
-
if (im_create_fmask(im,
|
209
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_HIGHPASS,
|
210
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(amplitude_cutoff)))
|
211
|
-
vips_lib_error();
|
212
|
-
|
213
|
-
return new;
|
214
|
-
}
|
215
|
-
|
216
|
-
/*
|
217
|
-
* call-seq:
|
218
|
-
* Image.fmask_gauss_lowpass(x, y, frequency_cutoff, amplitude_cutoff) ->
|
219
|
-
* image
|
220
|
-
*
|
221
|
-
* See Image.fmask_ideal_highpass
|
222
|
-
*/
|
223
|
-
|
224
|
-
VALUE
|
225
|
-
img_s_fmask_gauss_lowpass(VALUE obj, VALUE x, VALUE y,
|
226
|
-
VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
227
|
-
{
|
228
|
-
OutPartial(new, data, im);
|
229
|
-
|
230
|
-
if (im_create_fmask(im,
|
231
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_LOWPASS,
|
232
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(amplitude_cutoff)))
|
233
|
-
vips_lib_error();
|
234
|
-
|
235
|
-
return new;
|
236
|
-
}
|
237
|
-
|
238
|
-
/*
|
239
|
-
* call-seq:
|
240
|
-
* Image.fmask_ideal_ringpass(x, y, frequency_cutoff, width) -> image
|
241
|
-
*
|
242
|
-
* See Image.fmask_ideal_highpass
|
243
|
-
*/
|
244
|
-
|
245
|
-
VALUE
|
246
|
-
img_s_fmask_ideal_ringpass(VALUE obj, VALUE x, VALUE y,
|
247
|
-
VALUE frequency_cutoff, VALUE width)
|
248
|
-
{
|
249
|
-
OutPartial(new, data, im);
|
250
|
-
|
251
|
-
if (im_create_fmask(im,
|
252
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_IDEAL_RINGPASS,
|
253
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(width)))
|
254
|
-
vips_lib_error();
|
255
|
-
|
256
|
-
return new;
|
257
|
-
}
|
258
|
-
|
259
|
-
/*
|
260
|
-
* call-seq:
|
261
|
-
* Image.fmask_ideal_ringreject(x, y, frequency_cutoff, width) -> image
|
262
|
-
*
|
263
|
-
* See Image.fmask_ideal_highpass
|
264
|
-
*/
|
265
|
-
|
266
|
-
VALUE
|
267
|
-
img_s_fmask_ideal_ringreject(VALUE obj, VALUE x, VALUE y,
|
268
|
-
VALUE frequency_cutoff, VALUE width)
|
269
|
-
{
|
270
|
-
OutPartial(new, data, im);
|
271
|
-
|
272
|
-
if (im_create_fmask(im,
|
273
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_IDEAL_RINGREJECT,
|
274
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(width)))
|
275
|
-
vips_lib_error();
|
276
|
-
|
277
|
-
return new;
|
278
|
-
}
|
279
|
-
|
280
|
-
/*
|
281
|
-
* call-seq:
|
282
|
-
* Image.fmask_butterworth_ringpass(x, y, order, frequency_cutoff,
|
283
|
-
* width, amplitude_cutoff) -> image
|
284
|
-
*
|
285
|
-
* See Image.fmask_ideal_highpass
|
286
|
-
*/
|
287
|
-
|
288
|
-
VALUE
|
289
|
-
img_s_fmask_butterworth_ringpass(VALUE obj, VALUE x, VALUE y,
|
290
|
-
VALUE order, VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
291
|
-
{
|
292
|
-
OutPartial(new, data, im);
|
293
|
-
|
294
|
-
if (im_create_fmask(im,
|
295
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_RINGPASS,
|
296
|
-
NUM2DBL(order), NUM2DBL(frequency_cutoff), NUM2DBL(width),
|
297
|
-
NUM2DBL(amplitude_cutoff)))
|
298
|
-
vips_lib_error();
|
299
|
-
|
300
|
-
return new;
|
301
|
-
}
|
302
|
-
|
303
|
-
/*
|
304
|
-
* call-seq:
|
305
|
-
* Image.fmask_butterworth_ringreject(x, y, order, frequency_cutoff,
|
306
|
-
* width, amplitude_cutoff) -> image
|
307
|
-
*
|
308
|
-
* See Image.fmask_ideal_highpass
|
309
|
-
*/
|
310
|
-
|
311
|
-
VALUE
|
312
|
-
img_s_fmask_butterworth_ringreject(VALUE obj, VALUE x, VALUE y,
|
313
|
-
VALUE order, VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
314
|
-
{
|
315
|
-
OutPartial(new, data, im);
|
316
|
-
|
317
|
-
if (im_create_fmask(im,
|
318
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_RINGREJECT,
|
319
|
-
NUM2DBL(order), NUM2DBL(frequency_cutoff), NUM2DBL(width),
|
320
|
-
NUM2DBL(amplitude_cutoff)))
|
321
|
-
vips_lib_error();
|
322
|
-
|
323
|
-
return new;
|
324
|
-
}
|
325
|
-
|
326
|
-
/*
|
327
|
-
* call-seq:
|
328
|
-
* Image.fmask_gauss_ringpass(x, y, frequency_cutoff, width,
|
329
|
-
* amplitude_cutoff) -> image
|
330
|
-
*
|
331
|
-
* See Image.fmask_ideal_highpass
|
332
|
-
*/
|
333
|
-
|
334
|
-
VALUE
|
335
|
-
img_s_fmask_gauss_ringpass(VALUE obj, VALUE x, VALUE y,
|
336
|
-
VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
337
|
-
{
|
338
|
-
OutPartial(new, data, im);
|
339
|
-
|
340
|
-
if (im_create_fmask(im,
|
341
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_RINGPASS,
|
342
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(width), NUM2DBL(amplitude_cutoff)))
|
343
|
-
vips_lib_error();
|
344
|
-
|
345
|
-
return new;
|
346
|
-
}
|
347
|
-
|
348
|
-
/*
|
349
|
-
* call-seq:
|
350
|
-
* Image.fmask_gauss_ringreject(x, y, frequency_cutoff, width,
|
351
|
-
* amplitude_cutoff) -> image
|
352
|
-
*
|
353
|
-
* See Image.fmask_ideal_highpass
|
354
|
-
*/
|
355
|
-
|
356
|
-
VALUE
|
357
|
-
img_s_fmask_gauss_ringreject(VALUE obj, VALUE x, VALUE y,
|
358
|
-
VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
359
|
-
{
|
360
|
-
OutPartial(new, data, im);
|
361
|
-
|
362
|
-
if (im_create_fmask(im,
|
363
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_RINGREJECT,
|
364
|
-
NUM2DBL(frequency_cutoff), NUM2DBL(width), NUM2DBL(amplitude_cutoff)))
|
365
|
-
vips_lib_error();
|
366
|
-
|
367
|
-
return new;
|
368
|
-
}
|
369
|
-
|
370
|
-
/*
|
371
|
-
* call-seq:
|
372
|
-
* Image.fmask_ideal_bandpass(x, y, frequency_cutoffx, frequency_cutoffy,
|
373
|
-
* radius) -> image
|
374
|
-
*
|
375
|
-
* See Image.fmask_ideal_highpass
|
376
|
-
*/
|
377
|
-
|
378
|
-
VALUE
|
379
|
-
img_s_fmask_ideal_bandpass(VALUE obj, VALUE x, VALUE y,
|
380
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius)
|
381
|
-
{
|
382
|
-
OutPartial(new, data, im);
|
383
|
-
|
384
|
-
if (im_create_fmask(im,
|
385
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_IDEAL_BANDPASS,
|
386
|
-
NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy),
|
387
|
-
NUM2DBL(radius)))
|
388
|
-
vips_lib_error();
|
389
|
-
|
390
|
-
return new;
|
391
|
-
}
|
392
|
-
|
393
|
-
/*
|
394
|
-
* call-seq:
|
395
|
-
* Image.fmask_ideal_bandreject(x, y, frequency_cutoffx, frequency_cutoffy,
|
396
|
-
* radius)
|
397
|
-
*
|
398
|
-
* See Image.fmask_ideal_highpass
|
399
|
-
*/
|
400
|
-
|
401
|
-
VALUE
|
402
|
-
img_s_fmask_ideal_bandreject(VALUE obj, VALUE x, VALUE y,
|
403
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius)
|
404
|
-
{
|
405
|
-
OutPartial(new, data, im);
|
406
|
-
|
407
|
-
if (im_create_fmask(im,
|
408
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_IDEAL_BANDREJECT,
|
409
|
-
NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy),
|
410
|
-
NUM2DBL(radius)))
|
411
|
-
vips_lib_error();
|
412
|
-
|
413
|
-
return new;
|
414
|
-
}
|
415
|
-
|
416
|
-
/*
|
417
|
-
* call-seq:
|
418
|
-
* Image.fmask_butterworth_bandpass(x, y, order, frequency_cutoffx,
|
419
|
-
* frequency_cutoffy, radius, amplitude_cutoff) -> image
|
420
|
-
*
|
421
|
-
* See Image.fmask_ideal_highpass
|
422
|
-
*/
|
423
|
-
|
424
|
-
VALUE
|
425
|
-
img_s_fmask_butterworth_bandpass(VALUE obj, VALUE x, VALUE y,
|
426
|
-
VALUE order, VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
427
|
-
VALUE amplitude_cutoff)
|
428
|
-
{
|
429
|
-
OutPartial(new, data, im);
|
430
|
-
|
431
|
-
if (im_create_fmask(im,
|
432
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_BANDPASS,
|
433
|
-
NUM2DBL(order), NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy),
|
434
|
-
NUM2DBL(radius), NUM2DBL(amplitude_cutoff)))
|
435
|
-
vips_lib_error();
|
436
|
-
|
437
|
-
return new;
|
438
|
-
}
|
439
|
-
|
440
|
-
/*
|
441
|
-
* call-seq:
|
442
|
-
* Image.fmask_butterworth_bandreject(x, y, order, frequency_cutoffx,
|
443
|
-
* frequency_cutoffy, radius, amplitude_cutoff) -> image
|
444
|
-
*
|
445
|
-
* See Image.fmask_ideal_highpass
|
446
|
-
*/
|
447
|
-
|
448
|
-
VALUE
|
449
|
-
img_s_fmask_butterworth_bandreject(VALUE obj, VALUE x, VALUE y,
|
450
|
-
VALUE order, VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
451
|
-
VALUE amplitude_cutoff)
|
452
|
-
{
|
453
|
-
OutPartial(new, data, im);
|
454
|
-
|
455
|
-
if (im_create_fmask(im,
|
456
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_BUTTERWORTH_BANDREJECT,
|
457
|
-
NUM2DBL(order), NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy),
|
458
|
-
NUM2DBL(radius), NUM2DBL(amplitude_cutoff)))
|
459
|
-
vips_lib_error();
|
460
|
-
|
461
|
-
return new;
|
462
|
-
}
|
463
|
-
|
464
|
-
/*
|
465
|
-
* call-seq:
|
466
|
-
* Image.fmask_gaus_bandpass(x, y, frequency_cutoffx, frequency_cutoffy,
|
467
|
-
* radius, amplitude_cutoff) -> image
|
468
|
-
*
|
469
|
-
* See Image.fmask_ideal_highpass
|
470
|
-
*/
|
471
|
-
|
472
|
-
VALUE
|
473
|
-
img_s_fmask_gauss_bandpass(VALUE obj, VALUE x, VALUE y,
|
474
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
475
|
-
VALUE amplitude_cutoff)
|
476
|
-
{
|
477
|
-
OutPartial(new, data, im);
|
478
|
-
|
479
|
-
if (im_create_fmask(im,
|
480
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_BANDPASS,
|
481
|
-
NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy), NUM2DBL(radius),
|
482
|
-
NUM2DBL(amplitude_cutoff)))
|
483
|
-
vips_lib_error();
|
484
|
-
|
485
|
-
return new;
|
486
|
-
}
|
487
|
-
|
488
|
-
/*
|
489
|
-
* call-seq:
|
490
|
-
* Image.fmask_gauss_bandreject, x, y, frequency_cutoffx, frequency_cutoffy,
|
491
|
-
* radius, amplitude_cutoff) -> image
|
492
|
-
*
|
493
|
-
* See Image.fmask_ideal_highpass
|
494
|
-
*/
|
495
|
-
|
496
|
-
VALUE
|
497
|
-
img_s_fmask_gauss_bandreject(VALUE obj, VALUE x, VALUE y,
|
498
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
499
|
-
VALUE amplitude_cutoff)
|
500
|
-
{
|
501
|
-
OutPartial(new, data, im);
|
502
|
-
|
503
|
-
if (im_create_fmask(im,
|
504
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_GAUSS_BANDREJECT,
|
505
|
-
NUM2DBL(frequency_cutoffx), NUM2DBL(frequency_cutoffy), NUM2DBL(radius),
|
506
|
-
NUM2DBL(amplitude_cutoff)))
|
507
|
-
vips_lib_error();
|
508
|
-
|
509
|
-
return new;
|
510
|
-
}
|
511
|
-
|
512
|
-
/*
|
513
|
-
* call-seq:
|
514
|
-
* Image.fmask_fractal_flt(x, y, fractal_dimension) -> image
|
515
|
-
*
|
516
|
-
* This mask is handy for filtering images of gaussian noise in order to create
|
517
|
-
* surfaces of a given fractal dimension. @fractal_dimension should be between
|
518
|
-
* 2 and 3.
|
519
|
-
*/
|
520
|
-
|
521
|
-
VALUE
|
522
|
-
img_s_fmask_fractal_flt(VALUE obj, VALUE x, VALUE y,
|
523
|
-
VALUE fractal_dimension)
|
524
|
-
{
|
525
|
-
OutPartial(new, data, im);
|
526
|
-
|
527
|
-
if (im_create_fmask(im,
|
528
|
-
NUM2INT(x), NUM2INT(y), VIPS_MASK_FRACTAL_FLT,
|
529
|
-
NUM2DBL(fractal_dimension)))
|
530
|
-
vips_lib_error();
|
531
|
-
|
532
|
-
return new;
|
533
|
-
}
|
534
|
-
|
535
|
-
#else
|
536
|
-
|
537
|
-
VALUE
|
538
|
-
img_s_fmask_ideal_highpass(VALUE obj, VALUE x, VALUE y,
|
539
|
-
VALUE frequency_cutoff)
|
540
|
-
{
|
541
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
542
|
-
}
|
543
|
-
|
544
|
-
VALUE
|
545
|
-
img_s_fmask_ideal_lowpass(VALUE obj, VALUE x, VALUE y,
|
546
|
-
VALUE frequency_cutoff)
|
547
|
-
{
|
548
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
549
|
-
}
|
550
|
-
|
551
|
-
VALUE
|
552
|
-
img_s_fmask_butterworth_highpass(VALUE obj, VALUE x, VALUE y,
|
553
|
-
VALUE order, VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
554
|
-
{
|
555
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
556
|
-
}
|
557
|
-
|
558
|
-
VALUE
|
559
|
-
img_s_fmask_butterworth_lowpass(VALUE obj, VALUE x, VALUE y,
|
560
|
-
VALUE order, VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
561
|
-
{
|
562
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
563
|
-
}
|
564
|
-
|
565
|
-
VALUE
|
566
|
-
img_s_fmask_gauss_highpass(VALUE obj, VALUE x, VALUE y,
|
567
|
-
VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
568
|
-
{
|
569
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
570
|
-
}
|
571
|
-
|
572
|
-
VALUE
|
573
|
-
img_s_fmask_gauss_lowpass(VALUE obj, VALUE x, VALUE y,
|
574
|
-
VALUE frequency_cutoff, VALUE amplitude_cutoff)
|
575
|
-
{
|
576
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
577
|
-
}
|
578
|
-
|
579
|
-
VALUE
|
580
|
-
img_s_fmask_ideal_ringpass(VALUE obj, VALUE x, VALUE y,
|
581
|
-
VALUE frequency_cutoff, VALUE width)
|
582
|
-
{
|
583
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
584
|
-
}
|
585
|
-
|
586
|
-
VALUE
|
587
|
-
img_s_fmask_ideal_ringreject(VALUE obj, VALUE x, VALUE y,
|
588
|
-
VALUE frequency_cutoff, VALUE width)
|
589
|
-
{
|
590
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
591
|
-
}
|
592
|
-
|
593
|
-
VALUE
|
594
|
-
img_s_fmask_butterworth_ringpass(VALUE obj, VALUE x, VALUE y,
|
595
|
-
VALUE order, VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
596
|
-
{
|
597
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
598
|
-
}
|
599
|
-
|
600
|
-
VALUE
|
601
|
-
img_s_fmask_butterworth_ringreject(VALUE obj, VALUE x, VALUE y,
|
602
|
-
VALUE order, VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
603
|
-
{
|
604
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
605
|
-
}
|
606
|
-
|
607
|
-
VALUE
|
608
|
-
img_s_fmask_gauss_ringpass(VALUE obj, VALUE x, VALUE y,
|
609
|
-
VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
610
|
-
{
|
611
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
612
|
-
}
|
613
|
-
|
614
|
-
VALUE
|
615
|
-
img_s_fmask_gauss_ringreject(VALUE obj, VALUE x, VALUE y,
|
616
|
-
VALUE frequency_cutoff, VALUE width, VALUE amplitude_cutoff)
|
617
|
-
{
|
618
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
619
|
-
}
|
620
|
-
|
621
|
-
VALUE
|
622
|
-
img_s_fmask_ideal_bandpass(VALUE obj, VALUE x, VALUE y,
|
623
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius)
|
624
|
-
{
|
625
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
626
|
-
}
|
627
|
-
|
628
|
-
VALUE
|
629
|
-
img_s_fmask_ideal_bandreject(VALUE obj, VALUE x, VALUE y,
|
630
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius)
|
631
|
-
{
|
632
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
633
|
-
}
|
634
|
-
|
635
|
-
VALUE
|
636
|
-
img_s_fmask_butterworth_bandpass(VALUE obj, VALUE x, VALUE y,
|
637
|
-
VALUE order, VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
638
|
-
VALUE amplitude_cutoff)
|
639
|
-
{
|
640
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
641
|
-
}
|
642
|
-
|
643
|
-
VALUE
|
644
|
-
img_s_fmask_butterworth_bandreject(VALUE obj, VALUE x, VALUE y,
|
645
|
-
VALUE order, VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
646
|
-
VALUE amplitude_cutoff)
|
647
|
-
{
|
648
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
649
|
-
}
|
650
|
-
|
651
|
-
VALUE
|
652
|
-
img_s_fmask_gauss_bandpass(VALUE obj, VALUE x, VALUE y,
|
653
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
654
|
-
VALUE amplitude_cutoff)
|
655
|
-
{
|
656
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
657
|
-
}
|
658
|
-
|
659
|
-
VALUE
|
660
|
-
img_s_fmask_gauss_bandreject(VALUE obj, VALUE x, VALUE y,
|
661
|
-
VALUE frequency_cutoffx, VALUE frequency_cutoffy, VALUE radius,
|
662
|
-
VALUE amplitude_cutoff)
|
663
|
-
{
|
664
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
665
|
-
}
|
666
|
-
|
667
|
-
VALUE
|
668
|
-
img_s_fmask_fractal_flt(VALUE obj, VALUE x, VALUE y,
|
669
|
-
VALUE fractal_dimension)
|
670
|
-
{
|
671
|
-
rb_raise(eVIPSError, "Operation not supported with your version of VIPS.");
|
672
|
-
}
|
673
|
-
|
674
|
-
#endif
|
675
|
-
|
676
|
-
/*
|
677
|
-
* call-seq:
|
678
|
-
* im.freqflt(other_image) -> image
|
679
|
-
*
|
680
|
-
* Filter an image in Fourier space.
|
681
|
-
*
|
682
|
-
* *self* is transformed to Fourier space, multipled with <i>other_image</i>,
|
683
|
-
* then transformed back to real space. If *self* is already a complex image,
|
684
|
-
* just multiply then inverse transform.
|
685
|
-
*/
|
686
|
-
|
687
|
-
VALUE
|
688
|
-
img_freqflt(VALUE obj, VALUE obj2)
|
689
|
-
{
|
690
|
-
RUBY_VIPS_BINARY(im_freqflt);
|
691
|
-
}
|
692
|
-
|
693
|
-
/*
|
694
|
-
* call-seq:
|
695
|
-
* im.disp_ps -> image
|
696
|
-
*
|
697
|
-
* Make a displayable (ie. 8-bit unsigned int) power spectrum.
|
698
|
-
*
|
699
|
-
* If *self* is non-complex, it is transformed to Fourier space. Then the
|
700
|
-
* absolute value is passed through Image#scaleps, and Image#rotquad.
|
701
|
-
*/
|
702
|
-
|
703
|
-
VALUE
|
704
|
-
img_disp_ps(VALUE obj)
|
705
|
-
{
|
706
|
-
RUBY_VIPS_UNARY(im_disp_ps);
|
707
|
-
}
|
708
|
-
|
709
|
-
/*
|
710
|
-
* call-seq:
|
711
|
-
* im.phasecor_fft(other_image) -> image
|
712
|
-
*
|
713
|
-
* Convert the two input images to Fourier space, calculate phase-correlation,
|
714
|
-
* back to real space.
|
715
|
-
*/
|
716
|
-
|
717
|
-
VALUE
|
718
|
-
img_phasecor_fft(VALUE obj, VALUE obj2)
|
719
|
-
{
|
720
|
-
RUBY_VIPS_BINARY(im_phasecor_fft);
|
721
|
-
}
|
722
|
-
|
723
|
-
/*
|
724
|
-
* call-seq:
|
725
|
-
* Image.fractsurf(size, frd) -> image
|
726
|
-
*
|
727
|
-
* Generate an image of size <i>size</i> and fractal dimension <i>frd</i>. The
|
728
|
-
* dimension should be between 2 and 3.
|
729
|
-
*/
|
730
|
-
|
731
|
-
VALUE
|
732
|
-
img_s_fractsurf(VALUE obj, VALUE size, VALUE frd)
|
733
|
-
{
|
734
|
-
OutPartial(new, data, im);
|
735
|
-
|
736
|
-
if (im_fractsurf(im, NUM2INT(size), NUM2DBL(frd)))
|
737
|
-
vips_lib_error();
|
738
|
-
|
739
|
-
return new;
|
740
|
-
}
|