From 5272d9116e9b844c94c4fbba6f97b0ffbbf4c6ec Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Fri, 25 May 2012 08:52:24 +0200 Subject: cvg: Add a pass-through filter And rename None to Hide. --- cvg.c | 25 +++++++++++++++++++------ cvg.ui | 3 ++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/cvg.c b/cvg.c index 78f3c96..b6fc76e 100644 --- a/cvg.c +++ b/cvg.c @@ -238,10 +238,21 @@ file_set(GtkFileChooserButton *widget, gpointer userdata) } static IplImage * -gauss_filter(struct cvg *cvg, IplImage *image) +pass_through_filter(struct cvg *cvg, IplImage *image) { IplImage *output; + output = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3); + cvCopy(image, output, NULL); + + return output; +} + +static IplImage * +gauss_filter(struct cvg *cvg, IplImage *image) +{ + IplImage *output; + output = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3); cvSmooth(image, output, CV_GAUSSIAN, 9, 9, 0, 0); @@ -249,7 +260,7 @@ gauss_filter(struct cvg *cvg, IplImage *image) } static IplImage * -none_filter(struct cvg *cvg, IplImage *image) +hide_filter(struct cvg *cvg, IplImage *image) { return NULL; } @@ -280,8 +291,10 @@ method_set(GtkComboBox *widget, gpointer userdata) return; if (strcmp(text, "Gauss") == 0) cvg->filter = gauss_filter; - else if (strcmp(text, "None") == 0) - cvg->filter = none_filter; + else if (strcmp(text, "Pass-Through") == 0) + cvg->filter = pass_through_filter; + else if (strcmp(text, "Hide") == 0) + cvg->filter = hide_filter; update_right_drawing_area(cvg); } @@ -291,7 +304,7 @@ main(int argc, char *argv[]) struct cvg cvg; GtkBuilder *builder; GObject *file_chooser; - GObject *comboxbox; + GObject *combobox; gchar *path, *file; int index = 0; @@ -340,7 +353,7 @@ main(int argc, char *argv[]) gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); cvg.idle_source = g_idle_add(capture, &cvg); - cvg.filter = none_filter; + cvg.filter = hide_filter; gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(builder, "win"))); g_object_unref(builder); gtk_main(); diff --git a/cvg.ui b/cvg.ui index 15c4e8b..4504994 100644 --- a/cvg.ui +++ b/cvg.ui @@ -81,8 +81,9 @@ False 0 - None + Hide Gauss + Pass-Through -- cgit