Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <glib-object.h>
- #include <uca/uca-plugin-manager.h>
- #include <uca/uca-camera.h>
- int FRAME_COUNT = 100;
- int PIXEL_COUNT = 1080 * 720;
- GError *error = NULL;
- // ...
- // The libuca framework requires the camera object to be instantiated like this
- // The string "phantom" indicates the use of the phantom camera plugin
- manager = uca_plugin_manager_new();
- camera = uca_plugin_manager_get_camera(manager, "phantom", &error, (gchar)"");
- // Setting the attribute "post-trigger-frames" will tell the camera how many frames
- // it is supposed to record into its internal memory following the reception of a trigger
- // command.
- g_object_set(G_OBJECT(camera), "post-trigger-frames", FRAME_COUNT, NULL);
- uca_camera_trigger(camera, &error);
- // ...
- // After the images have been recorded, they can be pulled from the internal memory using
- // the "memread" mode. For that a boolean flag has to be set and the amount of frames have
- // to be specified
- g_object_set(G_OBJECT(camera), "enable-memread", TRUE, NULL);
- g_object_set(G_OBJECT(camera), "memread-count", FRAME_COUNT, NULL);
- // The request to receive all the frames will be sent after the first "grab" call was made.
- // Each successive call to the "grab" function will return the next image from the memory.
- gpointer buffer = g_malloc0(PIXEL_COUNT);
- for (int i=0; i <= FRAME_COUNT; i++) {
- uca_camera_grab(camera, buffer, &error);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement