![]() |
![]() |
![]() |
Aravis Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
enum ArvAuto; ArvAuto arv_auto_from_string (const char *string
); const char * arv_auto_to_string (ArvAuto value
); ArvCamera; ArvCamera * arv_camera_new (const char *name
); ArvStream * arv_camera_create_stream (ArvCamera *camera
,ArvStreamCallback callback
,void *user_data
); ArvDevice * arv_camera_get_device (ArvCamera *camera
); const char * arv_camera_get_vendor_name (ArvCamera *camera
); const char * arv_camera_get_model_name (ArvCamera *camera
); const char * arv_camera_get_device_id (ArvCamera *camera
); void arv_camera_get_sensor_size (ArvCamera *camera
,gint *width
,gint *height
); void arv_camera_set_region (ArvCamera *camera
,gint x
,gint y
,gint width
,gint height
); void arv_camera_get_region (ArvCamera *camera
,gint *x
,gint *y
,gint *width
,gint *height
); void arv_camera_get_height_bounds (ArvCamera *camera
,gint *min
,gint *max
); void arv_camera_get_width_bounds (ArvCamera *camera
,gint *min
,gint *max
); void arv_camera_set_binning (ArvCamera *camera
,gint dx
,gint dy
); void arv_camera_get_binning (ArvCamera *camera
,gint *dx
,gint *dy
); void arv_camera_set_pixel_format (ArvCamera *camera
,ArvPixelFormat format
); ArvPixelFormat arv_camera_get_pixel_format (ArvCamera *camera
); const char * arv_camera_get_pixel_format_as_string (ArvCamera *camera
); void arv_camera_set_pixel_format_from_string (ArvCamera *camera
,const char *format
); gint64 * arv_camera_get_available_pixel_formats (ArvCamera *camera
,guint *n_pixel_formats
); const char ** arv_camera_get_available_pixel_formats_as_display_names (ArvCamera *camera
,guint *n_pixel_formats
); const char ** arv_camera_get_available_pixel_formats_as_strings (ArvCamera *camera
,guint *n_pixel_formats
); void arv_camera_start_acquisition (ArvCamera *camera
); void arv_camera_stop_acquisition (ArvCamera *camera
); void arv_camera_set_acquisition_mode (ArvCamera *camera
,ArvAcquisitionMode value
); ArvAcquisitionMode arv_camera_get_acquisition_mode (ArvCamera *camera
); gboolean arv_camera_is_frame_rate_available (ArvCamera *camera
); void arv_camera_set_frame_rate (ArvCamera *camera
,double frame_rate
); double arv_camera_get_frame_rate (ArvCamera *camera
); void arv_camera_set_trigger (ArvCamera *camera
,const char *source
); void arv_camera_set_trigger_source (ArvCamera *camera
,const char *source
); const char * arv_camera_get_trigger_source (ArvCamera *camera
); void arv_camera_software_trigger (ArvCamera *camera
); gboolean arv_camera_is_exposure_time_available (ArvCamera *camera
); gboolean arv_camera_is_exposure_auto_available (ArvCamera *camera
); void arv_camera_set_exposure_time (ArvCamera *camera
,double exposure_time_us
); double arv_camera_get_exposure_time (ArvCamera *camera
); void arv_camera_get_exposure_time_bounds (ArvCamera *camera
,double *min
,double *max
); void arv_camera_set_exposure_time_auto (ArvCamera *camera
,ArvAuto auto_mode
); ArvAuto arv_camera_get_exposure_time_auto (ArvCamera *camera
); gboolean arv_camera_is_gain_available (ArvCamera *camera
); gboolean arv_camera_is_gain_auto_available (ArvCamera *camera
); void arv_camera_set_gain (ArvCamera *camera
,double gain
); double arv_camera_get_gain (ArvCamera *camera
); void arv_camera_get_gain_bounds (ArvCamera *camera
,double *min
,double *max
); void arv_camera_set_gain_auto (ArvCamera *camera
,ArvAuto auto_mode
); ArvAuto arv_camera_get_gain_auto (ArvCamera *camera
); guint arv_camera_get_payload (ArvCamera *camera
); enum ArvAcquisitionMode; const char * arv_acquisition_mode_to_string (ArvAcquisitionMode value
); ArvAcquisitionMode arv_acquisition_mode_from_string (const char *string
);
ArvCamera is a class for the generic control of cameras. It hides the complexity of the genicam interface by providing a simple API, with the drawback of not exposing all the available features. See ArvDevice and ArvGc for a more advanced use of the Aravis library.
Example 1. Sample application of the ArvCamera API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
#include <arv.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 = 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 */ 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, 0, 0, 200, 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; } |
ArvCamera * arv_camera_new (const char *name
);
Creates a new ArvCamera. If name
is null, it will instantiate the
first available camera.
|
name of the camera. [allow-none] |
Returns : |
a new ArvCamera. |
Since 0.2.0
ArvStream * arv_camera_create_stream (ArvCamera *camera
,ArvStreamCallback callback
,void *user_data
);
Creates a new ArvStream for video stream handling. See ArvStreamCallback for details regarding the callback function.
|
a ArvCamera |
|
a frame processing callback. [scope call][allow-none] |
|
user data for callback . [closure][allow-none]
|
Returns : |
a new ArvStream. [transfer full] |
Since 0.2.0
ArvDevice * arv_camera_get_device (ArvCamera *camera
);
Retrieves the ArvDevice object for more complete access to camera features.
|
a ArvCamera |
Returns : |
underlying device object. [transfer none] |
Since 0.2.0
const char * arv_camera_get_vendor_name (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
the camera vendor name. |
Since 0.2.0
const char * arv_camera_get_model_name (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
the camera model name. |
Since 0.2.0
const char * arv_camera_get_device_id (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
the camera device ID. |
Since 0.2.0
void arv_camera_get_sensor_size (ArvCamera *camera
,gint *width
,gint *height
);
|
a ArvCamera |
|
camera sensor width. [out] |
|
camera sensor height. [out] |
Since 0.2.0
void arv_camera_set_region (ArvCamera *camera
,gint x
,gint y
,gint width
,gint height
);
Defines the region of interest which will be transmitted in the video stream.
|
a ArvCamera |
|
x offset |
|
y_offset |
|
region width |
|
region height |
Since 0.2.0
void arv_camera_get_region (ArvCamera *camera
,gint *x
,gint *y
,gint *width
,gint *height
);
Retrieves the current region of interest.
|
a ArvCamera |
|
x offset. [out] |
|
y_offset. [out] |
|
region width. [out] |
|
region height. [out] |
Since 0.2.0
void arv_camera_get_height_bounds (ArvCamera *camera
,gint *min
,gint *max
);
Retrieves the valid range for image height.
|
a ArvCamera |
|
minimum height. [out] |
|
maximum height. [out] |
Since 0.2.0
void arv_camera_get_width_bounds (ArvCamera *camera
,gint *min
,gint *max
);
Retrieves the valid range for image width.
|
a ArvCamera |
|
minimum width. [out] |
|
maximum width. [out] |
Since 0.2.0
void arv_camera_set_binning (ArvCamera *camera
,gint dx
,gint dy
);
Defines binning in both directions. Not all cameras support this feature.
|
a ArvCamera |
|
horizontal binning |
|
vertical binning |
Since 0.2.0
void arv_camera_get_binning (ArvCamera *camera
,gint *dx
,gint *dy
);
Retrieves binning in both directions.
|
a ArvCamera |
|
horizontal binning placeholder. [out] |
|
vertical binning placeholder. [out] |
Since 0.2.0
void arv_camera_set_pixel_format (ArvCamera *camera
,ArvPixelFormat format
);
Defines pixel format.
|
a ArvCamera |
|
pixel format |
Since 0.2.0
ArvPixelFormat arv_camera_get_pixel_format (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
pixel format. |
Since 0.2.0
const char * arv_camera_get_pixel_format_as_string
(ArvCamera *camera
);
Retuns: pixel format as string, NULL on error.
|
a ArvCamera |
Since 0.2.0
void arv_camera_set_pixel_format_from_string (ArvCamera *camera
,const char *format
);
Defines pixel format described by a string.
|
a ArvCamera |
|
pixel format |
Since 0.2.0
gint64 * arv_camera_get_available_pixel_formats (ArvCamera *camera
,guint *n_pixel_formats
);
Retrieves the list of all available pixel formats.
|
a ArvCamera |
|
number of different pixel formats. [out] |
Returns : |
a newly allocated array of ArvPixelFormat. [array length=n_pixel_formats][transfer container] |
Since 0.2.0
const char ** arv_camera_get_available_pixel_formats_as_display_names (ArvCamera *camera
,guint *n_pixel_formats
);
Retrieves the list of all available pixel formats as display names. In general, these human-readable strings cannot be used as settings.
|
a ArvCamera |
|
number of different pixel formats. [out] |
Returns : |
a newly allocated array of string constants. [array length=n_pixel_formats][transfer container] |
Since 0.2.0
const char ** arv_camera_get_available_pixel_formats_as_strings (ArvCamera *camera
,guint *n_pixel_formats
);
Retrieves the list of all available pixel formats as strings.
|
a ArvCamera |
|
number of different pixel formats. [out] |
Returns : |
a newly allocated array of strings. [array length=n_pixel_formats][transfer container] |
Since 0.2.0
void arv_camera_start_acquisition (ArvCamera *camera
);
Starts video stream acquisition.
|
a ArvCamera |
Since 0.2.0
void arv_camera_stop_acquisition (ArvCamera *camera
);
Stops video stream acquisition.
|
a ArvCamera |
Since 0.2.0
void arv_camera_set_acquisition_mode (ArvCamera *camera
,ArvAcquisitionMode value
);
ArvAcquisitionMode arv_camera_get_acquisition_mode (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
acquisition mode. |
Since 0.2.0
gboolean arv_camera_is_frame_rate_available (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
TRUE if FrameRate feature is available |
Since 0.2.0
void arv_camera_set_frame_rate (ArvCamera *camera
,double frame_rate
);
Configures a fixed frame rate mode. Once acquisition start is triggered, the video stream will be acquired with the given frame rate.
|
a ArvCamera |
|
frame rate, in Hz |
Since 0.2.0
double arv_camera_get_frame_rate (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
actual frame rate, in Hz. |
Since 0.2.0
void arv_camera_set_trigger (ArvCamera *camera
,const char *source
);
Configures the camera in trigger mode. Typical values for source are "Line1" or "Line2". See the camera documentation for the allowed values. Activation is set to rising edge. It can be changed by accessing the underlying device object.
Source can also be "Software". In this case, an acquisition is triggered
by a call to arv_camera_software_trigger()
.
|
a ArvCamera |
|
trigger source as string |
Since 0.2.0
void arv_camera_set_trigger_source (ArvCamera *camera
,const char *source
);
Sets the trigger source. This function doesn't check if the camera is configured to actually use this source as a trigger.
|
a ArvCamera |
|
source name |
Since 0.2.0
const char * arv_camera_get_trigger_source (ArvCamera *camera
);
Gets the trigger source. This function doesn't check if the camera is configured to actually use this source as a trigger.
|
a ArvCamera |
Returns : |
a string containing the trigger source name, NULL on error. |
Since 0.2.0
void arv_camera_software_trigger (ArvCamera *camera
);
Sends a software trigger command to camera
. The camera must be previously
configured to use a software trigger, using
.
arv_camera_set_trigger()
|
a ArvCamera |
Since 0.2.0
gboolean arv_camera_is_exposure_time_available
(ArvCamera *camera
);
|
a ArvCamera |
Returns : |
TRUE if Exposure Time feature is available. |
Since 0.2.0
gboolean arv_camera_is_exposure_auto_available
(ArvCamera *camera
);
|
a ArvCamera |
Returns : |
TRUE if Exposure Auto feature is available. |
Since 0.2.0
void arv_camera_set_exposure_time (ArvCamera *camera
,double exposure_time_us
);
Sets exposure time. User should take care to set a value compatible with the desired frame rate.
|
a ArvCamera |
|
exposure time, in µs |
Since 0.2.0
double arv_camera_get_exposure_time (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
current exposure time, in µs. |
Since 0.2.0
void arv_camera_get_exposure_time_bounds (ArvCamera *camera
,double *min
,double *max
);
Retrieves exposure time bounds, in µs.
|
a ArvCamera |
|
minimum exposure time. [out] |
|
maximum exposure time. [out] |
Since 0.2.0
void arv_camera_set_exposure_time_auto (ArvCamera *camera
,ArvAuto auto_mode
);
Configures automatic exposure feature.
|
a ArvCamera |
|
auto exposure mode selection |
Since 0.2.0
ArvAuto arv_camera_get_exposure_time_auto (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
auto exposure mode selection |
Since 0.2.0
gboolean arv_camera_is_gain_available (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
TRUE if Gain feature is available. |
Since 0.2.0
gboolean arv_camera_is_gain_auto_available (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
TRUE if Gain feature is available. |
Since 0.2.0
void arv_camera_set_gain (ArvCamera *camera
,double gain
);
Sets the gain of the ADC converter.
|
a ArvCamera |
|
gain value |
Since 0.2.0
double arv_camera_get_gain (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
the current gain setting. |
Since 0.2.0
void arv_camera_get_gain_bounds (ArvCamera *camera
,double *min
,double *max
);
Retrieves gain bounds.
|
a ArvCamera |
|
minimum gain. [out] |
|
maximum gain. [out] |
Since 0.2.0
void arv_camera_set_gain_auto (ArvCamera *camera
,ArvAuto auto_mode
);
Configures automatic gain feature.
|
a ArvCamera |
|
auto gain mode selection |
Since 0.2.0
ArvAuto arv_camera_get_gain_auto (ArvCamera *camera
);
|
a ArvCamera |
Returns : |
auto gain mode selection |
Since 0.2.0
guint arv_camera_get_payload (ArvCamera *camera
);
Retrieves the size needed for the storage of an image. This value is used for the creation of the stream buffers.
|
a ArvCamera |
Returns : |
frame storage size, in bytes. |
Since 0.2.0
typedef enum { ARV_ACQUISITION_MODE_CONTINUOUS, ARV_ACQUISITION_MODE_SINGLE_FRAME } ArvAcquisitionMode;
const char * arv_acquisition_mode_to_string (ArvAcquisitionMode value
);
ArvAcquisitionMode arv_acquisition_mode_from_string (const char *string
);
"device"
property"device" ArvDevice* : Read / Write / Construct Only
the device associated with this camera.