diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2016-04-27 21:21:50 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2016-04-27 21:21:50 +0200 |
commit | 4b54c6a0d951b7075c2f258435a7e3da6dd8a34f (patch) | |
tree | 6f8ddc031f9b8cc655a955bcd1f622ded52c4e30 | |
parent | 637c021570fb610a75377bd2dedd2f253dc8f07f (diff) | |
download | cv-wip.tar.gz cv-wip.tar.bz2 cv-wip.zip |
WIPwip
-rw-r--r-- | cvg.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -195,7 +195,7 @@ key_event(GtkWidget *widget, GdkEventKey *event, gpointer userdata) break; case GDK_KEY_c: case GDK_KEY_C: - if (!cvg->idle_source) + if (!cvg->idle_source && cvg->capture) cvg->idle_source = g_idle_add(capture, cvg); break; case GDK_KEY_q: @@ -375,9 +375,10 @@ main(int argc, char *argv[]) cvg.capture = cvCreateCameraCapture(index); if (!cvg.capture) { fprintf(stderr, "ERROR: capture is NULL \n"); - exit(EXIT_FAILURE); + //exit(EXIT_FAILURE); } + if (cvg.capture) { #if 1 cvSetCaptureProperty(cvg.capture, CV_CAP_PROP_FRAME_WIDTH, 10000); cvSetCaptureProperty(cvg.capture, CV_CAP_PROP_FRAME_HEIGHT, 10000); @@ -386,6 +387,7 @@ main(int argc, char *argv[]) printf("width: %.f, height: %.f\n", cvGetCaptureProperty(cvg.capture, CV_CAP_PROP_FRAME_WIDTH), cvGetCaptureProperty(cvg.capture, CV_CAP_PROP_FRAME_HEIGHT)); + } builder = gtk_builder_new(); path = g_path_get_dirname(argv[0]); @@ -410,7 +412,8 @@ main(int argc, char *argv[]) combobox = gtk_builder_get_object(builder, "comboboxtext1"); gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); - cvg.idle_source = g_idle_add(capture, &cvg); + if (cvg.capture) + cvg.idle_source = g_idle_add(capture, &cvg); cvg.filter = hide_filter; gtk_widget_show_all(GTK_WIDGET(gtk_builder_get_object(builder, "win"))); g_object_unref(builder); |