Grabber Control Reference 14.1
Methods

Functions

boolean GenerateSoftwareTrigger (long TriggerID)
 Generates a software trigger with the given trigger ID. More...
 
boolean ImageOffset (ImageRectCommand ImageRectCommand, long *OffsetX, long *OffsetY)
 Some image input devices such as some IEEE1394 cameras support read out of an area of interest (AOI). Using this method you can select the offset of the AOI relative to the sensor's coordinate system. Use the ImageSize method to define the size of the AOI. More...
 
void ImagePropertyChanged (ImagePropertyChangedReason ReasonForCall, ImagePropertyChangedAnswer *Answer, long Reserved1, long Reserved2)
 Generated when a property of the image is about to change or has been changed. More...
 
boolean ImageSize (ImageRectCommand ImageRectCommand, long *Width, long *Height)
 Some image input devices such as some IEEE1394 cameras support read out of an area of interest (AOI). Using this method you can select the size of the AOI. Use the ImageOffset method to define the offset of the AOI. More...
 
boolean SendBinaryCommand (long CommandID, long *CommandParameter, long CommandParameterSize, long *CommandAnswer, long *CommandAnswerSize)
 Sends a binary command directly to the Common Vision Blox driver. More...
 
boolean SendStringCommand (long CommandID, BSTR CommandParameter, BSTR CommandAnswer, long *CommandAnswerSize)
 Sends a string command directly to the Common Vision Blox driver. More...
 
BSTR SendStringCommandEx (long CommandID, DcOperation CommandOperation, BSTR CommandParameter)
 Sends a string command directly to the Common Vision Blox driver. More...
 

Detailed Description

Function Documentation

◆ GenerateSoftwareTrigger()

boolean GenerateSoftwareTrigger ( long  TriggerID)

Generates a software trigger with the given trigger ID.

To use the software trigger you need to ensure correct trigger settings for this TriggerID in your frame grabber/camera configuration file.
Please refer to the CVB Driver User Guide of the specific image acquisition device or the the driver hardware manual for valid trigger IDs (trigger input lines).
Then start an acquisition for instance using the Grab property of the Common Vision Image Control.
Calling this method will then generate the trigger and force the ImageSnaped event of the Common Vision Image Control to be fired.

Attention
The trigger source has to be set to a software trigger. Additionally you have to select the desired triggermode.
Parameters
[in]TriggerIDSpecicial trigger ID of the used device.
Returns
TRUE if software trigger was successful, otherwise FALSE.
Related Topics:
CanSoftwareTrigger
Examples:
Visual Basic - VB Grabber Control Example

◆ ImageOffset()

boolean ImageOffset ( ImageRectCommand  ImageRectCommand,
long *  OffsetX,
long *  OffsetY 
)

Some image input devices such as some IEEE1394 cameras support read out of an area of interest (AOI). Using this method you can select the offset of the AOI relative to the sensor's coordinate system. Use the ImageSize method to define the size of the AOI.

When setting the offset of the AOI the driver will reduce the size to the closest, lower value supported by the sensor. E.g., if you pass a size of 129, 130 the driver might change it automatically to 128, 128.
Changing the image offset will not result in the generation of a new image which gives you the possiblility to have moving acquisition AOI's in real time.
ßn

This function can also be used to inquire the current settings and to validate a given size.

Attention
Ensure that the AOI offset plus the AOI size does not exceed the physical sensor limits.
Parameters
[in]ImageRectCommandCommand to be executed. For possible commands refer to ImageRectCommand. This method does not support the IMAGERECT_CMD_SET_AUTODELETE command.
[out]OffsetXCurrent or new offset in X direction. The actual offset is always returned.
[out]OffsetYCurrent or new offset in Y direction. The actual offset is always returned.
Returns
TRUE if was successful, otherwise FALSE.
Related Topics:
CanImageRect, ImageSize

◆ ImagePropertyChanged()

void ImagePropertyChanged ( ImagePropertyChangedReason  ReasonForCall,
ImagePropertyChangedAnswer Answer,
long  Reserved1,
long  Reserved2 
)

Generated when a property of the image is about to change or has been changed.

Attention
Will be fired only if the image supports the IImagePropertyChanged interface.
Parameters
[in]ReasonForCallReason why this event is fired. For possible reasons refer to ImagePropertyChangedReason.
[out]AnswerAnswer that is returned to the driver. For possible answers refer to ImagePropertyChangedAnswer.
[in]Reserved1Reserved for future use.
[in]Reserved2Reserved for future use.
Returns
Command answer.
Related Topics:
CanPropertyChange, CanDeviceControl
Examples:
Visual Basic - VB Grabber Control Example

◆ ImageSize()

boolean ImageSize ( ImageRectCommand  ImageRectCommand,
long *  Width,
long *  Height 
)

Some image input devices such as some IEEE1394 cameras support read out of an area of interest (AOI). Using this method you can select the size of the AOI. Use the ImageOffset method to define the offset of the AOI.

When setting the AOI the driver will reduce the size to the closest, lower value supported by the sensor. E.g., if you pass a size of 129, 130 the driver might change it automatically to 128, 128.
Setting a new size results in the generation of a new image and a new value of the Image property. Therefore, the ImageUpdated event is invoked. Within this event you have to pass the new value of the Image property to all other controls using the image.
All driver related interfaces are moving to the new image, meaning that the original image will loose it's driver interfaces. If you call the function with the IMAGERECT_CMD_SET_AUTODELETE command the orginal image is automatically released whereas the IMAGERECT_CMD_SET will not release the original image meaning that you have to release it manually.

This function can also be used to inquire the current settings and to validate a given size. To inquire the maximum size supported by the sensor call ImageSize with the IMAGERECT_CMD_VALIDATE and pass 0xFFFF as width/height to the function.

Attention
Ensure that the AOI offset plus the AOI size does not exceed the physical sensor limits.
Parameters
[in]ImageRectCommandCommand to be executed. For possible commands refer to ImageRectCommand.
[out]WidthCurrent or new widht. The actual width is always returned.
[out]HeightCurrent or new height. The actual height is always returned.
Returns
TRUE if was successful, otherwise FALSE.
Visual Basic Test Code:
If cvGrabber.CanImageRect Then
vGrabber.ImageSize IMAGERECT_CMD_GET, lDx, lDy // get current image size
// validate new image size
lWidth = lDx
lHeight = 2000
cvGrabber.ImageSize IMAGERECT_CMD_VALIDATE, lWidth, lHeight
// set new image size and fires CV Grabber Control image updated event
cvGrabber.ImageSize(IMAGERECT_CMD_SET_AUTODELETE, lWidth, lHeight)
Else
MsgBox "vin driver does NOT support or IImageRect interface"
End If
// please add the code to the CVGrabber Control Image Updated event
// delete display image
cvDisp.Image = 0
// refresh display image
cvImg.Image = cvGrabber.Image
@ IMAGERECT_CMD_SET_AUTODELETE
Set new values. The closest possible set of values are set and returned. The previous image is automa...
Definition: CVgrabber.odl:52
@ IMAGERECT_CMD_VALIDATE
Validate values. The closest possible set of values are returned.
Definition: CVgrabber.odl:54
@ IMAGERECT_CMD_GET
Get actual values.
Definition: CVgrabber.odl:50
Related Topics:
CanImageRect, ImageOffset

◆ SendBinaryCommand()

boolean SendBinaryCommand ( long  CommandID,
long *  CommandParameter,
long  CommandParameterSize,
long *  CommandAnswer,
long *  CommandAnswerSize 
)

Sends a binary command directly to the Common Vision Blox driver.

Commands are driver dependent. A binary command is defined by its ID, its parameter (a pointer to a binary buffer) and the size of the parameter which are passed to the function.
CommandAnswer and CommandAnswerSize are returned values indicating the answer to the command in binary form and the lenght of this binary data. To determine the size of an answer string for a given command pass a NULL string in the CommandAnswer argument. The size needed for the command is then given in the CommandAnswerSize argument.
Refer to the CVB Driver User Guide for yur image acquisition device to get a list of commands and possible parameters.

Parameters
[in]CommandIDID of the command to be called.
[in]CommandParameterPointer to the buffer to the command parameter.
[in]CommandParameterSizeSize of the CommandParameter buffer.
[out]CommandAnswerBuffer to the command answer. The driver will fill this buffer with the answer.
Pass a NULL pointer to retrieve the size that is needed for the answer.
[out]CommandAnswerSizeSize of the CommandAnswer buffer. The driver will return the size that was needed for the answer.
Returns
TRUE if was successful, otherwise FALSE.
VC++ Test Code:
// this is usually defined in the driver specific header file
#define MY_CMD 1
struct TDataIn { long x; long y; long z; };
struct TDataOut { float z; float y; float x; };
long CommandAnswerSize = sizeof (TDataOut);
// call SendBinaryCommand with a NULL pointer answer to get required size
m_cvGrabber.SendBinaryCommand (MY_CMD, (long*) &dataIn, sizeof (TDataIn), NULL, &CommandAnswerSize);
if (CommandAnswerSize == sizeof (TDataOut)) {
pdataOut = new TDataOut;
// now call it again and pass CommandAnswer to the function
m_cvGrabber.SendBinaryCommand (MY_CMD, (long*) &dataIn, sizeof (TDataIn), (long*) pdataOut, &CommandAnswerSize); //...
delete pdataOut;
}
Related Topics:
SendStringCommand, CanDeviceControl
Examples:
There are special example programs available for the selected Image Acquisition Hardware, means Framegrabber or Cameras. Please have a look at the directory CVB%\Hardware.
Visual Basic - VB Grabber Control Example

◆ SendStringCommand()

boolean SendStringCommand ( long  CommandID,
BSTR  CommandParameter,
BSTR  CommandAnswer,
long *  CommandAnswerSize 
)

Sends a string command directly to the Common Vision Blox driver.

Commands are driver dependent. A string command is defined by its ID and its parameter string which are passed to the function. To determine the size of an answer string for a given command pass a NULL string in the CommandAnswer argument.
Refer to the CVB Driver User Guide for yur image acquisition device to get a list of commands and possible parameters.

Parameters
[in]CommandIDID of the command to be called.
[in]CommandParameterPointer to the string containing the command parameters.
[out]CommandAnswerPointer to the string containing the command answer. The driver will fill this string with the answer.
Pass NULL to retrieve the size that is needed for the answer.
[out]CommandAnswerSizeSize of the CommandAnswer string. The driver will return the size that was needed for the answer.
Returns
TRUE if was successful, otherwise FALSE.
VC++ Test Code for setting the gain:
// CMD_SETGAIN is usually defined in the driver specific header file
char* CommandAnswer;
long CommandAnswerSize;
// call SendStringCommand with a NULL pointer answer to get required size
m_cvGrabber.SendStringCommand (CMD_SETGAIN, "1.2", NULL, &CommandAnswerSize);
if (CommandAnswerSize > 0) {
// allocate buffer for answer CommandAnswer = (char*) malloc (CommandAnswerSize);
// now call it again and pass CommandAnswer to the function
m_cvGrabber.SendStringCommand (CMD_SETGAIN, "1.2", CommandAnswer, &CommandAnswerSize); // ....
// don't forget to free answer string free (CommandAnswer);
}
Related Topics:
SendBinaryCommand, CanDeviceControl
Examples:
There are special example programs available for the selected Image Acquisition Hardware, means Framegrabber or Cameras. Please have a look at the directory CVB%\Hardware.
Visual Basic - VB Grabber Control Example

◆ SendStringCommandEx()

BSTR SendStringCommandEx ( long  CommandID,
DcOperation  CommandOperation,
BSTR  CommandParameter 
)

Sends a string command directly to the Common Vision Blox driver.

Commands are driver dependent. A binary command is defined by its ID, the CommandOperation (get, set) and its parameter string which is passed to the function.
The function retrieves the size of the string and returns the answer string itself.
Refer to the CVB Driver User Guide for yur image acquisition device to get a list of commands and possible parameters. Replaces the SendStringCommand method.

Parameters
[in]CommandIDID of the command to be called.
[in]CommandOperationCommand Operation. For possible commands refer to DcOperation.
[in]CommandParameterPointer to the string containing the command parameters.
Returns
Command answer.
Programming hints:
For users of Visual C please inlcude the icvcdriver.h if you want to use the constants (DC_xx) for the DcOperation.
Related Topics:
SendBinaryCommand, CanDeviceControl
Examples:
There are special example programs available for the selected Image Acquisition Hardware, means Framegrabber or Cameras. Please have a look at the directory CVB%\Hardware.
Visual Basic - VB Grabber Control Example