6
* \mainpage pfGrab DLL Documentation
8
* \author Photonfocus AG
11
* \section Intro Introduction
12
* In order to ease the acquisition of frames suitable to be used with 3rd party
13
* application we offer a range of frame grabber drivers along with our Pflib SDK
14
* or alternative the PFConfig library. Each frame grabber driver file is an
15
* ordinary shared library called DLL file in Windows. That exposes a known
16
* C interface in order to use a vendor-specific grabber SDK or API.
18
* There are examples available about how to use the pfGrab DLL.
29
#define PFGRAB_API extern "C" __declspec(dllexport)
31
#define PFGRAB_API __declspec(dllexport)
36
#define PFGRAB_API extern "C" __declspec(dllimport)
38
#define PFGRAB_API __declspec(dllimport)
51
PFGRAB_ERROR_UNKNOWN = -1,
53
/* Memory allocation. */
54
PFGRAB_ERROR_MEMORY = -2,
56
/* The file is not found or an invalid format. */
57
PFGRAB_ERROR_INVALID_FILE = -5,
59
/* The frame grabber has not being started to grab yet. */
60
PFGRAB_ERROR_FRAME_GRABBER_NOT_STARTED = -8,
62
/* The frame grabber has been stopped while waiting for a frame. */
63
PFGRAB_ERROR_FRAME_GRABBER_STOPPED = -9,
65
/* The area is invalid. */
66
PFGRAB_ERROR_INVALID_AREA = -10,
68
/* There was a timeout performing the operation. */
69
PFGRAB_ERROR_TIMEOUT = -16,
71
/* A frame grabber driver reported some error unknown to the PFGRAB API. */
72
PFGRAB_ERROR_FRAME_GRABBER_UNKNOWN = -18,
79
/// \brief Initializes the frame grabber driver.
81
/// \param[in] The string parameter is a free-form string to create a new pfGrab object.
82
/// It will be used to specify the frame grabber's configuration file,
83
/// the port to use or even which ones of the system installed frame grabbers to use.
84
/// This string is driver-specific and is documented for every frame grabber driver,
85
/// even if it gets ignored by the driver.
87
/// \return The return value is the pointer to the driverData.
88
/// This pointer is later passed as a void pointer to all other functions
89
/// in order to operate on the correct data. If there was an error in the initialization
90
/// of the frame grabber driver the return value is NULL.
92
PFGRAB_API void* pfGrab_InitFG (int port, const char *fgName, const char *param);
95
/// \brief Most frame grabbers, for performance reasons, can be configured with a
96
/// region of interest (ROI) that specifies which part of the whole image we are
97
/// interested and the grabber device will only transfer the data of that region.
98
/// Normally the region of interest is specified in the configuration file for the
99
/// frame grabber but some applications require change the size of the ROI.
100
/// If the new region of interest's size could be set successful the function returns
101
/// PFGRAB_ERROR_OK=0. If the given width or height is not allowed the function corrects
102
/// the value and returns the new value. Keep in mind that the user is instructed to never
103
/// change the region of interest while grabbing images.
105
/// \param[in] driverData The pointer to the driverData.
106
/// \param[in] width Image width to set
107
/// \param[in] height Image height to set
109
/// \return PFGRAB_ERROR_OK if successful otherwise error code.
111
PFGRAB_API long pfGrab_SetSize (void *driverData, long *width, long *height);
114
/// \brief The function pfGrab_StartGrab instructs the frame grabber driver
115
/// to start grabbing new frames. This function initialize the FG callbacks,
116
/// queues, and any other data structure given by the grabber device's vendor.
118
/// \param[in] driverData The pointer to the driverData.
120
/// \return Return PFGRAB_ERROR_OK if there was no error starting
121
/// to acquire new frames.
123
PFGRAB_API long pfGrab_StartGrab (void * driverData);
126
/// \brief A call to pfGrab_Wait means that pfGrab is waiting
127
/// for the frame grabber driver to acquire a new frame.
128
/// From the point of view of pfGrab a new frame is whatever
129
/// the grabber device acquired since the last call to pfGrab_StartGrab
130
/// or pfGrab_Wait. That means that if since the last call to wait
131
/// three new frames have been acquired then the next call to wait won't
132
/// need to wait to acquire the next frame, it is already available.
134
/// \param[in] driverData The pointer to the driverData.
135
/// \param[in] timeout The parameter expressed in milliseconds that sets
136
/// the maximum number of milliseconds to wait for the next frame.
137
/// If the driver wasn't able to acquire a new frame in the specified
138
/// number of milliseconds then it returns PFGRAB_ERROR_TIMEOUT.
139
/// Take into account that a negative number of milliseconds as timeout
140
/// means that the driver must ignore the timeout and just wait
141
/// until there's a frame available.
143
/// \return Return PFGRAB_ERROR_OK if a new image is available.
145
PFGRAB_API long pfGrab_Wait (void * driverData, long timeout);
149
/// \brief The function pfGrab_GetImage is called by the application
150
/// when there was a successful call to pfGrab_Wait. The purposes
151
/// of this function if to get the pointer to the frame object
152
/// that was created while waiting for an acquisition.
154
/// \param[in] driverData The pointer to the driverData.
155
/// \param[in] buffer Passing an optional buffer address for copying
156
/// the image data to the destination of the buffer address. If the
157
/// buffer address is NULL, the parameter is ignored.
158
/// \param[in] size In the case a buffer address is passed, the
159
/// function copies the number of bytes defined in size to the
160
/// buffer destination.
162
/// \return The pointer to the frame object that was created
163
/// while waiting for an acquisition.
165
PFGRAB_API void* pfGrab_GetImage (void * driverData, void* buffer, long* bufferSize);
169
/// \brief The function pfGrab_StopGrab is called when the user is not
170
/// interested in receiving more frames. The driver tells the hardware to
171
/// stop acquiring frames and, if it kept a queue, to clean up the
172
/// acquired frames that weren't returned to the user.
174
/// \param[in] driverData The pointer to the driverData.
176
/// \return Return PFGRAB_ERROR_OK if there was no error starting
177
/// to acquire new frames.
179
PFGRAB_API long pfGrab_StopGrab(void *driverData);
183
/// \brief When pfGrab no longer needs to keep the driver around because
184
/// no one is using it anymore the driver must clean up its own resources.
185
/// The application should call the release function when the driver
186
/// must clean up itself
188
/// \param[in] driverData The pointer to the driverData.
191
PFGRAB_API void pfGrab_ReleaseFG (void * driverData);