DotNET SDK Programming Reference Manual
DotNET SDK Programming Reference Manual
DotNET SDK
Programmer's Guide
Version:V1.2.2
Date:2020-10-12
Notice
All rights reserved. No parts of this manual may be used or reproduced, in any forms or by any means,
without prior written permission of China Daheng Group, Inc. Beijing Image Vision Technology Branch.
The right is also reserved to modify or change any parts of this manual in the future without prior notification.
© 2020 China Daheng Group, Inc. Beijing Image Vision Technology Branch
Web: http://www.daheng-imaging.com
Sales Email: [email protected]
Sales Tel: +86 10 8282 8878
Support Email: [email protected]
Contents
1. Introduction ..................................................................................................................... 1
2. Programming Guide ....................................................................................................... 2
2.1. Build Programming Environment ..............................................................................2
2.1.1. Using the Wizard to Create a Console Application ............................................................. 2
2.1.2. Add the GxIAPINET.dll to the Project Manually .................................................................. 2
2.1.3. How to Call the GxIAPINET Library .................................................................................... 3
2.2. Precautions for Debugging the GigE Vision Cameras ..............................................4
2.3. Initialization and Uninitialization ................................................................................5
2.4. Error Handling ..........................................................................................................5
2.5. Enumerating Devices ...............................................................................................5
2.6. Configure Camera IP Address ..................................................................................6
2.7. Open and Close Devices ..........................................................................................7
2.8. Features Control .......................................................................................................8
2.8.1. Controller Type .................................................................................................................... 8
2.8.2. Data Type............................................................................................................................. 9
2.8.3. Access Type ......................................................................................................................... 9
2.8.4. How to Get the Camera's Parameters ................................................................................ 9
2.8.5. How to Get the Sample Code for Feature Read & Write .................................................. 10
2.8.6. Different Types of Feature Sample Code .......................................................................... 10
2.8.7. Precautions ........................................................................................................................ 12
2.9. Acquisition Control and Image Processing .............................................................12
2.9.1. Get a Single Image ............................................................................................................ 12
2.9.2. Acquisition with Callback Functions .................................................................................. 13
2.9.3. Set the Number of Acquisition Buffer ................................................................................ 15
2.9.4. Image Processing .............................................................................................................. 16
2.9.5. Stream Object Features Control........................................................................................ 21
2.9.6. Precautions ........................................................................................................................ 22
2.10. Get Devices Events ..............................................................................................23
2.10.1. Selection Events .............................................................................................................. 23
2.10.2. Enabled Events................................................................................................................ 23
2.10.3. Registered Events Message Callback Function ............................................................. 23
2.10.4. Get Events Data Information ........................................................................................... 23
2.10.5. Sample Code ................................................................................................................... 24
2.11. Get Offline Event ..................................................................................................25
2.12. Import and Export Cameras' Configuration Parameters .......................................26
3. Data Type Definition ..................................................................................................... 27
3.1. GX_STATUS_LIST .................................................................................................27
3.2. GX_DEVICE_CLASS_LIST ....................................................................................27
3.3. GX_ACCESS_STATUS ..........................................................................................27
3.4. GX_ACCESS_MODE .............................................................................................28
© China Daheng Group, Inc. Beijing Image Vision Technology Branch III
6.8. IBoolFeatur .............................................................................................................49
6.8.1. GetValue ............................................................................................................................ 49
6.8.2. SetValue............................................................................................................................. 49
6.9. IStringFeature .........................................................................................................49
6.9.1. GetValue ............................................................................................................................ 49
6.9.2. SetValue............................................................................................................................. 49
6.9.3. GetStringMaxLength .......................................................................................................... 50
6.10. ICommandFeature................................................................................................50
6.10.1. Execute ............................................................................................................................ 50
6.11. IRegisterFeature ...................................................................................................50
6.11.1. GetLength ........................................................................................................................ 50
6.11.2. GetBuffer .......................................................................................................................... 50
6.11.3. SetBuffer .......................................................................................................................... 51
6.12. IGXStream ............................................................................................................51
6.12.1. StartGrab ......................................................................................................................... 51
6.12.2. StopGrab ......................................................................................................................... 52
6.12.3. RegisterCaptureCallback................................................................................................. 52
6.12.4. UnregisterCaptureCallback ............................................................................................. 52
6.12.5. GetImage ......................................................................................................................... 52
6.12.6. GetImageNoThrow .......................................................................................................... 52
6.12.7. GetFeatureControl ........................................................................................................... 53
6.12.8. FlushQueue ..................................................................................................................... 53
6.12.9. SetAcquisitionBufferNumber ........................................................................................... 53
6.12.10. Close .............................................................................................................................. 53
6.12.11. GetOptimalPacketSize ................................................................................................... 54
6.13. IFrameData ..........................................................................................................54
6.13.1. GetStatus ......................................................................................................................... 54
6.13.2. GetPayloadSize ............................................................................................................... 55
6.13.3. GetWidth .......................................................................................................................... 55
6.13.4. GetHeight......................................................................................................................... 55
6.13.5. GetPixelFormat ................................................................................................................ 55
6.13.6. GetFrameID ..................................................................................................................... 55
6.13.7. GetTimeStamp ................................................................................................................. 55
6.13.8. GetBuffer.......................................................................................................................... 56
6.13.9. ConvertToRaw8 ............................................................................................................... 56
6.13.10. ConvertToRGB24 .......................................................................................................... 56
6.13.11. ImageProcess ................................................................................................................ 56
6.14. IImageData ...........................................................................................................56
6.15. IImagProcessConfig .............................................................................................57
6.15.1. SetValidBit........................................................................................................................ 58
6.15.2. GetValidBit ....................................................................................................................... 58
6.15.3. EnableDefectivePixelCorrect ........................................................................................... 58
6.15.4. IsDefectivePixelCorrect ................................................................................................... 58
6.15.5. EnableSharpen ................................................................................................................ 58
1. Introduction
The GxIAPINET.dll library is an encapsulated general and unified application programming interface which
based on the object-oriented method; it is suit for MERCURY, MARS series of DAHENG IMAGING camera.
2. Programming Guide
2.1. Build Programming Environment
2.1.1. Using the Wizard to Create a Console Application
Figure 2-1
Figure 2-2
In the pop-up Add Reference dialog box, select Browse tab and select the GxIAPINET.dll file, then click
OK, see the following figure:
Figure 2-3
Click OK and we can see the library which we have selected in the Reference, see the following figure:
Figure 2-4
Figure 2-5
When the user running the application, it will send heartbeat packet normally and keep connect with the
camera, but in debug mode, when the application runs to the breakpoint, the debugger will suspend all the
thread, including the sending heartbeat packet thread, so in debug mode, the application will not send
heartbeat packet to the camera.
The first one is: open the device in the program and add the following code:
Only in debugging mode can use this code snippet, don't use it in the release program.
//Open device, here, open the device through Serial Number (SN), the SN will
//be subject to the actual device. Users can also open the device by other ways.
#ifDEBUG
#endif
The other way is: add environment variable 'MER_HEARTBEAT_TIMEOUT' in the system, and assign a
value greater than zero, then open the device with application program, the device's heartbeat timeout will
automatically become the environment variable's value. Only to add the environment variable in the
development system and they will work in the application no matter in debug mode or release mode.
Note: If the user set the heartbeat timeout very long, when close the program it will not call the close device
method to close the device, this will lead to the device cannot to be reset in the heartbeat time, thus when
the user try again to open the device, it will fail. This problem can be solved by resetting or reconnecting
the device.
Reset device: It is equivalent to powering off and powering up the device, and the programs in the camera
are completely reloaded.
Reconnect device: It is equivalent to the software interface close the device. After doing this, the user can
reopen the device.
The IGXFactory.GetInstance().Uninit() must be called to release all the resources of the GxIAPINET
application before the process exits.
//After closing the device, can't call any other interface library.
IGXFactory.GetInstance().Uninit();
Note: Except the enumerated methods above, GxIAPINET also provides another enumerated method
IGXFactory.GetInstance().UpdateDeviceList. For non-GigE Vision cameras, they are the same in the
function, but for GigE Vision cameras, they are different in the internal enumeration mechanism.
IGXFactory::GetInstance().GigEIpConfiguration
IGXFactory::GetInstance().GigEForceIp
Use the function GigEIpConfiguration can set the camera static (permanent) IP address, and provide
four setting modes: direct write static IP address, use DHCP server to assign IP addresses, use LLA (Link-
Local Address) to configure camera IP and use default mode to set IP. When you choose the default mode,
the internal camera will enable the other three configure modes, but the static IP as a preferred way to
configure camera IP address.
Use the function GigEForceIp can perform ForceIP operations on the camera. ForceIP means that setting
the IP address is valid only for this use. When the camera power off and power on will restore the original
IP address.
Two ways to configure the IP address of the camera sample code is as follows.
//Sample MAC address, actual camera MAC address can be obtained by enumeration.
String strMAC = "00-21-49-00-00-00";
String strIPAddress= "192.168.10.10";
String strSubnetMask= "255.255.255.0";
String strDefaultGateway= "192.168.10.2";
String strUserID= "DAHENG Imaging";
GX_IP_CONFIGURE_MODE emIpConfigureMode = IP_CONFIGURE_STATIC_IP;
IGXFactory.GetInstance().GigEIpConfiguration(strMAC, emIpConfigureMode,
strIpAddress, strSubnetMask,
strDefaultGateway, strUserID);
//Sample MAC address, actual camera MAC address can be obtained by enumeration.
String strMAC = "00-21-49-00-00-00";
String strIPAddress= "192.168.10.10";
String strSubnetMask= "255.255.255.0";
String strDefaultGateway= "192.168.10.2";
//ForceIp
IGXFactory.GetInstance().GigEForceIp (strMAC, strIpAddress, strSubnetMask,
strDefaultGateway);
Note:
1) Before calling these two interfaces, you must first enumeration, and when you do this, the camera can't
be opened.
2) The maximum length of the user-defined name (UserID) allowed is 16 characters.
IGXFactory.GetInstance().OpenDeviceBySN
IGXFactory.GetInstance().OpenDeviceByUserID
IGXFactory.GetInstance().OpenDeviceByMAC
IGXFactory.GetInstance().OpenDeviceByIP
UserID: user defined name (if the device does not support UserID, assign this item as a null string).
MAC: the MAC address of the device (for non-GigE Vision cameras, assign this item as a null string).
IP: the device's IP address (for non-GigE Vision cameras, assign this item as a null string).
It is strongly recommended the user to call the enumeration device method and update the GxIAPINET
library internal device list before open the device, otherwise may open the device failure. The sample code
snippet as follows:
List<IGXDeviceInfo> listGXDeviceInfo = new List<IGXDeviceInfo>();
IGXFactory.GetInstance().UpdateAllDeviceList(200, listGXDeviceInfo);
if (listGXDeviceInfo.Count> 0)
{
//Open the first device in the list.
IGXDevice objDevice = null;
String strSN = listGXDeviceInfo[0].GetSN();
String strUserID = listGXDeviceInfo[0].GetUserID();
String strMAC = listGXDeviceInfo[0].GetMAC();
String strIP = listGXDeviceInfo[0].GetIP();
//Users can also assign the device information of the opened device
//directly. The information shown in the following code is indicative only,
//the actual information may differ.
//String strSN = "GA0140100002";
//String strUserID = "MyUserName";
//String strMAC = "A1-0B-32-7C-6F-81";
//String strIP = "192.168.0.100";
objDevice = IGXFactory.GetInstance().OpenDeviceBySN(strSN,
GX_ACCESS_EXCLUSIVE);
//objDevice = IGXFactory.GetInstance().OpenDeviceByUserID(strUserID,
GX_ACCESS_EXCLUSIVE);
//objDevice = IGXFactory.GetInstance().OpenDeviceByMAC(strMAC,
GX_ACCESS_EXCLUSIVE);
//objDevice = IGXFactory.GetInstance().OpenDeviceByIP(strIP,
GX_ACCESS_EXCLUSIVE);
}
Note: For GigE Vision devices, users can open the device directly without enumeration, because the
network mechanism allows to establishment connection directly by IP address.
Users can call the IGXDevice::Close to close device, release all the device resources. Code snippet as
follows:
//After closing the device, user can not to call the function 'IDevice' and
//all the 'IFeatureControl&IStream' functions of the device.
objDevice.Close();
Note: After closing the device, all the resources about the device will be released, including the
IGXFeatureControl object and IGXStream object which get from the device object, so when the device
is closed, these objects' interface are not allowed to be called again.
Running the GalaxyView demo to open the device, you can see the parameters in the right properties
controller tree, there are three parts: the upper one is the properties which return from
IGXDevice::GetRemoteFeatureControl, and the middle one is the properties which return from
IGXDevice::GetFeatureControl. The lower one is the return properties from
IGXStream::GetFeatureControl.
Figure 2-6
Get from the GalaxyView demo: open the device by GalaxyView demo, look over the right side—
properties list, the English name of every control node, as shown in the following figure:
Figure 2-7
As shown above, when the mouse pitch on image width, the function name, maximum, minimum, step
etc. will be shown in the Function Properties Description Area.
2.8.5. How to Get the Sample Code for Feature Read & Write
The GalaxyView.exe provides sample codes for feature read & write. In the demo program menu bar: View
-> Feature Document, you can open the window, as shown in the following:
Figure 2-8
In the view of feature document, three development languages are available. Switch to C# Tab to get the
code for reading and writing user-specified feature in C# language. The code can be directly copied to the
user's development project.
All functions are controlled by function string. Check to see if the feature is currently available, and then to
read or write.
IGXFeature Control objIGXFeatureControl =
objIGXDevice.GetRemoteFeatureControl();
//Get width node.
Boolean bIsImplemented = objIGXFeatureControl.IsImplemented("Width");
if (bIsImplemented)
{
//Is readable?
Boolean bIsReadable = objIGXFeatureControl.IsReadable("Width");
//Is writable?
Boolean bIsWritable = objIGXFeatureControl.IsWritable("Width");
}
According to the data type, the camera's function is divided into seven categories, integer is one of them,
including width, height and other integer control parameters, users can use the integer controller
IntFeature to read the current value, inquire the maximum, minimum and step.
IGXFeatureControl objIGXFeatureControl =
objIGXDevice.GetRemoteFeatureControl();
IIntFeatureobjInt = objIGXFeatureControl.GetIntFeature("Width");
Int64 nMax = objInt.GetMax(); //Get the maximum value.
Int64 nMin = objInt.GetMin(); //Get the minimum value.
Int64 nInc = objInt.GetInc(); //Get the increment value.
Int64 nValue = objInt.GetValue(); //Get the current value.
objInt.SetValue(nValue); //Set the current value.
To access the float data by FloatFeature, you can read and write the current value, check the Maximum,
Minimum, whether to support increment, increment value and unit.
IGXFeatureControl objIGXFeatureControl =
objIGXDevice.GetRemoteFeatureControl();
IFloatFeature objFloat = objIGXFeatureControl.GetFloatFeature("Gain");
Double dMax = objFloat.GetMax(); //Get the maximum value.
Double dMin = objFloat.GetMin(); //Get the minimum value.
Boolean bHasInc = objFloat.HasInc();
if (bHasInc)
{
Double dInc = objFloat.GetInc(); //Get the increment value.
}
String strUnit = objFloat.GetUnit(); //Get the unit.
Double dValue = objFloat.GetValue();//Get the current value.
objFloat.SetValue(dValue); //Set the current value.
Enumerated can check the options, and read/write interfaces which the enumerated function supported.
IGXFeatureControl objIGXFeatureControl = objIGXDevice.GetRemoteFeatureControl();
IEnumFeature objEnum = objIGXFeatureControl.GetEnumFeature("AcquisitionMode");
List<String> listEnumEntry = newList<String>();
listEnumEntry = objEnum.GetEnumEntryList();//Get the enum items list.
foreach (String str in listEnumEntry)
{
Console.WriteLine(str); //Print all the enum items.
}
String strValue = objEnum.GetValue(); //Get the current item.
objEnum.SetValue(strValue); //Set the current item.
String provides the function to read/write the current value, check the maximum string length supported
before write.
IGXFeatureControl objIGXFeatureControl = objIGXDevice.GetRemoteFeatureControl();
IStringFeature objString = objIGXFeatureControl.GetStringFeature("DeviceUserID");
//Get the current value.
String strValue = objString.GetValue();
//Get the maximum length can be written to.
Int64 nMaxLength = objString.GetStringMaxLength();
//Write the current value.
objString.SetValue(strValue);
2.8.7. Precautions
After getting from the device object, the features controller IGXFeatureControl is valid until the device
closed. Once the device is closed, the features controller is invalid; you cannot call any features of the
features controller.
There two acquisition ways: callback acquisition and get a single image.
{
//Determine whether the device supports the stream channel packet function.
if (true == m_objIGXFeatureControl.IsImplemented("GevSCPSPacketSize"))
{
//Get the optimal packet length value of the current network environment.
uint nPacketSize = m_objIGXStream.GetOptimalPacketSize();
//Set the optimal packet length value to the stream channel packet
//length of the current device.
m_objIGXFeatureControl.GetIntFeature("GevSCPSPacketSize").SetValue(
nPacketSize);
}
}
//Stop acquisition.
objIGXFeatureControl.GetCommandFeature("AcquisitionStop").Execute();
objIGXStream.StopGrab();
Note: Users must call the StartGrab to start the stream channel acquisition first, and then send start
acquisition command to the device, otherwise the start acquisition command will invalid. Users use the
function GetImage to get the IImageData object, if you do not use this function anymore, please destroy
it by calling the Destroy method. When using a high-resolution camera for high-speed data
acquisition, recommend you to use callback acquisition mode, because the buffer copy inside the
GetImage will affect the transmission performance.
//Set the optimal packet length value to the stream channel packet
//length of the current device.
m_objIGXFeatureControl.GetIntFeature("GevSCPSPacketSize").SetValue(
nPacketSize);
}
}
//Register the acquisition callback function. Note: the first parameter is a user's
//private parameter, user can set any type of object, and also can set it null.
//The user's private parameter used within the callback function for restore,
//if not use the private parameter, you can set it null.
objIGXStream.RegisterCaptureCallback(objIGXDevice, OnFrameCallbackFun);
Note: Users must call the function StartGrab to start stream channel acquisition, and then send start
acquisition command to the device; otherwise the start acquisition command will invalid.
//Set the optimal packet length value to the stream channel packet
//length of the current device.
m_objIGXFeatureControl.GetIntFeature("GevSCPSPacketSize").SetValue(
nPacketSize);
}
}
// ………
//Stop acquisition.
objIGXFeatureControl.GetCommandFeature("AcquisitionStop").Execute();
objStream.StopGrab();
Note:
1) This interface is an optional interface. When multiple cameras are acquisiting at the same time, if the
frame rate of individual cameras is 0, you can call this interface to adjust the number of acquisition
buffers of all cameras to ensure that all cameras have buffers for acquisition.
2) The buffer number must be set before calling StartGrab to start the stream channel acquisition,
otherwise the setting is invalid.
Function description: Specified for an 8 bit valid data. Assume that the original data is non 8-bit, no matter
mono or color, you can call the function CovertToRaw8 to specify for an 8-bit data, and the return value
type is IntPtr. The specified memory size is Width * Height.
Sample Code:
IntPtr pRaw8Buffer = IntPtr.Zero;
//Assume the original data is mono8 image.
pRaw8Buffer = objIBaseData.ConvertToRaw8(GX_BIT_0_7);
//Assume the original data is Mono12 image.
pRaw8Buffer = objIBaseData.ConvertToRaw8(GX_BIT_4_11);
//Assume the original data is BayerRG8 image.
pRaw8Buffer = objIBaseData.ConvertToRaw8(GX_BIT_0_7);
//Assume the original data is BayerRG12 image.
pRaw8Buffer = objIBaseData.ConvertToRaw8(GX_BIT_4_11);
Function description: Bayer format convert to RGB24 format, no matter the current image output is mono
or color, 8-bit or non 8-bit, you can call the function ConvertToRGB24 to complete data interpolation
processing, and the return IntPtr is RGB24 format. The memory size is Width*Height*3.
Sample Code:
//The parameter 'objIBseData' can be the 'IFrameData' which set by the
//acquisition callback function, and also can be the 'IImageData' which the
//function 'GetImage' acquired.
IntPtr pRGB24Buffer = IntPtr.Zero;
//Assume the original data is mono8 image.
pRGB24Buffer = objIBaseData.ConvertToRGB24(GX_BIT_0_7, GX_RAW2RGB_NEIGHBOUR,
true);
//Assume the original data is Mono12 image.
pRGB24Buffer = objIBaseData.ConvertToRGB24(GX_BIT_4_11, GX_RAW2RGB_NEIGHBOUR,
true);
//Assume the original data is BayerRG8 image.
pRGB24Buffer = objIBaseData.ConvertToRGB24(GX_BIT_0_7, GX_RAW2RGB_NEIGHBOUR,
true);
//Assume the original data is BayerRG12 image.
pRGB24Buffer = objIBaseData.ConvertToRGB24(GX_BIT_4_11,GX_RAW2RGB_NEIGHBOUR,
true);
The interface library also provides the image effect enhanced in software side, users can do some image
effect enhanced operate selectively, such as: defective-pixel correction, sharpening, contrast, brightness
and etc. The image effect enhanced involves the functions IImageProcessConfig, IFrameData and
IImageData.
Sample Code:
//Use the device object to construct image processing configuration object.
IImageProcessConfig objcfg = objIGXDevice.CreateImageProcessConfig();
IntPtrpRGB24Processed = IntPtr.Zero;
//The return result is RGB24 format data which is handled by image effect enhanced.
pRGB24Processed = objIBaseData.ImageProcess(objcfg);
For different data type cameras, the support of effect enhanced from interface library is also different.
Details as follows:
RawData
function Corresponding interface Mono Bayer
Mono8 Bayer8
non8 non8
Set valid bit SetValidBit Yes Yes Yes Yes
Defective Pixel correction
EnableDefectivePixelCorrect Yes Yes Yes Yes
switch
Sharpen switch EnableSharpen Yes Yes Yes Yes
Sharpen factor SetSharpenParam Yes Yes Yes Yes
Contrast SetContrastParam Yes Yes Yes Yes
Gamma SetGammaParam Yes Yes Yes Yes
Brightness SetLightnessParam Yes Yes Yes Yes
Noise reduction switch EnableDenoise No No Yes Yes
Saturation SetSaturationParam No No Yes Yes
RGB24 interpolation type SetConvertType No No Yes Yes
RGB24 interpolation flip
EnableConvertFlip No No Yes Yes
switch
Color correction switch EnableColorCorrection No No Yes Yes
The parameter range of Image effect enhance and the detail explanation as follows:
Functions Default value Range Remarks
For 8bit data , only one to select : GX_BIT_0_7
For 10bit data, you can select GX_BIT_0_7,
Refer GX_BIT_1_8, GX_BIT_2_9, recommend
Set valid bit GX_BIT_0_7 GX_VALID_B GX_BIT_2_9
IT_LIST For 12bit data, you can select GX_BIT_0_7,
GX_BIT_1_8, GX_BIT_2_9, GX_BIT_3_10,
GX_BIT_4_11, recommend GX_BIT_4_11
Defective Pixel true: switch on defective Pixel correction
false true, false
correction switch false: switch off defective Pixel correction
true: switch on sharpen
Sharpen switch false true, false
false: switch off sharpen
Sharpen factor 0.1 [0.1, 5] Increase sharpening effect gradually
The advanced user can fine-tune the parameter after getting IImageProcessConfig object, see as follows:
//Through the device object to construct image processing configuration object.
IImageProcessConfigobjcfg = objIGXDevice.CreateImageProcessConfig();
//User can also choose to restore the optimum default parameter configuration.
objcfg.Reset();
//The parameter 'objIBseData' can be the 'IFrameData' which set the acquisition
//callback function, and also can be the 'IImageData' which the function 'GetImage'
//acquired.
IntPtrpRGB24Processed = IntPtr.Zero;
//The return result is RGB24 format data which is handled by image effect enhanced.
pRGB24Processed = objIBaseData.ImageProcess(objcfg);
According on the cameras' type and usage scenario, the image effect enhanced configuration parameters
are also different, but there are still a few recommend functions can meet the needs of most users. Take
MER-200-20GC GigE Vision camera for example, the image which the camera output after image format
conversion to RGB24 bit, the result as follows without any effect enhance processing:
Figure 2-9 Neighborhood interpolation RGB image (color correction: off; saturation: 64; Gamma: 1; contrast: 0)
On the basis of Figure 2-9, switch on the color correction function, see the result as follows:
Figure 2-10 Switch on color correction based on figure2-10 (color correction: on; saturation: 64; Gamma: 1; Contrast: 0)
On the basis of Figure 2-10, increase the saturation to 80, see the result as follows:
Figure 2-11 Set saturation to 80(color correction: on; saturation: 80; Gamma: 1; Contrast: 0)
On the basis of Figure 2-11, adjust the Gamma to 1.98, make the image more close to what the users see
in the actual scene, the value 1.98 is just for an example, for different cameras the Gamma value will differ.
For the USB2.0 and USB3.0 cameras, users can read the gamma by the read/write interface. But for the
GigE Vision camera, the user should adjust the gamma by himself, there is not an interface to be called
directly.
Figure 2-12 Set the Gamma is 1.98(color correction: on; saturation: 80; Gamma: 1.98; Contrast: 0)
On the basis of Figure 2-12, set the contrast to 40, see the result as follows:
Figure 2-13 Set the contrast is 40(color correction: on; saturation: 80; Gamma: 1.98; Contrast: 40)
The "StreamBufferHandlingMode" in the stream object features can set the processing mode of the Buffer.
Three Buffer processing modes are available:
1) OldestFirst: The default value. The image buffer follows the first-in-first-out principle. After all the
buffers are filled, the new image data will be discarded until the user completes the processing of the
buffer that has filled the image data. The typical application is to receive each frame of images
acquired by the camera without losing frames. In order to achieve no frame loss, the speed of image
data transmission and processing need to be as fast as possible (at least less than the frame period).
2) OldestFirstOverwrite: Follow the first-in-first-out principle. The difference from the OldestFirst mode is
that when all the buffers are filled, the SDK will automatically discard one frame of image buffer with
the oldest timestamp to receive new image data. The typical application is that it does not require
receiving each frame of images acquired by the camera, and the image data transmission and
processing speed is slow.
3) NewestOnly: In this mode, the user always receives the latest image received by the SDK. Each time
the SDK receives a new frame of image data, it will automatically discard the image with the old
timestamp. Therefore, when the user's image processing is not timely or the speed is slow, frame loss
will occur. In the main applications, the real-time requirements of image acquisition and display are
high, and it is not required to receive each frame of images acquired by the camera. However,
depending on the camera's frame rate, memory cache, transmission speed, and user applications,
there may be a delay between the latest image received by the SDK and the latest image exposed by
the camera.
Note: The above code snippet just shown the stream layer control function of the GigE Vision cameras,
for the other cameras, please use the GalaxyView demo to open the device, or call the function
IGXFeatureControl.GetFeatureNameList to get the function list.
2.9.6. Precautions
After getting from the device object, the features controller IGXStream is valid, until the device is closed.
Once the device is closed, the stream object will invalid, you cannot call any interface of the stream object.
//Register event callback function, note that the second parameter is a user
//private parameter, the user can set any 'object' type object.
//The private parameter can be restored for the user's use within the callback
//function, if the user does not use the private parameter, the parameter can
//be set to null.
//Here we set the 'objRemoteFeatureControl' object.
GX_FEATURE_CALLBACK_HANDLE objEventHandle = null;
objEventHandle = objRemoteFeatureControl.RegisterFeatureCallback(
"EventExposureEnd",
objRemoteFeatureControl,
OnFeatureCallback);
//Send start acquisition command and the camera start exposuring and
//outputting images, when the exposure is end, an exposure end event will
//generate, then will activate the callback 'OnFeatureCallback' interface.
//Receive the exposure end event, please refer to the
//'OnFeatureCallback'function.
//Send stop acquisition command to the device.
objIGXFeatureControl.GetCommandFeature("AcquisitionStop").Execute();
objIGXStream.StopGrab();
//Unregister event.
objRemoteFeatureControl.UnregisterFeatureCallback(objEventHandle);
Note: Users must send the start acquisition command first, then the camera can output exposure end
event and send start acquisition command. So the user must call the IGXStream::StartGrab first, and
then get the AcquisitionStart command node by the features controller and to execute the command
Execute.
Note: Not allowed to execute close the device operation within the offline callback function.
Figure 2-14
Select Export Device Configuration menu, a new text file will create in the local disk to save the current
parameter of the device.
Select Import Device Configuration menu, select the local file and import it.
//Export configuration files, users can free to take the file name, but the
//export catalog must be existed first.
objIGXDevice.ExportConfigFile("D:\\Config.txt");
Note: Before executing the import/export configuration file, you should open the device first, and open the
first stream object of the device.
3.2. GX_DEVICE_CLASS_LIST
Definition Value Explanation
GX_DEVICE_CLASS_UNKNOWN 0 The class of the Device is unknown.
GX_DEVICE_CLASS_USB2 1 USB2.0 device.
GX_DEVICE_CLASS_GEV 2 GigE device.
GX_DEVICE_CLASS_U3V 3 USB3.0 device.
3.3. GX_ACCESS_STATUS
Definition Value Explanation
GX_ACCESS_STATUS_UNKNOWN 0 The status of the current device is unknown.
The status of the current device is
GX_ACCESS_STATUS_READWRITE 1
readable/writable.
GX_ACCESS_STATUS_READONLY 2 The status of the current device is read-only.
The status of the current device is not readable /
GX_ACCESS_STATUS_NOACCESS 3
writable.
3.4. GX_ACCESS_MODE
Definition Value Explanation
GX_ACCESS_READONLY 2 The access mode is read-only mode.
GX_ACCESS_CONTROL 3 The access mode is control mode.
GX_ACCESS_EXCLUSIVE 4 The access mode is exclusive mode.
3.5. GX_PIXEL_FORMAT_ENTRY
Definition Value Explanation
GX_PIXEL_FORMAT_UNDEFINED 0x00000000 -
GX_PIXEL_FORMAT_MONO8 0x01080001 Monochrome 8-bit.
GX_PIXEL_FORMAT_MONO8_SIGNED 0x01080002 Monochrome 8-bit signed.
GX_PIXEL_FORMAT_MONO10 0x01100003 Monochrome 10-bit unpacked.
GX_PIXEL_FORMAT_MONO12 0x01100005 Monochrome 12-bit unpacked.
GX_PIXEL_FORMAT_MONO14 0x01100025 Monochrome 14-bit unpacked.
GX_PIXEL_FORMAT_MONO16 0x01100007 Monochrome 16-bit.
GX_PIXEL_FORMAT_BAYER_GR8 0x01080008 Bayer Green-Red 8-bit.
GX_PIXEL_FORMAT_BAYER_RG8 0x01080009 Bayer Red-Green 8-bit.
GX_PIXEL_FORMAT_BAYER_GB8 0x0108000A Bayer Green-Blue 8-bit.
GX_PIXEL_FORMAT_BAYER_BG8 0x0108000B Bayer Blue-Green 8-bit.
GX_PIXEL_FORMAT_BAYER_GR10 0x0110000C Bayer Green-Red 10-bit.
GX_PIXEL_FORMAT_BAYER_RG10 0x0110000D Bayer Red-Green 10-bit.
GX_PIXEL_FORMAT_BAYER_GB10 0x0110000E Bayer Green-Blue 10-bit.
GX_PIXEL_FORMAT_BAYER_BG10 0x0110000F Bayer Blue-Green 10-bit.
GX_PIXEL_FORMAT_BAYER_GR12 0x01100010 Bayer Green-Red 12-bit.
GX_PIXEL_FORMAT_BAYER_RG12 0x01100011 Bayer Red-Green 12-bit.
GX_PIXEL_FORMAT_BAYER_GB12 0x01100012 Bayer Green-Blue 12-bit.
GX_PIXEL_FORMAT_BAYER_BG12 0x01100013 Bayer Blue-Green 12-bit.
GX_PIXEL_FORMAT_BAYER_GR16 0x0110002E Bayer Green-Red 16-bit.
GX_PIXEL_FORMAT_BAYER_RG16 0x0110002F Bayer Red-Green 16-bit.
GX_PIXEL_FORMAT_BAYER_GB16 0x01100030 Bayer Green-Blue 16-bit.
GX_PIXEL_FORMAT_BAYER_BG16 0x01100031 Bayer Blue-Green 16-bit.
GX_PIXEL_FORMAT_RGB8_PLANAR 0x02180021 Red-Green-Blue 8-bit planar.
GX_PIXEL_FORMAT_RGB10_PLANAR 0x02300022 Red-Green-Blue 10-bit unpacked.
GX_PIXEL_FORMAT_RGB12_PLANAR 0x02300023 Red-Green-Blue 12-bit unpacked.
GX_PIXEL_FORMAT_RGB16_PLANAR 0x02300024 Red-Green-Blue 16-bit planar.
3.6. GX_FRAME_STATUS_LIST
Definition Value Explanation
GX_FRAME_STATUS_SUCCESS 0 The frame status is successful.
GX_FRAME_STATUS_INCOMPLETE -1 The frame status is incomplete.
3.7. GX_FEATURE_TYPE
Definition Value Explanation
GX_FEATURE_INT 0x10000000 Integer function.
GX_FEATURE_FLOAT 0x20000000 Float function.
GX_FEATURE_ENUM 0x30000000 Enumerated function.
GX_FEATURE_BOOL 0x40000000 Boolean function.
GX_FEATURE_STRING 0x50000000 String function.
GX_FEATURE_BUFFER 0x60000000 Register function.
GX_FEATURE_COMMAND 0x70000000 Command function.
3.8. GX_BAYER_CONVERT_TYPE_LIST
Definition Value Explanation
GX_RAW2RGB_NEIGHBOUR 0 Neighborhood average interpolation algorithm.
GX_RAW2RGB_ADAPTIVE 1 Edge adaptive interpolation algorithm.
GX_RAW2RGB_NEIGHBOUR3 2 Larger neighborhood average algorithm.
3.9. GX_VALLID_BIT_LIST
Definition Value Explanation
GX_BIT_0_7 0 bit 0~7
GX_BIT_1_8 1 bit 1~8
GX_BIT_2_9 2 bit 2~9
GX_BIT_3_10 3 bit 3~10
GX_BIT_4_11 4 bit 4~11
3.10. GX_IP_CONFIGURE_MODE_LIST
Definition Value Explanation
GX_IP_CONFIGURE_LLA 4 Start LLA mode to configure IP address.
GX_IP_CONFIGURE_STATIC_IP 5 Use static IP mode to configure IP address.
Use DHCP mode, use DHCP server to configure
GX_IP_CONFIGURE_DHCP 6
IP address.
GX_IP_CONFIGURE_DEFAULT 7 Use default mode to configure IP address.
3.11. GX_RESET_DEVICE_MODE
Definition Value Explanation
GX_MANUFACTURER_SPECIFIC_REC Device reconnection. It is equivalent to the
1
ONNECT software interface close the device.
GX_MANUFACTURER_SPECIFIC_RES Device reset. It is equivalent to powering off and
2
ET powering up the device.
3.12. COLOR_TRANSFORM_FACTOR
Definition Default value Value range Explanation
float
1.0 -4.0 ~ 4.0 Red Channel Gain contribution to the red pixel.
fGain00
float
0.0 -4.0 ~ 4.0 Green Channel Gain contribution to the red pixel.
fGain01
float
0.0 -4.0 ~ 4.0 Blue Channel Gain contribution to the red pixel.
fGain02
float
0.0 -4.0 ~ 4.0 Red Channel Gain contribution to the green pixel.
fGain10
float
1.0 -4.0 ~ 4.0 Green Channel Gain contribution to the green pixel.
fGain11
float
0.0 -4.0 ~ 4.0 Blue Channel Gain contribution to the green pixel.
fGain12
float
0.0 -4.0 ~ 4.0 Red Channel Gain contribution to the blue pixel.
fGain20
float
0.0 -4.0 ~ 4.0 Green Channel Gain contribution to the blue pixel.
fGain21
Interface List:
GetInstance Static function, and can be called globally. Return to the IGXFactory object
instance.
UpdateDeviceList Enumerate the device (subnet enumeration for GigE Vision device).
UpdateAllDeviceList Enumerate the device (all subnet enumeration for GigE Vision device).
6.1.1. GetInstance
Interface definition:
Function description:
Static function, and can be called globally. Return to the IGXFactory object instance.
6.1.2. Init
Interface definition:
void Init(void)
Function description:
6.1.3. Uninit
Interface definition:
void Uninit(void)
Function description:
6.1.4. UpdateDeviceList
Interface definition:
System::Collections::Generic::List<IGXDeviceInfo> listDeviceInfo)
Function description:
6.1.5. UpdateAllDeviceList
Interface definition:
System::Collections::Generic::List<IGXDeviceInfo> listDeviceInfo)
Function description:
6.1.6. OpenDeviceByIP/MAC/SN/UserID
Interface definition:
Function description:
6.1.7. GigEIPConfiguration
Interface definition:
GX_IP_CONFIGURE_MODE emIpConfigMode,
Function description:
6.1.8. GigEForceIP
Interface definition:
String^ strIpAddress,
String^ strSubnetMask,
String^ strDefaultGateway)
Function description:
6.1.9. GigEResetDevice
Interface definition:
Function description:
Execute device reconnection or device reset operation. See section 2.2 for details.
Device reconnection is usually used when debugging GigE cameras. The device has been opened, the
program is abnormal, and then the device is reopened immediately, and an error is reported (because the
heartbeat time is 5 minutes, the device is still open). In this case, you can use the device reconnection
function to make the device unopened. Then open the device again and it will succeed.
Device reset is usually used when the camera status is abnormal. In this case, the device reconnection
function does not work, and there is no condition to repower the device. Try to use the device reset function
to power off and power up the device. After the device is reset, you need to enumerate device and open
device again.
Note:
1) Device reset takes about 1s, so you need to ensure that the enumeration interface is called after 1s.
2) If the device is acquiring normally, you cannot use the device reset and device reconnection function,
otherwise the device will offline.
6.2. IGXDeviceInfo
Device information storage unit, stores all the information of the device. You can get the information by the
enumeration interface: IGXFactory::UpdateDeviceList or IGXFactory::UpdateAllDeviceList
Interface list:
GetDeviceID Get the DeviceID, and the ID can be used to identify the device uniquely.
GetDeviceClass Get the device class, such as USB2.0, USB3.0, and GigE.
GetMAC Get the MAC address of the device, set the value to NULL for non-GigE device.
GetIP Get the IP address of the device, set the value to NULL for non-GigE device.
GetSubnetMask Get the subnet mask of the device, set the value to NULL for non-GigE device.
GetGateway Get the default gateway of the device, set the value to NULL for non-GigE
device.
GetNICMAC Get the corresponding NIC MAC address of the device, set the value to NULL
for non-GigE device.
GetNICIP Get the corresponding NIC IP address of the device, set the value to NULL for
non-GigE device.
GetNICSubnetMask Get the corresponding NIC subnet mask of the device, set the value to NULL
for non-GigE device.
GetNICGateway Get the corresponding NIC default gateway of the device, set the value to NULL
GetNICDescription Get the corresponding NIC description information of the device, set the value
to NULL for non-GigE device.
6.2.1. GetVendorName
Interface definition:
String GetVendorName()
Function description:
6.2.2. GetModelName
Interface definition:
String GetModelName()
Function description:
6.2.3. GetSN
Interface definition:
String GetSN()
Function description:
6.2.4. GetDisplayName
Interface definition:
String GetDisplayName()
Function description:
6.2.5. GetDeviceID
Interface definition:
String GetDeviceID()
Function description:
Get the DeviceID, and the ID can be used to identify the device uniquely.
6.2.6. GetUserID
Interface definition:
String GetUserID()
Function description:
6.2.7. GetAccessStatus
Interface definition:
GX_ACCESS_STATUS GetAccessStatus()
Function description:
6.2.8. GetDeviceClass
Interface definition:
GX_DEVICE_CLASS_LIST GetDeviceClass()
Function description:
6.2.9. GetMAC
Interface definition:
String GetMAC()
Function description:
Get the MAC address of the device, set the value to NULL for non-GigE device.
6.2.10. GetIP
Interface definition:
String GetIP()
Function description:
Get the IP address of the device, set the value to NULL for non-GigE device.
6.2.11. GetSubnetMask
Interface definition:
String GetSubnetMask()
Function description:
Get the IP address of the device, set the value to NULL for non-GigE device.
6.2.12. GetGateway
Interface definition:
String GetGateway()
Function description:
Get the default gateway of the device, set the value to NULL for non-GigE device.
6.2.13. GetNICMAC
Interface definition:
String GetNICMAC()
Function description:
Get the NIC MAC address of the device, set the value to NULL for non-GigE device.
6.2.14. GetNICIP
Interface definition:
String GetNICIP()
Function description:
Get the NIC IP address of the device, set the value to NULL for non-GigE device.
6.2.15. GetNICSubnetMask
Interface definition:
String GetNICSubnetMask()
Function description:
Get the NIC subnet mask of the device, set the value to NULL for non-GigE device.
6.2.16. GetNICGateway
Interface definition:
String GetNICGateway()
Function description:
Get the NIC default gateway of the device, set the value to NULL for non-GigE device.
6.2.17. GetNICDescription
Interface definition:
String GetNICDescription()
Function description:
Get the NIC description information of the device, set the value to NULL for non-GigE device.
6.3. IGXDevice
Device object, is responsible for getting device information, feature controller (control channel), stream
object (acquisition channel), and device offline events. You can get the information by calling the interface:
IGXFactory::OpenDeviceByIP/MAC/SN/UserID.
Interface list:
OpenStream The user can open the stream by the stream channel number
which is specified, and get the stream channel object.
GetFeatureControl Get the local device layer feature controller, and control all the
functions of the local device via this controller.
GetRemoteFeatureControl Get the remote device layer feature controller, and control all the
functions of the remote device via this controller.
GetEventNumInQueue Get the event queue length of the device, represents how much
cache data is in the current event queue.
6.3.1. GetDeviceInfo
Interface definition:
IGXDeviceInfo GetDeviceInfo()
Function description:
6.3.2. GetStreamCount
Interface definition:
UInt32 GetStreamCount()
Function description:
6.3.3. OpenStream
Interface definition:
Function description:
Parameter1: 'nStreamID' stream channel number, starts from 0. The user can open the stream by the
stream channel number which is specified, and get the stream channel object.
6.3.4. GetFeatureControl
Interface definition:
IGXFeatureControl GetFeatureControl()
Function description:
Get the local device layer feature controller, and control all the functions of the local device via this
controller.
6.3.5. GetRemoteFeatureControl
Interface definition:
IGXFeatureControl GetRemoteFeatureControl()
Function description:
Get the remote device layer feature controller, and control all the functions of the remote device via
this controller.
6.3.6. GetEventNumInQueue
Interface definition:
UInt32 GetEventNumInQueue()
Function description:
Get the event queue length of the device, represents how much cache data is in the current event
queue.
6.3.7. FlushEvent
Interface definition:
void FlushEvent()
Function description:
6.3.8. RegisterDeviceOfflineCallback
Interface definition:
GX_DEVICE_OFFLINE_CALLBACK_HANDLE RegisterDeviceOfflineCallback(
Function description:
6.3.9. UnregisterDeviceOfflineCallback
Interface definition:
Function description:
6.3.10. CreateImageProcessConfig
Interface definition:
IImageProcessConfig CreateImageProcessConfig()
Function description:
6.3.11. ExportConfigFile
Interface definition:
Function description:
6.3.12. ImportConfigFile
Interface definition:
Function description:
6.3.13. Close
Interface definition:
void Close()
Function description:
6.4. IGXFeatureControl
Feature controller, the device object IGXDevice and stream object IGXStream have their own feature
controllers. Users can control all the function features of the camera via the feature controller, such as
getting an integer function controller and then controlling read-write function via the integer controller. You
can also register a feature update callback function for the feature. Users can get three different types of
feature controllers by these three ways: IGXDevice::GetFeatureControl,
IGXDevice::GetRemoteFeatureControl and IGXStream::GetFeatureControl.
Interface list:
GetFeatureNameList Get all the function name string list which the current controller supports.
GetFeatureType Get the data type of the current string feature: integer, float, enumerated
etc., for more details please see the function definition:
GX_FEATURE_TYPE.
6.4.1. GetFeatureNameList
Interface definition:
Function description:
Get all the function name string list which the current controller supports.
6.4.2. GetFeatureType
Interface definition:
Function description:
Get the data type of the current string feature: integer, float, enumerated etc. For more details please
see the function definition: GX_FEATURE_TYPE.
6.4.3. IsImplemented
Interface definition:
Function description:
6.4.4. IsReadable
Interface definition:
Function description:
6.4.5. IsWritable
Interface definition:
Function description:
6.4.6. GetIntFeature
Interface definition:
Function description:
6.4.7. GetFloatFeature
Interface definition:
Function description:
6.4.8. GetEnumFeature
Interface definition:
Function description:
6.4.9. GetBoolFeature
Interface definition:
Function description:
6.4.10. GetStringFeature
Interface definition:
Function description:
6.4.11. GetCommandFeature
Interface definition:
Function description:
6.4.12. GetRegisterFeature
Interface definition:
Function description:
6.4.13. RegisterFeatureCallback
Interface definition:
FeatureDelegate delFeatureNotify)
Function description:
6.4.14. UnregisterFeatureCallback
Interface definition:
Function description:
6.5. IIntFeature
Integer function node controller, corresponds to one integer node and can be get from
IGXFeatureControl::GetIntFeature.
Interface list:
6.5.1. GetMin
Interface definition:
int64GetMin()
Function description:
6.5.2. GetMax
Interface definition:
int64 GetMax()
Function description:
6.5.3. GetInc
Interface definition:
int64GetInc()
Function description:
6.5.4. GetValue
Interface definition:
int64 GetValue()
Function description:
6.5.5. SetValue
Interface definition:
Function description:
6.6. IFloatFeature
Float function node controller, corresponds one float function node and can be get from
IGXFeatureControl::GetFloatFeature.
Interface list:
HasInc Check to see if the float type value has step length.
GetInc Get the step length of float type value. If HasInc interface returns 'false', then it
will return 0 when calling this interface.
6.6.1. GetMin
Interface definition:
Double GetMin()
Function description:
6.6.2. GetMax
Interface definition:
Double GetMax()
Function description:
6.6.3. HasInc
Interface definition:
System::Boolean HasInc()
Function description:
6.6.4. GetInc
Interface definition:
Double GetInc()
Function description:
Get the step length of float type value. If HasInc interface returns 'false', then it will return 0 when
calling this interface.
6.6.5. GetUnit
Interface definition:
String GetUnit()
Function description:
6.6.6. GetValue
Interface definition:
Double GetValue()
Function description:
6.6.7. SetValue
Interface definition:
Function description:
6.7. IEnumFeature
The enumeration function node controller is corresponding to one enumeration function node and can be
get by the function: IGXFeatureControl::GetEnumFeature.
Interface list:
GetEnumEntryList Get the enumeration item list which enumeration function supports.
6.7.1. GetEnumEntryList
Interface definition:
System::Collections::Generic::List<String> GetEnumEntryList()
Function description:
6.7.2. GetValue
Interface definition:
String GetValue()
Function description:
6.7.3. SetValue
Interface definition:
Function description:
6.8. IBoolFeatur
The boolean function node controller is corresponding to one Boolean function node and can be get by
the function:: IGXFeatureControl::GetBoolFeature.
Interface list:
6.8.1. GetValue
Interface definition:
System::Boolean GetValue()
Function description:
6.8.2. SetValue
Interface definition:
Function description:
6.9. IStringFeature
The string function node controller is corresponding to one string function node and can be get by the
function: IGXFeatureControl::GetStringFeature.
Interface list:
GetStringMaxLength Get the maximum length of the string that can be set, not including the
terminator.
6.9.1. GetValue
Interface definition:
String GetValue()
Function description:
6.9.2. SetValue
Interface definition:
Function description:
6.9.3. GetStringMaxLength
Interface definition:
Int64 GetStringMaxLength()
Function description:
Get the maximum length of the string that can be set, not including the terminator.
6.10. ICommandFeature
The command function node controller is corresponding to one command function node and can be get
by the function: IGXFeatureControl::GetCommandFeature.
Interface list:
6.10.1. Execute
Interface definition:
void Execute()
Function description:
Execute command.
6.11. IRegisterFeature
The register function node controller is corresponding to one command function node and can be get by
the function: IGXFeatureControl::GetCommandFeature.
Interface list:
GetLength Get the length of the register buffer. The user reads this length to read-write buffer.
Get the value of the current register buffer. The length of input parameter 'ptrBuffer'
GetBuffer
must equal to the length that the interface 'GetLength' gets.
Set the value of the current register buffer. The length of input parameter 'ptrBuffer'
SetBuffer
must equal to the length that the interface 'GetLength' gets.
6.11.1. GetLength
Interface definition:
Int64 GetLength()
Function description:
Get the length of the register buffer. The user reads this length to read-write buffer.
6.11.2. GetBuffer
Interface definition:
Function description:
Get the value of the current register buffer. The length of input parameter 'ptrBuffer' must equal to the
length that the interface 'GetLength' gets.
6.11.3. SetBuffer
Interface definition:
Function description:
Set the value of the current register buffer. The length of input parameter 'ptrBuffer' must equal to the
length that the interface 'GetLength' gets.
6.12. IGXStream
Representing the stream object, and it is responsible for the related operation of grabbing images, such
as unregistering callback function and getting a single image. It can be get by the interface function:
IGXDevice::OpenStream interface.
Interface list:
GetFeatureControl Get the stream layer feature controller to control the function feature of
the stream layer.
6.12.1. StartGrab
Interface definition:
void StartGrab()
Interface description:
Start stream layer acquisition, whether using callback acquisition or a single image acquisition, the
user must call the interface function StartGrab first and start stream layer acquisition, including start
acquisition thread and resource application operation of TLClass layer.
6.12.2. StopGrab
Interface definition:
void StopGrab()
Interface description:
Stop stream layer acquisition, including stop acquisition thread of TLClass layer and release resources
operation etc.
6.12.3. RegisterCaptureCallback
Interface definition:
Interface description:
Register the user delegate acquisition callback function. Parameter 1 is the user private parameter, it
is returned to the user by delegation, and parameter 2 is the user delegate callback function object.
Function requirements:
1) After starting acquisition, that is after calling the interface function StartGrab, you do not allowed
to call the register interface function.
2) The user can register the acquisition callback function repeatedly, and using the overwrite
mechanism.
6.12.4. UnregisterCaptureCallback
Interface definition:
void UnregisterCaptureCallback()
Interface description:
6.12.5. GetImage
Interface definition:
Interface description:
Get a single image. Parameter 1 is timeout time, unit is ms. If the image is not captured within the
time, the timeout error will returned.
Function requirements:
If the user registers the acquisition delegate function, then it is not allowed to call GetImage interface.
If call this interface forcibly, it will return illegal call exception error.
6.12.6. GetImageNoThrow
Interface definition:
Interface description:
Get a single image. Parameter 1 is timeout time, unit is ms. If the image is not captured within the
time, NULL will be returned.
Function requirements:
If the user registers the acquisition delegate function, then it is not allowed to call GetImage interface.
If call this interface forcibly, it will return illegal call exception error.
6.12.7. GetFeatureControl
Interface definition:
IGXFeatureControl GetFeatureControl()
Interface description:
Get stream layer feature controller, to control the stream layer function feature.
6.12.8. FlushQueue
Interface definition:
void FlushQueue()
Interface description:
6.12.9. SetAcquisitionBufferNumber
Interface definition:
Interface description:
Function requirements:
1) This interface is optional and is not necessary in the start acquisition process.
2) The setting value must be greater than 0, if the setting value is too large and exceed the system
capacity, it will not to start acquisition successfully.
3) If need to call this interface, it must be called before start acquisition and it is not allowed to call
this interface during the acquisition process.
4) Once the user has set up the buffer number and has been successfully captured, the buffer
number will remain valid until the stream object is closed.
6.12.10. Close
Interface definition:
void Close()
Interface description:
6.12.11. GetOptimalPacketSize
Interface definition:
uint32_t GetOptimalPacketSize(void)
Interface description:
Function requirements:
1) This interface only supports Gigabit network cameras to obtain optimal packet length.
2) If need to call this interface, it must be called before starting acquisition and it is not allowed to
call this interface during the acquisition process.
6.13. IFrameData
Image object, including image databuffer and image information. After the user registering acquisition
callback function, when the images come, the image object will return to the user via entrance parameter
of the acquisition callback function.
Interface list:
GetStatus Get the status of the current frame and see if the frame is complete.
GetPayloadSize Get the current frame load and the image size.
GetBuffer Get the image data buffer, return the IntPtr type pointer and point to the
unmanaged memory directly.
ConvertToRaw8 The interface is used for non 8-bit. The user can get the specified 8
valid bit in non 8-bit data.
ConvertToRGB24 Convert the raw data to the RGB24 bit data that is interpolated.
ImageProcess To enhance the current image, and return the image after enhancing
effect.
6.13.1. GetStatus
Interface definition:
GX_FRAME_STATUS_LIST GetStatus()
Function description:
Get the status of the current frame and see if the frame is complete.
6.13.2. GetPayloadSize
Interface definition:
UInt64 GetPayloadSize()
Function description:
Get the current frame load, and the image size. If the frame information is accessible, this value is the
sum of image data size and frame information size; if the frame information is not accessible, this
value is the image data size.
6.13.3. GetWidth
Interface definition:
UInt64 GetWidth()
Function description:
6.13.4. GetHeight
Interface definition:
UInt64 GetHeight()
Function description:
6.13.5. GetPixelFormat
Interface definition:
GX_PIXEL_FORMAT_ENTRYGetPixelFormat()
Function description:
6.13.6. GetFrameID
Interface definition:
UInt64 GetFrameID()
Function description:
6.13.7. GetTimeStamp
Interface definition:
UInt64 GetTimeStamp()
Function description:
6.13.8. GetBuffer
Interface definition:
IntPtr GetBuffer()
Function description:
Get the image data buffer, return the IntPtr type pointer and point to the unmanaged memory directly.
6.13.9. ConvertToRaw8
Interface definition:
Function description:
The interface is used for non 8-bit data. The user can get specified 8 valid bit in non 8-bit data.
6.13.10. ConvertToRGB24
Interface definition:
Function description:
Convert the raw data to the RGB24 bit data by interpolation algorithm.
6.13.11. ImageProcess
Interface definition:
IntPtrImageProcess(IImageProcessConfig^ objCfg)
Function description:
To enhance the current image, and returns the enhanced image data.
Note:
1) If the 'IImageProcessConfig::IsAccelerate' returns 'true', then it will process the images by
accelerating mode. At this time the image height must be an integer multiple of four, otherwise an
error will occur in the interface.
2) The mono camera void* returns 8bit image data, the image size is image width * image height.
3) The color camera void* returns RGB image data, image size is image width * image height * 3.
6.14. IImageData
IImageData is an image data obtained from the IGXStream::GetImage interface. The interface of this object
is basically consistent with the 'IFrameData' object. Compared with the interface IFrameData, the interface
IImageData has one interface "void IImageData::Destroy()", which is used for destroying itself and
releasing resources.
6.15. IImagProcessConfig
The configurable parameter object of Image enhancement, which has a set of configuration parameter
inside, and can be get by the interface: IGXDevice::CreateImageProcessConfig.
Interface List:
SetValidBit Select the specified 8 bit valid data that to be get, and the interface is
used to specify which 8bit is selected.
IsConvertFlip Check whether the image format conversion flip function is enabled
currently.
6.15.1. SetValidBit
Interface definition:
void SetValidBit(GX_VALID_BIT_LISTemValidBits)
Function description:
Select the specified 8 bit valid data that to be get, and the interface is used for non-8bit raw data.
6.15.2. GetValidBit
Interface definition:
GX_VALID_BIT_LIST GetValidBit()
Function description:
Get specified 8 bit valid data, and the interface is used for non-8bit raw data.
6.15.3. EnableDefectivePixelCorrect
Interface definition:
voidEnableDefectivePixelCorrect(System::Boolean bEnable)
Function description:
Enable defective-pixel correction function. The defective pixel correction is enabled when the
'bEnable' is 'ture', and the defective pixel correction is disable when the 'bEnable' is 'false'.
6.15.4. IsDefectivePixelCorrect
Interface definition:
System::Boolean IsDefectivePixelCorrect()
Function description:
6.15.5. EnableSharpen
Interface definition:
voidEnableSharpen(System::Boolean bEnable)
Function description:
Enable sharpen function. When the 'bEnable' is 'ture', the sharpness function is enabled; when the
'bEnable' is 'false' the sharpness function is disabled.
6.15.6. IsSharpen
Interface definition:
System::Boolean IsSharpen()
Function description:
6.15.7. EnableAccelerate
Interface definition:
Function description:
Image processing accelerating enable. If it is set 'true', the accelerating function is enabled and if it is
set 'false', the accelerating function is disabled. If the CPU of the current PC is not allowed to
accelerate because of itself limitation, an error will occurs when the user sets 'true'.
Note:
When the acceleration function is enabled, the current image height must be an integer multiple of
four, otherwise an error will occurs in the IFrameData::ImageProces interface or
IImageData::ImageProcess interface.
6.15.8. IsAccelerate
Interface definition:
System::Boolean IsAccelerate()
Function description:
Check whether the device works in the accelerating enable status currently. 'true' means accelerating
and 'false' means not accelerating.
6.15.9. SetSharpenParam
Interface definition:
Function description:
6.15.10. GetSharpenParam
Interface definition:
System::Double GetSharpenParam()
Function description:
6.15.11. SetContrastParam
Interface definition:
Function description:
6.15.12. GetContrastParam
Interface definition:
Int32 GetContrastParam()
Function description:
6.15.13. SetGammaParam
Interface definition:
Function description:
6.15.14. GetGammaParam
Interface definition:
System::Double GetGammaParam()
Function description:
6.15.15. SetLightnessParam
Interface definition:
Function description:
6.15.16. GetLightnessParam
Interface definition:
Int32 GetLightnessParam()
Function description:
6.15.17. EnableDenoise
Interface definition:
Function description:
Enable denoise switch (not support for monochrome cameras), when the 'bEnable' is 'true', the
denoise function is enabled; when the 'bEnable' is 'false', the denoise function is disabled.
6.15.18. IsDenoise
Interface definition:
System::Boolean IsDenoise()
Function description:
6.15.19. SetSaturationParam
Interface definition:
Function description:
6.15.20. GetSaturationParam
Interface definition:
Int32 GetSaturationParam()
Function description:
6.15.21. SetConvertType
Interface definition:
Function description:
Set image format conversion algorithm (not support for monochrome cameras).
6.15.22. GetConvertType
Interface definition:
GX_BAYER_CONVERT_TYPE_LIST GetConvertType()
Function description:
6.15.23. EnableConvertFlip
Interface definition:
Function description:
6.15.24. IsConvertFlip
Interface definition:
System::Boolean IsConvertFlip()
Function description:
Get interpolation flit identification (not support for monochrome cameras), 'true' means flipping and
'false' means not flipping.
6.15.25. EnableColorCorrection
Interface definition:
Function description:
Enable color correction (not support for monochrome cameras), 'true' means enable color correction
and 'false' means disabling color correction.
6.15.26. IsColorCorrection
Interface definition:
System::Boolean IsColorCorrection()
Function description:
Check whether the color correction is enabled (not support for monochrome cameras).
6.15.27. Reset
Interface definition:
void Reset()
Function description:
The user can select to restore the optimal default parameter configuration.
6.15.28. Destroy
Interface definition:
void Destroy()
Function description:
6.15.29. IsUserSetCCParam
Interface definition:
System::Boolean IsUserSetCCParam()
Function description:
Check whether the color correction function is user-set mode (not support for monochrome cameras).
Returns true if it is user-set mode, otherwise returns false.
6.15.30. EnableUserSetCCParam
Interface definition:
Function description:
Enable user-set mode for color correction function (not support for monochrome cameras). If
bIsUserMode is true the user-set mode is enabled; otherwise it is disabled.
6.15.31. SetUserCCParam
Interface definition:
Function description:
Set stColorTransformFactor to color correction function (only supported for user-set mode) (The
recommended range of color correction structure parameters is -4 ~ 4. If the parameter setting is less
than -4, the correction effect is consistent with -4. If the parameter setting is greater than 4, the
correction effect is consistent with 4.).
6.15.32. GetUserCCParam
Interface definition:
COLOR_TRANSFORM_FACTOR GetUserCCParam()
Function description:
Get current stColorTransformFactor which used to color correction function (only supported for user-
set mode).
7. Revision History
No. Version Changes Date