MIL_ID DigId, | //in |
const MIL_ID *DestImageArrayPtr, | //in |
MIL_INT ImageCount, | //in |
MIL_INT64 Operation, | //in |
MIL_INT64 OperationFlag, | //in |
MIL_DIG_HOOK_FUNCTION_PTR HookHandlerPtr, | //in |
void *UserDataPtr | //in |
This function uses the specified digitizer to acquire images and store them sequentially in a list of buffers. It also hooks a user-defined function to the modification of any buffer in the specified list. So every time a new frame is grabbed in a buffer in the list, the user-defined function is called.
If set synchronously, MdigProcess() will block the thread until the list of sequential grabs has completed. If set asynchronously, the buffers are prepared, and then control is returned to the calling thread while, in the background, the grabs will begin.
The grabs can stop at the end of the list of buffers, after a predefined number of grabs occur, or when a stop instruction is explicitly given. Round-robin grabbing will occur when the number of grabs exceeds the number of buffers available. To grab until a stop instruction, you must call MdigProcess() with M_START; when you want to stop grabbing, you must call MdigProcess() with M_STOP. Note that in this case, if you do not issue a stop instruction, an endless loop is created.
When grabbing round-robin, if the average time it takes to process a frame is greater than the frame rate of a camera, frames will eventually be missed.
The buffers are filled with the grabbed data in the order in which they are stored in the list. The index of the buffer modified can be inquired using MdigGetHookInfo() with M_MODIFIED_BUFFER + M_BUFFER_INDEX. The MIL identifier of the buffer modified can be inquired using MdigGetHookInfo() with M_MODIFIED_BUFFER + M_BUFFER_ID. To identify whether the buffer modified (that is, the current frame) is corrupt, use MdigGetHookInfo() with M_CORRUPTED_FRAME.
Note that, by default, if a buffer modification event occurs while a buffer is being processed by the hooked user-defined function, the event is queued. When running on a computer with multiple CPUs, you can have the event handled by different instances of the user defined function running on different threads. To do so, use MsysControl() with M_MODIFIED_BUFFER_HOOK_MODE set to M_MULTI_THREAD.
When the specified digitizer is set to perform triggered grabs, the default behavior of the function is to wait for a trigger event before grabbing each frame. To grab all or a specific number of frames per trigger, set the OperationFlag parameter to M_TRIGGER_FOR_FIRST_GRAB and use the Operation parameter to specify how many frames to grab per trigger. To grab continuously after just one trigger, use + M_FRAMES_PER_TRIGGER() set to M_INFINITE with M_TRIGGER_FOR_FIRST_GRAB.
It is not recommended to change the digitizer settings of the digitizer currently being used when grabs are still pending.
This function transparently sets up the camera to start the acquisition of images, in either streaming or triggered mode, depending on your settings. If the camera is in triggered mode, it will start waiting for a trigger. To control this behavior, use MdigControl() with M_GC_STREAMING_MODE.
When grabbing from a video or directory of images, once the last image is grabbed, grabbing will restart from the beginning of the video or from the first image in the directory.
Specifies the address of the array containing the identifiers of the buffers in which to place the grabbed images. The buffers should be of an appropriate type and depth to hold the grabbed images. To allocate each buffer, use MbufAlloc...() with M_GRAB. When a buffer is no longer required, release it, using MbufFree().
Note the image buffers in the array must not have a region of interest (ROI) associated with them. Using an image buffer with an ROI will cause an error.
Specifies the type of operation to perform.
This parameter should be set to one of the following values:
For specifying the type of operation to
perform
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_SEQUENCE + |
Grabs a specific number of frames, storing them sequentially in a list of buffers. (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | |||||||||||||||||||
M_START + |
Starts grabbing round-robin into the list of buffers; the grabs will continue until stopped (using MdigProcess() with M_STOP). (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | |||||||||||||||||||
M_STOP + |
Stops the grab. (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s |
You can add the following value to the above-mentioned value to specify that previously queued grabs should not be cancelled when stopping .
For M_STOP
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_WAIT |
Stops queuing new grabs and waits for all previously queued grabs to finish before returning control to the Host. |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s |
You can add the following value to the above-mentioned value to specify the number of frames to grab .
For M_SEQUENCE
|
||||||||||||||||||||||||||||||||||||||||||
Combination value |
Description
|
MIL system-specific tooltip (†) |
||||||||||||||||||||||||||||||||||||||||
Specifies the number of frames to grab in the sequence. (more details...) |
† | † | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | ||||
Parameters | ||||||||||||||||||||||||||||||||||||||||||
Specifies the number of frames to grab. n is a positive integer that can be a maximum of 2 to the power of 28. |
You can add the following value to the above-mentioned value to specify the number of frames to grab sequentially when a digitizer trigger event occurs .
For M_START
|
|||||||||||||||||||||||||||||||||||||||
Combination value |
Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
Specifies the number of frames to grab sequentially when a digitizer trigger event occurs. (more details...) |
† | f | g | h | i | j | k | l | m | n | p | q | r | ||||||||||||||||||||||||||
Parameters | |||||||||||||||||||||||||||||||||||||||
Specifies the number of frames to grab sequentially for each digitizer trigger event. |
† | f | g | h | i | j | k | l | m | n | p | q | r | ||||||||||||||||||||||||||
|
† | f | g | h | i | j | k | l | m | n | p | q | r | ||||||||||||||||||||||||||
|
† | f | g | h | i | j | k | l | m | n | p | q | r |
Specifies more information about the synchronization and triggering of the grab.
For controlling the order in which
processing occurs
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies the default execution mode. (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | |||||||||||||||||||
M_ASYNCHRONOUS + |
Allows your thread to continue after initiating the start of the grabs, rather than waiting for MdigProcess() to finish. (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | |||||||||||||||||||
M_SYNCHRONOUS + |
Synchronizes your thread with the end of MdigProcess(). |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s |
You can add one of the following values to the above-mentioned values to specify how the calibration context associated with the digitizer is propagated to each modified image buffer in the list.
For how the calibration context is
propigated
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_CALIBRATION_PROPAGATE_AT_EACH_FRAME |
Specifies that the calibration context associated with the digitizer is re-associated with the buffer each time the buffer is modified and just before calling the hook-handler function. (more details...) |
† | f | g | h | i | j | k | l | m | n | p | q | r | |||||||||||||||||||||||||
M_CALIBRATION_PROPAGATE_OFF |
Specifies to not affect the calibration context associated with the modified image buffer. (more details...) |
† | f | g | h | i | j | k | l | m | n | p | q | r | |||||||||||||||||||||||||
M_CALIBRATION_PROPAGATE_ONCE |
Specifies that before starting image acquisition, the calibration context associated with the digitizer is also associated with each image buffer. (more details...) |
† | f | g | h | i | j | k | l | m | n | p | q | r |
You can add the following value to the above-mentioned values to set how the function will behave when the digitizer is configured for triggered grabs.
For only controling the grab of the first
frame with a trigger
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
MIL system-specific tooltip (†) |
|||||||||||||||||||||||||||||||||||||
M_TRIGGER_FOR_FIRST_GRAB |
Specifies that a trigger will only be used to control the grab of the first frame. (more details...) |
† | a | b | c | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s |
Specifies the address of the function that is called when a buffer is modified in the array of destination image buffers.
The hook-handler function, pointed to by HookHandlerPtr, must be declared as follows:
Type of event that generated the call (M_MODIFIED_BUFFER).
Event identifier. You can pass the identifier to MdigGetHookInfo() to inquire about the hooked event.
User data pointer that was passed (as UserDataPtr) to MdigProcess().
Upon successful completion, the hook-handler function should return M_NULL. Note MFTYPE and MIL_DIG_HOOK_FUNCTION_PTR are reserved MIL predefined types for functions and data pointers.
If the hook-handler function modifies the buffer which triggred the hook-handler function, it will not be called again for that buffer.
Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if not used.
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |