Hi Emanuel and Martin, Thank you very much! I have the code running now, I will try to make some processing and will surely need more help. The g++ command line I used is: g++ -I/home/robotica/Sol/camaras/drivers/gige/aravis/src -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp" and g++ -L/usr/lib -L/home/robotica/Sol/camaras/drivers/gige/aravis/src -L/usr/local/lib -o "test_gige" ./main.o -lglib-2.0 -laravis-0.4 Cheers! Sol 2014-04-11 9:16 GMT-03:00 Martin Kielhorn <kielhorn.martin@xxxxxxxxx>: > Hi Sol, > perhaps you would like to have a look on my code: > > https://github.com/plops/arduino_due_lisp/blob/master/arvexample.c > > I added fouriertransforms and have to compile like this (as currently in > the makefile): > gcc -g -O2 -o arv-example arvexample.c -MD -MP -MF -pthread > -I/usr/include/aravis-0.4 -I/usr/lib/glib-2.0/include > -I/usr/include/glib-2.0 -lm -L/usr/lib -lgio-2.0 -lgobject-2.0 -lxml2 > -lgthread-2.0 -pthread -lrt -lglib-2.0 -lz -laravis-0.4 -lglfw -lGL > -lfftw3 -lfftw3_threads > > Note, that I'm not sure if this code actually works. > I remember getting fed up with C because there were so many things I > didn't understand > from the docs and had to find out by experiment. Therefore, I switched to > Common Lisp (using Clozure CL) rather quickly. > > > Regards, Martin > > > > 2014-04-10 20:19 GMT+02:00 Sol Pedre <solpedre@xxxxxxxxx>: > > Hello, >> >> I have succesfully installed aravis and used the arv-viewer to see the >> input from a DFK 23GM021 The Imaging Source Gige camera. >> >> Now I am trying to use this camera from a C/C++ code that process images. >> To start, i am reading the aravis reference manual, and i am trying to >> compile the example in the ArvCamera reference page (I paste it below). >> >> However, i am finding several errors, i guess i am missing some library >> bindings and others. The first two errors are: >> >> Invalid arguments ' Candidates are: void arv_camera_set_region(_ArvCamera >> *, ?, ?, ?, ?) >> >> and >> >> Invalid arguments ' >> Candidates are: void arv_stream_set_emit_signals(_ArvStream *, ?) >> >> >> These both functions take gint as parameters, and the code passes gint, >> but it does not work. >> >> Please tell me which libraries i should be linking with and where they >> should be, and also any light you can shed in those errors... >> >> Thank you very much!! >> Sol >> >> >> --------------- >> >> Code: >> >> >> #include <arv.h> >> #include <glib.h> >> #include <glib-object.h> >> #include <stdlib.h> >> #include <signal.h> >> #include <stdio.h> >> >> typedef struct { >> GMainLoop *main_loop; >> int buffer_count; >> } ApplicationData; >> >> static gboolean cancel = FALSE; >> >> static void >> set_cancel (int signal) >> { >> cancel = TRUE; >> } >> >> static void >> new_buffer_cb (ArvStream *stream, ApplicationData *data) >> { >> ArvBuffer *buffer; >> >> buffer = arv_stream_try_pop_buffer (stream); >> if (buffer != NULL) { >> if (buffer->status == ARV_BUFFER_STATUS_SUCCESS) >> data->buffer_count++; >> /* Image processing here */ >> arv_stream_push_buffer (stream, buffer); >> } >> } >> >> static gboolean >> periodic_task_cb (void *abstract_data) >> { >> ApplicationData *data = (ApplicationData*)abstract_data; >> >> printf ("Frame rate = %d Hz\n", data->buffer_count); >> data->buffer_count = 0; >> >> if (cancel) { >> g_main_loop_quit (data->main_loop); >> return FALSE; >> } >> >> return TRUE; >> } >> >> static void >> control_lost_cb (ArvGvDevice *gv_device) >> { >> /* Control of the device is lost. Display a message and force >> application exit */ >> printf ("Control lost\n"); >> >> cancel = TRUE; >> } >> >> int >> main (int argc, char **argv) >> { >> ApplicationData data; >> ArvCamera *camera; >> ArvStream *stream; >> ArvBuffer *buffer; >> int i; >> >> data.buffer_count = 0; >> >> /* Mandatory glib type system initialization */ >> //arv_g_type_init(); >> g_type_init(); >> /* Instantiation of the first available camera */ >> camera = arv_camera_new (NULL); >> >> if (camera != NULL) { >> void (*old_sigint_handler)(int); >> gint payload; >> guint software_trigger_source = 0; >> >> /* Set region of interrest to a 200x200 pixel area */ >> arv_camera_set_region(camera, (gint)0, (gint)0, (gint)200, >> (gint)200); >> /* Set frame rate to 10 Hz */ >> arv_camera_set_frame_rate (camera, 10.0); >> /* retrieve image payload (number of bytes per image) */ >> payload = arv_camera_get_payload (camera); >> >> /* Create a new stream object */ >> stream = arv_camera_create_stream (camera, NULL, NULL); >> if (stream != NULL) { >> /* Push 50 buffer in the stream input buffer queue */ >> for (i = 0; i < 50; i++) >> arv_stream_push_buffer (stream, arv_buffer_new (payload, >> NULL)); >> >> /* Start the video stream */ >> arv_camera_start_acquisition (camera); >> >> /* Connect the new-buffer signal */ >> g_signal_connect (stream, "new-buffer", G_CALLBACK >> (new_buffer_cb), &data); >> /* And enable emission of this signal (it's disabled by >> default for performance reason) */ >> arv_stream_set_emit_signals(stream, TRUE); >> >> /* Connect the control-lost signal */ >> g_signal_connect (arv_camera_get_device (camera), >> "control-lost", >> G_CALLBACK (control_lost_cb), NULL); >> >> /* Install the callback for frame rate display */ >> g_timeout_add_seconds (1, periodic_task_cb, &data); >> >> /* Create a new glib main loop */ >> data.main_loop = g_main_loop_new (NULL, FALSE); >> >> old_sigint_handler = signal (SIGINT, set_cancel); >> >> /* Run the main loop */ >> g_main_loop_run (data.main_loop); >> >> signal (SIGINT, old_sigint_handler); >> >> g_main_loop_unref (data.main_loop); >> >> /* Stop the video stream */ >> arv_camera_stop_acquisition (camera); >> >> g_object_unref (stream); >> } else >> printf ("Can't create stream thread (check if the device is >> not already used)\n"); >> >> g_object_unref (camera); >> } else >> printf ("No camera found\n"); >> >> return 0; >> } >> >> > > > -- > Martin Kielhorn > Leibniz-Institute of Photonic Technology, Albert-Einstein Str. 9, 07745 > Jena, > Germany > Tel.: +49 (0) 3641 206 245 > Randall Division of Cell & Molecular Biophysics, King's College London, > NHH, > Guy's Campus, London SE1 1UL, U.K. > tel: +44 (0) 207 848 6519, fax: +44 (0) 207 848 6435 > >