diff options
Diffstat (limited to 'image.c')
-rw-r--r-- | image.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include <glib.h> #include <gtk/gtk.h> #include "image.h" +#include "fft.h" complex_image_t * complex_image_new (int width, int height) @@ -50,6 +51,27 @@ complex_image_subtract (complex_image_t *image, complex_image_t *other) } } +void +complex_image_mul (complex_image_t *image, double m) +{ + int i, j; + int h = image->height; + int w = image->width; + + for (i = 0; i < h; ++i) + { + for (j = 0; j < w; ++j) + { + int idx = i * w + j; + + image->red[idx] = complex_smul (image->red[idx], m); + image->green[idx] = complex_smul (image->green[idx], m); + image->blue[idx] = complex_smul (image->blue[idx], m); + } + } +} + + complex_image_t * complex_image_from_pixbuf (GdkPixbuf *pixbuf) { @@ -215,3 +237,20 @@ complex_image_show (const char *title, gtk_main (); } + +void +complex_image_fft (complex_image_t *image) +{ + fft_shift_2d (image->red, image->width); + fft_shift_2d (image->green, image->width); + fft_shift_2d (image->blue, image->width); +} + +void +complex_image_ifft (complex_image_t *image) +{ + ifft_shift_2d (image->red, image->width); + ifft_shift_2d (image->green, image->width); + ifft_shift_2d (image->blue, image->width); +} + |