Advertisement
Guest User

Untitled

a guest
May 24th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #include <glib-object.h>
  2. #include <uca/uca-plugin-manager.h>
  3. #include <uca/uca-camera.h>
  4.  
  5. int FRAME_COUNT = 100;
  6. int PIXEL_COUNT = 1080 * 720;
  7. GError *error = NULL;
  8.  
  9. // ...
  10. // The libuca framework requires the camera object to be instantiated like this
  11. // The string "phantom" indicates the use of the phantom camera plugin
  12. manager = uca_plugin_manager_new();
  13. camera = uca_plugin_manager_get_camera(manager, "phantom", &error, (gchar)"");
  14.  
  15. // Setting the attribute "post-trigger-frames" will tell the camera how many frames
  16. // it is supposed to record into its internal memory following the reception of a trigger
  17. // command.
  18. g_object_set(G_OBJECT(camera), "post-trigger-frames", FRAME_COUNT, NULL);
  19. uca_camera_trigger(camera, &error);
  20.  
  21. // ...
  22. // After the images have been recorded, they can be pulled from the internal memory using
  23. // the "memread" mode. For that a boolean flag has to be set and the amount of frames have
  24. // to be specified
  25. g_object_set(G_OBJECT(camera), "enable-memread", TRUE, NULL);
  26. g_object_set(G_OBJECT(camera), "memread-count", FRAME_COUNT, NULL);
  27.  
  28. // The request to receive all the frames will be sent after the first "grab" call was made.
  29. // Each successive call to the "grab" function will return the next image from the memory.
  30. gpointer buffer = g_malloc0(PIXEL_COUNT);
  31. for (int i=0; i <= FRAME_COUNT; i++) {
  32. uca_camera_grab(camera, buffer, &error);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement