0% found this document useful (0 votes)
38 views

NeptuneC API Manual - ENG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

NeptuneC API Manual - ENG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 174

NeptuneC API

NeptuneC API Manual


IMI TECHNOLOGY GigE Vision™ / USB3 Vision™ / IEEE 1394 Camera API manual v2.2.0.0

#616, MegaValley, 799, Gwanyang 2-dong,


Dongan-gu, Anyang-si, Gyeonggi-do, Korea
Tel : 82-31-423-9801 Fax : 82-31-423-9802
NeptuneC API Manual

1. License............................................................................................................................................. 1
1.1 Note ....................................................................................................................................... 1
2. NeptuneC API .................................................................................................................................. 2
2.1 About the API ....................................................................................................................... 2
2.2 System Requirement ............................................................................................................ 2
2.3 Software Requirement ......................................................................................................... 2
3. Summary of API functions .............................................................................................................. 3
4. API function details ........................................................................................................................ 7
4.1 Library Initialization ............................................................................................................. 7
4.1.1 ntcInit ......................................................................................................................... 8
4.1.2 ntcUninit ..................................................................................................................... 9
4.2 Camera Information ........................................................................................................... 10
4.2.1 ntcGetCameraCount ................................................................................................. 11
4.2.2 ntcGetCameraInfo .................................................................................................... 12
4.2.3 ntcSetDeviceCheckCallback ..................................................................................... 14
4.3 Camera control ................................................................................................................... 15
4.3.1 ntcOpen .................................................................................................................... 16
4.3.2 ntcClose .................................................................................................................... 18
4.3.3 ntcGetCameraType ................................................................................................... 19
4.3.4 ntcSetHeartbeatTime ............................................................................................... 21
4.3.5 ntcSetUnplugCallback .............................................................................................. 22
4.3.6 ntcShowControlDialog ............................................................................................. 23
4.3.7 ntcSetPacketResend................................................................................................. 24
4.4 Image information and setting .......................................................................................... 25
4.4.1 ntcGetPixelFormatList .............................................................................................. 26
4.4.2 ntcGetPixelFormat.................................................................................................... 28
4.4.3 ntcGetPixelFormatString.......................................................................................... 29
4.4.4 ntcSetPixelFormat .................................................................................................... 30
4.4.5 ntcGetBitsPerPixel.................................................................................................... 31
4.4.6 ntcGetFrameRateList ............................................................................................... 32
4.4.7 ntcGetFrameRate ..................................................................................................... 34
4.4.8 ntcGetFrameRateString ........................................................................................... 35
4.4.9 ntcSetFrameRate ...................................................................................................... 36
4.4.10 ntcGetImageSize ...................................................................................................... 37
4.4.11 ntcGetMaxImageSize ............................................................................................... 38
4.4.12 ntcSetImageSize ...................................................................................................... 39
4.4.13 ntcGetBayerConvert ................................................................................................. 40
4.4.14 ntcSetBayerConvert ................................................................................................. 41
4.4.15 ntcGetBayerLayout ................................................................................................... 42
4.4.16 ntcSetBayerLayout ................................................................................................... 43
4.4.17 ntcGetBytePerPacket ............................................................................................... 44
4.4.18 ntcSetBytePerPacket ................................................................................................ 45
4.4.19 ntcGetPacketSize...................................................................................................... 46
4.4.20 ntcSetPacketSize ...................................................................................................... 47
4.5 Acquire image ..................................................................................................................... 48
4.5.1 ntcGetAcquisitionMode ............................................................................................ 49
4.5.2 ntcSetAquisitionMode .............................................................................................. 50
4.5.3 ntcOneShot ............................................................................................................... 51
4.5.4 ntcMultiShot ............................................................................................................. 52
4.5.5 ntcSetBufferCount .................................................................................................... 53
4.5.6 ntcGetBufferSize ...................................................................................................... 54
4.5.7 ntcSetUserBuffer ...................................................................................................... 55
4.5.8 ntcSetEffect .............................................................................................................. 56
4.5.9 ntcGrab ..................................................................................................................... 57
4.5.10 ntcSetFrameCallback................................................................................................ 59
4.5.11 ntcSetFrameDropCallback........................................................................................ 61
4.5.12 ntcSetDisplay ............................................................................................................ 62
4.5.13 ntcSetAcquisition ..................................................................................................... 63
4.5.14 ntcGetAcquisition ..................................................................................................... 64
4.5.15 ntcSetMulticastAddress............................................................................................ 65
4.5.16 ntcGetReceiveFrameRate......................................................................................... 66
4.5.17 ntcGetRGBData......................................................................................................... 67
4.5.18 ntcSaveImage........................................................................................................... 68
4.5.19 ntcStartStreamCapture ............................................................................................ 69
4.5.20 ntcStopStreamCapture ............................................................................................. 70
4.5.21 ntcSetRecvDroppedFrame ....................................................................................... 71
4.5.22 ntcSetRotation.......................................................................................................... 72
4.6 Feature Control ................................................................................................................... 73
4.6.1 ntcGetFeature ........................................................................................................... 75
4.6.2 ntcSetFeature ........................................................................................................... 77
4.6.3 ntcSetShutterString ................................................................................................. 78
4.6.4 ntcGetAutoAreaControl ............................................................................................ 79
4.6.5 ntcSetAutoAreaControl ............................................................................................ 81
4.6.6 ntcSetAFControl ....................................................................................................... 83
4.6.7 ntcSaveCameraParameter ....................................................................................... 84
4.6.8 ntcLoadCameraParameter ....................................................................................... 86
4.6.9 ntcSetNTSCPALSelector ........................................................................................... 87
4.6.10 ntcGetNTSCPALSelector ........................................................................................... 88
4.6.11 ntcSetAcquisitionFrameRateSel ............................................................................... 89
4.6.12 ntcGetAcquisitionFrameRateSel .............................................................................. 90
4.6.13 ntcGetAcquisitionFrameRateList ............................................................................. 91
4.6.14 ntcSetResolutionSelector ......................................................................................... 92
4.6.15 ntcGetResolutionSelector ........................................................................................ 93
4.6.16 ntcGetResolutionList ................................................................................................ 94
4.6.17 ntcSetDayNightModeSelector .................................................................................. 95
4.6.18 ntcGetDayNightModeSelector .................................................................................. 96
4.7 Trigger information and setting ......................................................................................... 97
4.7.1 ntcGetTriggerInfo..................................................................................................... 99
4.7.2 ntcGetTrigger .......................................................................................................... 101
4.7.3 ntcSetTrigger ........................................................................................................... 102
4.7.4 ntcGetTriggerDelay ................................................................................................. 103
4.7.5 ntcSetTriggerDelay.................................................................................................. 104
4.7.6 ntcRunSWTrigger .................................................................................................... 105
4.7.7 ntcReadTriggerTable ............................................................................................... 106
4.7.8 ntcSaveTriggerTable ............................................................................................... 108
4.7.9 ntcLoadTriggerTable ............................................................................................... 109
4.7.10 ntcSetTriggerMode14Exposure............................................................................... 110
4.7.11 ntcSetUSBTriggerBufferCount ................................................................................ 111
4.8 Strobe information and setting ......................................................................................... 112
4.8.1 ntcGetStrobeInfo..................................................................................................... 113
4.8.2 ntcGetStrobe ........................................................................................................... 115
4.8.3 ntcSetStrobe ............................................................................................................ 116
4.9 Auto iris control ................................................................................................................. 117
4.9.1 ntcSetAutoIrisMode ................................................................................................ 118
4.9.2 ntcGetAutoIrisAverageFrame ................................................................................. 119
4.9.3 ntcSetAutoIrisAverageFrame .................................................................................. 120
4.9.4 ntcGetAutoIrisTargetValue ..................................................................................... 121
4.9.5 ntcSetAutoIrisTargetValue ..................................................................................... 122
4.10 GPIO control ...................................................................................................................... 123
4.10.1 ntcSetGPIO .............................................................................................................. 124
4.11 UserSet control .................................................................................................................. 125
4.11.1 ntcGetUserSet ......................................................................................................... 126
4.11.2 ntcSetUserSet .......................................................................................................... 127
4.11.3 ntcSetDefaultUserSet .............................................................................................. 128
4.11.4 ntcSetPowerOnDefaultUserSet ............................................................................... 129
4.12 Look-up-table control ........................................................................................................ 130
4.12.1 ntcGetKneeLUT ........................................................................................................ 131
4.12.2 ntcSetKneeLUT ........................................................................................................ 132
4.12.3 ntcGetUserLUT......................................................................................................... 133
4.12.4 ntcSetUserLUT ......................................................................................................... 134
4.13 Frame Save control ............................................................................................................ 135
4.13.1 ntcGetFrameSave .................................................................................................... 136
4.13.2 ntcSetFrameSave..................................................................................................... 137
4.14 SIO control ......................................................................................................................... 138
4.14.1 ntcSetSIO................................................................................................................. 139
4.14.2 ntcWriteSIO ............................................................................................................. 141
4.14.3 ntcReadSIO.............................................................................................................. 142
4.15 Register access .................................................................................................................. 143
4.15.1 ntcReadRegister ...................................................................................................... 144
4.15.2 ntcWriteRegister ..................................................................................................... 145
4.15.3 ntcReadBlock ........................................................................................................... 146
4.15.4 ntcWriteBlock .......................................................................................................... 147
4.15.5 ntcWriteBroadcast................................................................................................... 148
4.16 XML control ........................................................................................................................ 149
4.16.1 ntcGetNodeVisibility ................................................................................................ 150
4.16.2 ntcSetNodeVisibility ................................................................................................ 151
4.16.3 ntcGetNodeList ........................................................................................................ 152
4.16.4 ntcGetNodeInfo ....................................................................................................... 153
4.16.5 ntcGetNodeInt ......................................................................................................... 155
4.16.6 ntcSetNodeInt ......................................................................................................... 157
4.16.7 ntcGetNodeFloat...................................................................................................... 158
4.16.8 ntcSetNodeFloat ...................................................................................................... 160
4.16.9 ntcGetNodeEnum .................................................................................................... 161
4.16.10 ntcSetNodeEnum ..................................................................................................... 163
4.16.11 ntcGetNodeString .................................................................................................... 164
4.16.12 ntcSetNodeString .................................................................................................... 165
4.16.13 ntcGetNodeBoolean................................................................................................. 166
4.16.14 ntcSetNodeBoolean ................................................................................................. 167
4.16.15 ntcSetNodeCommand .............................................................................................. 168
5. Revision History .......................................................................................................................... 169
5.1 Changes from previous version (1.0.0.0) ......................................................................... 169
5.2 Changes from previous version (1.0.1.0) ......................................................................... 169
5.3 Changes from previous version (1.0.2.0) ......................................................................... 169
5.4 Changes from previous version (2.0.0.0) ......................................................................... 169
5.5 Changes from previous version (2.0.1.0) ......................................................................... 169
NeptuneC API Manual – V5.0.0.0 Page 1

1. License
1.1 Note
IMI TECHNOLOGY GigE Vision™/USB3 Vision™/IEEE 1394 Camera API (NeptuneC C type library) only supports IMI
TECHNOLOGY hardware and strictly forbidden to use or build application for cameras or hardware from other
vendors with this API.
By Installing, copying or otherwise using the SOFTWARE, you agree to be bound by the terms of the End User
License Agreements (EULA). The SOFTWARE includes IMI TECHNOLOGY and IMI TECHNOLOGY suppliers’
intellectual property. Please read IMI TECHNOLOGY and IMI TECHNOLOGY supplier’s EULA before installing the
SOFTWARE. If you do not accept the terms of the license agreements, please do not install copy or use this
SOFTWARE.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 2

2. NeptuneC API
2.1 About the API
The NeptuneC API is implemented as C-type function library and it is based on the GenICamTM
(www.genicam.org) which provides a generic programming interface for Gigabit Ethernet Cameras and IEEE
1394 Cameras that are compliant to the GigE Vision™, USB3 Vision™ and IEEE 1394 Standard Specification.
Please refer to the IEEE homepage (www.ieee.org), GigE vision homepage (www.machinevisiononline.org) and
AIA homepage(www.visiononline.org) for further details about the standard specification for both types of
cameras.

2.2 System Requirement


 OS : Windows 10/8.1/8/7 SP (32-bit and 64-bit)
 CPU : 1.8 GHz or faster process. Dual-core or better
 RAM : 32-bit : 2GB or higher
64-bit : 4GB or higher
 Disk Space : 200 MB
 Screen Resolution: 1024 ⅹ 768 pixels or higher
 Gigabit Ethernet NIC : Support Jumbo Packet
 IEEE 1394 Card
 USB 3.0

2.3 Software Requirement


 Microsoft Visual Studio 2010 SP1 or higher
 Microsoft Visual C++ 2017 Redistributable
 Microsoft .Net Framework 4.0

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 3

3. Summary of API functions


All API functions return “ENeptuneError” enumeration value defined int the “NeptuneDef.h” API header file. The
API function returns return 0(NEPTUNE_ERR_Success) when succeeded and returns defined minus value if failed.
Category Function Description
ntcInit Initialize NeptuneC library.
Initialize Functions
ntcUninit Uninitialize NeptuneC library.
ntcGetCameraCount Return the number of cameras currently connected.
Camera
ntcGetCameraInfo Return information of all cameras connected.
Information
Register callback function which is called when the
Functions ntcSetDeviceCheckCallback
number of camera is changed.
Camera Control ntcOpen Select camera to use.
Functions ntcClose Deselect camera.
ntcGetCameraType Return the type (1394, GigE, USB3) of a camera.
ntcSetHeartbeatTime Set the heartbeat time of a GigE camera.
Register callback function which is called when a camera
ntcSetUnplugCallback
is plugged off.
ntcShowControlDialog Show the control dialog for a camera.
ntcSetPacketResend Control GigE camera to send dropped stream packet.
Image Information ntcGetImageSize Return the image size for a given pixel format.
and Settings Return the maximum image size for a given pixel
ntcGetMaxImageSize
format.
ntcSetImageSize Set the image size to a camera.
ntcGetPixelFormatList Return the pixel format list supported by a camera.
Return the pixel format enumeration value currently
ntcGetPixelFormat
assigned.
ntcGetPixelFormatString Convert pixel format enumeration to string.
ntcSetPixelFormat Set the pixel format to use.
ntcGetBitsPerPixel Return the number of bits for a given pixel format.
ntcGetFrameRateList Return the list of frame rate supported.
Return the frame rate enumeration value currently
ntcGetFrameRate
assigned.
ntcGetFrameRateString Convert frame rate enumeration to string.
ntcSetFrameRate Set the frame rate to a camera.
ntcGetBayerConvert Return the bayer conversion information.
ntcSetBayerConvert Set the bayer conversion information.
ntcGetBayerLayout Return the bayer pattern layout.
ntcSetBayerLayout Set the bayer pattern layout.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 4

ntcGetBytePerPacket Return the packet size of Format7 given 1394 camera.


ntcSetBytePerPacket Set the packet size of Format7 given 1394 camera.
ntcGetPacketSize Return the packet size of the GigE camera.
ntcSetPacketSize Set the packet size of the GigE camera.
ntcGetAcquisitionMode Return acquisition mode – single, multi, continuous.
ntcSetAcquisitionMode Set acquisition mode.
ntcOneShot Set a camera to send single frame.
ntcMultiShot Set a camera to send multi frame.
ntcSetBufferCount Set the number of buffers used by the NeptuneC library.
ntcGetBufferSize Get the size of buffer for an image data.
ntcSetUserBuffer Assign user allocated buffer to the API.
ntcSetEffect Set the image effect.
ntcGrab Grab the camera frame data.
Register callback function which is called when a frame
Data Acquisition ntcSetFrameCallback
data is received from a camera.
Functions
Register callback function which is called when a frame
ntcSetFrameDropCallback
data is dropped.
ntcSetDisplay Set the display window handle to use.
ntcSetAcquisition Set camera to start play.
ntcGetAcquisition Set camera to stop.
ntcSetMulticastAddress Set multicast address for GigE camera.
ntcGetReceiveFrameRate Return the real frame rate of received images.
ntcGetRGBData Return the RGB image data of an image.
ntcSetRecvDroppedFrame Set to receive broken image frame for a GigE camera.
ntcSetRotation Set rotation angle.
Capture Functions ntcSaveImage Save camera dato to image.
ntcStartStreamCapture Start the AVI stream capture.
ntcStopStreamCapture Stop the AVI stream capture.
Feature Control ntcGetFeature Return information of a feature.
Functions ntcSetFeature Set a feature.
ntcSetShutterString Set the shutter value with string.
ntcSaveCameraParameter Save camera setting values to a file.
Load camera setting values from a file and apply to a
ntcLoadCameraParameter
camera.
ntcSetNTSCPALSelector Set video mode of a USB3 camera.(322UC)
ntcGetNTSCPALSelector Get video mode from a USB3 camera.(322UC)
ntcSetAcquisitionFrameRateSel Set acquisition fps of a USB3 camera.(322UC)

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 5

ntcGetAcquisitionFrameRateSel Get acquisition fps from a USB3 camera.(322UC)


ntcGetAcquisitionFrameRateList Get acquisition fps list from a USB3 camera.(322UC)
ntcSetResolutionSelector Set resolution of a USB3 camera.(322UC)
ntcGetResolutionSelector Get resolution from a USB3 camera.(322UC)
ntcGetResolutionList Get resolution list from a USB3 camera.(322UC)
ntcSetDayNightModeSelector Set DayNight mode of a USB3 camera.(322UC)
ntcGetDayNightModeSelector Get DayNight mode from a USB3 camera.(322UC)
Trigger Control ntcGetTriggerInfo Return the trigger information supported by a camera.
Functions ntcGetTrigger Return the trigger values currently assigned.
ntcSetTrigger Set the trigger values.
ntcGetTriggerDelay Return the current trigger delay value.
ntcSetTriggerDelay Set the trigger delay value.
ntcRunSWTrigger Generate software trigger.
ntcReadTriggerTable Read trigger table from a camera.
ntcSaveTriggerTable Save trigger table to a camera.
ntcLoadTriggerTable Make camera to load trigger table.
Strobe Control ntcSetStrobeInfo Return the strobe information supported by a camera.
Functions ntcGetStrobe Return the strobe value currently assigned.
ntcSetStrobe Set the strobe value.
AutoIris Control ntcSetAutoIrisMode Set auto iris operation mode.
Functions ntcGetAutoIrisAverageFrame Return the average frame number of auto iris.
ntcSetAutoIrisAverageFrame Set the average frame number of auto iris.
ntcGetAutoIrisTargetValue Return the target brightness value of auto iris.
ntcSetAutoIrisTargetValue Set the target brightness value of auto iris.

GPIO Control ntcSetGPIO Set the GPIO value.


User Set Control ntcGetUserSet Return the information of UserSet.
Functios ntcSetUserSet Set the UserSet.
ntcSetDefaultUserSet Assign the UserSet as default in a camera.
Assign the UserSet as one used when camera is power
ntcSetPowerOnDefaultUserSet
on.
Look-up-table ntcGetKneeLUT Return the knee look-up-table.
Control Functions ntcSetKneeLUT Set the knee look-up-table.
ntcGetUserLUT Return the user look-up-table.
ntcSetUserLUT Set the user look-up-table.
Frame Save ntcGetFrameSave Return information of frame save.
Control Functions ntcSetFrameSave Set the frame save.
SIO Control ntcSetSIO Set the information on SIO.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 6

Functions ntcWriteSIO Write data to SIO.


ntcReadSIO Read data from SIO.
Register Access ntcReadRegister Read data from a register of a camera.
Functions ntcWriteRegister Write data to a register of a camera.
ntcReadBlock Read 4bytes or more data from a register of a camera..
ntcWriteBlock Rwrite 4bytes or more data to a register of a camera.
ntcWriteBroadcast Write data to a register of 1394 camera with broadcast.
XML Control ntcGetNodeVisibility Return the visibility attribute of XML node.
Functions ntcSetNodeVisibility Set the visibility attribute of XML node.
ntcGetNodeList Return the list of XML node.
ntcGetNodeInfo Return the information of XML node.
ntcGetNodeInt Return the value of integer type XML node.
ntcSetNodeInt Set the value to integer type XML node.
ntcGetNodeFloat Return the value of float type XML node.
ntcSetNodeFloat Set the value to float type XML node.
ntcGetNodeEnum Return the value of enumeration type XML node.
ntcSetNodeEnum Set the value to enumeration type XML node.
ntcGetNodeString Return the value of string type XML node.
ntcSetNodeString Set the value to string type XML node.
ntcGetNodeBoolean Return the value of boolean type XML node.
ntcSetNodeBoolean Set the value to boolean type XML node.
ntcSetNodeCommand Execute the command type XML node.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 7

4. API function details


4.1 Library Initialization
The NeptuneC library should be initialized before calling any other function except “ntcInit”. All API functions
return “NEPTUNE_ERR_APINotInitialized” error when called without initialization.
When finished using the NeptuneC library, call the “ntcUninit” to clear the library.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 8

4.1.1 ntcInit

Description
Initialize the NeptuneC library.

Definition
ENeptuneError ntcInit()

Parameters
None

Remark
This API function should be called first before calling any other API functions.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ntcInit();

See Also
ntcUnit

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 9

4.1.2 ntcUninit

Description
Unitialize and clear the NeptuneC library.

Definition
ENeptuneError ntcUninit()

Parameters
None

Remark
User should clear the NeptuneC API by calling this function before closing his own application.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ntcUninit();

See Also
ntcInit

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 10

4.2 Camera Information


After the library is initialized, user can get information about the number of cameras and detailed information for
a camera. The camera information is passed with the “NEPTUNE_CAM_INFO” structure and user can register the
callback function which is called if the number of camera is changed.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 11

4.2.1 ntcGetCameraCount

Description
Get the number of cameras connected to the system.

Definition
ENeptuneError ntcGetCameraCount(_uint32_t* pnNumbers)

Parameters
[OUT] pnNumbers : number of cameras

Remark
User can get all connected cameras including 1394, GigE and USB3 camera with this function.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
_uint32_ t nCount;
if ( ntcGetCameraCount(&nCount) == NEPTUNE_ERR_Success)
; // do something

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 12

4.2.2 ntcGetCameraInfo

Description
Get information of all cameras.

Definition
ENeptuneError ntcGetCameraInfo(PNEPTUNE_CAM_INFO pInfo, _uint32_t nLegnth)

Parameters
[OUT] pInfo : pointer of NEPTUNE_CAM_INFO structure
[IN] nLength : size of the NEPTUNE_CAM_INFO structure

Remark
User can get camera information with this function. User should call this function after allocating the
“NPETUNE_CAM_INFO” structure as much as returned by the “ntcGetCameraCount” function. The
NEPTUNE_CAM_INFO is defined in the “NeptuneDev.h” as below.

struct NEPTUNE_CAM_INFO {
_char_t strVendor[MAX_STRING_LENGTH]; // camera vendor name
_char_t strModel[MAX_STRING_LENGTH]; // camera model name
_char_t strSerial[MAX_STRING_LENGTH]; // camera serial number
_char_t strUserID[MAX_STRING_LENGTH]; // user ID
_char_t strIP[MAX_STRING_LENGTH]; // IP address(GigE camera)
_char_t strMAC[MAC_LENGTH]; // MAC address(GigE camera)
_char_t strSubnet[MAX_STRING_LENGTH]; // Subnet address(GigE camera)
_char_t strGateway[MAX_STRING_LENGTH]; // Gateway address(GigE camera)
_char_t strCamID[MAX_STRING_LENGTH]; // unique Camera ID
};
typedef NEPTUNE_CAM_INFO* PNEPTUNE_CAM_INFO;

The camera other than GigE has no information about “strip”, “strMAC”, “strSubnet”, “strGateway”. And
these information is blank.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
PNEPTUNE_CAM_INFO pCamInfo = NULL;
_uint32_t nCameras = 0;
if ( ntcGetCameraCount(&nCameras) == NEPTUNE_ERR_Success )
{
pCamInfo = new NEPTUNE_CAM_INFO[nCameras];
ntcGetCameraInfo(pCamInfo, nCameras);
}

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 13

See Also
ntcGetCameraCount

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 14

4.2.3 ntcSetDeviceCheckCallback

Description
Register callback function which is called when camera number has changed.

Definition
ENeptuneError ntcSetDeviceCheckCallback(NeptuneCDevCheckCallback DeviceCallback,
void* pContext)

Parameters
[IN] DeviceCallback : callback function
[IN] pContext : user parameter passed to the callback function

Remark
This API function is used to register callback function which is called when number of camera
connected to the system is changed. If camera count is increased, the “NEPTUNE_DEVICE_ADDED”
state is passed to the callback function and if decreased, “NEPTUNE_DEVICE_REMOVED” is passed.
The callback function is defined in the “NeptuneDef.h” as below.

enum ENeptuneDeviceChangeState
{
NEPTUNE_DEVICE_ADDED = 0, // camera count is increased
NEPTUNE_DEVICE_REMOVED =1 // camera count is decreased
};

// device check callback


typedef void (*NeptuneCDevCheckCallback)(ENeptuneDeviceChangeState eState, void* pContext);

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
void DeviceCheckCallback(ENeptuneDeviceChangeState eState, void* pContext)
{
}

ntcSetDeviceCheckCallback(DeviceCheckCallback, this);

See Also
ntcSetUnplugCallback

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 15

4.3 Camera control


User has to get the access right to control the camera. The access right should be done before calling the API
function which controls camera and the right should be returned when user finishs using the camera by calling
the “ntcClose” function.
For the GigE cameras, the default heartbeat time which is similar to the watch-dog is 3 seconds. User can change
the heartbeat time.
User can also register the callback function which is called when the camera is removed.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 16

4.3.1 ntcOpen

Description
Get the camera handle to access.

Definition
NeptuneCamHandle ntcOpen(_char_t* pstrDevID, NeptuneCamHandle* phCamHandle,
ENeptuneDevAccess eAccessFlag=NEPTUNE_DEV_ACCESS_EXCLUSIVE)

Parameters
[IN] pstrDevID : ID string of a camera
[OUT] phCamHandle : camera handle
[IN, Optional] AccessFlag : control mode

Remark
User should get the information of a camera to get the access right and use the “strCamID” element of
the “NEPTUNE_CAM_INFO” structure to get the access right. The “ENeptuneDevAccess” enumeration
declared in the “NeptuneDev.h” is used to get the access right and it is defined as below. The
“NEPTUNE_DEV_ACCESS_CONTROL” and “NEPTUNE_DEV_ACCESS_MONITOR” value is used for the
multicast stream mode.

NEPTUNE_DEV_ACCESS_UNKNOWN : unknown error


NEPTUNE_DEV_ACCESS_EXCLUSIVE : get all control right, any other application can’t access camera
NEPTUNE_DEV_ACCESS_CONTROL : get control right, other application can access camera(multicast)
NEPTUNE_DEV_ACCESS_MONITOR : can’t control camera, cam receive stream only(multicast)

The return handle of this function is used for other API functions.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
PNEPTUNE_CAM_INFO pCamInfo = NULL;
_uint32_t nCameras = ntcGetCameraCount();
if ( nCameras > 0 )
{
pCamInfo = new NEPTUNE_CAM_INFO[nCameras];
ntcGetCameraInfo(pCamInfo, nCameras);
}

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 17

NeptuneCamHandle hCamHandle;

// if unicast
ntcOpen(pCamInfo[0].strCamID, &hCamHandle);
// if multicast
ntcOpen(pCamInfo[0].strCamID, &hCamHandle, NEPTUNE_DEV_ACCESS_CONTROL);

See Also
ntcClose

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 18

4.3.2 ntcClose

Description
Close the camera handle.

Definition
ENeptuneError ntcClose(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
Call this function if camera is not used any more.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
PNEPTUNE_CAM_INFO pCamInfo = NULL;
_uint32_t nCameras = 0;
if ( ntcGetCameraCount(&nCameras) == NEPTUNE_ERR_Success )
{
pCamInfo = new NEPTUNE_CAM_INFO[nCameras];
ntcGetCameraInfo(pCamInfo, nCameras);
}

NeptuneCamHandle hCamHandle;
if ( ntcOpen(pCamInfo[0].strCamID, &hCamHandle) == NEPTUNE_ERR_Success )
{
ntcClose(hCamHandle);
hCamHandle = NULL;
}

See Also
ntcOpen

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 19

4.3.3 ntcGetCameraType

Description
Get the type of a camera.

Definition
ENeptuneError ntcGetCameraType(NeptuneCamHandle hCamHandle,
ENeptuneDevType* peType)

Parameters
[IN] hCamHandle : camera handle
[OUT] peType : camera type (1394 or GigE)

Remark
The camera type supported by the NeptunC library is defined with the “ENeptuneDevType”
enumeration declared in the “NeptuneDev.h” as below

enum ENeptuneDevType
{
NEPTUNE_DEV_TYPE_UNKNOWN = -1, // unknown camera
NEPTUNE_DEV_TYPE_GIGE = 0, // GigE camera
NEPTUNE_DEV_TYPE_1394 = 1, // 1394 camera
NEPTUNE_DEV_TYPE_USB3 = 2, // USB3 Vision camera
};

Some functions are depend on the camera type.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ENeptuneDevType eType;
ntcGetCameraType(&eType);
if ( eType == NEPTUNE_DEV_TYPE_GIGE )
{
// do something
}
else if ( eType == NEPTUNE_DEV_TYPE_1394 )
{
// do something
}
Else if ( eType == NEPTUNE_DEV_TYPE_USB3 )
{
// do something

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 20

See Also
ntcOpen

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 21

4.3.4 ntcSetHeartbeatTime

Description
Set the heartbeat time of GigE camera.

Definition
ENeptuneError ntcSetHeartbeatTime(NeptuneCamHandle hCamHandle, _ulong32_t nTime)

Parameters
[IN] hCamHandle : camera handle
[IN] nTime : heartbeat time(mili-second unit)

Remark
The GigE camera needs periodic transaction to the camera and camera connection is closed if the
transaction is not happen in heartbeat time period. The NeptuneC API starts periodic transaction with 3
seconds to the GigE camera when user calls “ntcOpen” function. And user can change the heartbeat
time with the “ntcSetHeartbeatTime” function.
Especially while debugging the application, the camera connection may be closed if the debugger stops
the API process when breakpoint is activated. In this case user can avoid camera disconnection by
setting large heartbeat time.

Example
NeptuneCamHandle hCamHandle;
if ( ntcOpen(pCamInfo[0].strCamID, &hCamHandle) == NEPTUNE_ERR_Success )
{
ENeptuneDevType eType;
ntcGetCameraType(hCamHandle, &eType);
if ( eType == NEPTUNE_DEV_TYPE_GIGE )
ntcSetHeartbeatTime(hCamHandle, 10000); // set 10 seconds
}

See Also
ntcOpen, ntcGetCameraType

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 22

4.3.5 ntcSetUnplugCallback

Description
Register the callback function which is called when camera is disconnected.

Definition
ENeptuneError ntcSetUnplugCallback(NeptuneCamHandle hCamHandle,
NeptuneCUnplugCallback unplugCallback,
void* pContext)

Parameters
[IN] hCamHandle : camera handle
[IN] unplugCallback : callback function
[IN] pContext : user parameter passed to the callback function

Remark
User can detect disconnection of camera which is being controlled by register the callback function with
this API function. User should not call the “nctClose” in the callback function and just initialize the
camera handle.
Please refer to the “NeptuneCPlugUnplug” sample for details.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
void UnplugCallback(void *pContext)
{
CAppDlg *pDlg = (CAppDlg *);
pDlg->m_hCamHandle = NULL;
}

ntcOpen(strCamID, &m_hCamHandle);
ntcSetUnplugCallback(m_hCamHandle, UnplugCallback, this);

See Also
ntcSetDeviceCheckCallback

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 23

4.3.6 ntcShowControlDialog

Description
Show the camera control dialog.

Definition
ENeptuneError ntcShowControlDialog(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
The NeptuneC API includes dialog which has camera information including pixel format, frame rate,
trigger, feature control and xml control. User can show the control dialog with this finction.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ntcShowControlDialog(hCamHandle);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 24

4.3.7 ntcSetPacketResend

Description
Control GigE camera to send dropped stream packet.

Definition
ENeptuneError ntcSetPacketResend(NeptuneCamHandle hCamHandle,
ENpetuneBoolean eEnableResend)

Parameters
[IN] hCamHandle : camera handle
[IN] eEnableResend : state of packet resend

Remark
User can control GigE camera with this function to send dropped stream packet if he wants. This API
function should be called in prior to the “ntcSetAcquisition” function.

Example
ntcOpen(strCamID, &m_hCamHandle); // open camera
ntcSetPacketResend(m_hCamHandle, NEPTUNE_BOOL_TRUE); // set packet resend
ntcSetAcquisition(m_hCamHandle, NEPTUNE_BOOL_TRUE); // play camera

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 25

4.4 Image information and setting


A camera may have several pixel formats, frame rates and the information of an image should be set correctly
before using the camera. The frame rate is dependent to the pixel format. So, set the pixel format first and get
the frame rate supported for a given pixel format, and then set the frame rate you want.
For 1394 camera, there is fixe image size mode and variable image size mode (Format7, ROI) while the GigE and
USB3 camera has only variable image size mode.
User can set the conversion from bayer pattern image to color image if the pixel format is bayer pattern and can
set the layout of the bayer pattern.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 26

4.4.1 ntcGetPixelFormatList

Description
Get the list of pixel format supported by a camera.

Definition
ENeptuneError ntcGetPixelFormatList(NeptuneCamHandle hCamHandle,
ENeptunePixelFormat* peList, _uint32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] peList : list of pixel format
[IN/OUT] pnSize : size of the list

Remark
The default pixel format of a camera may be undefined when a camera is power on. User has to select
the pixel format he wants among the pixel formats camera supports. The NeptuneC API defines pixel
format with the “ENeptunePixelFormat” enumeration and it is declared in the “NetuneDef.h”.

enum ENeptunePixelFormat {
Unknown_PixelFormat = -1,
// 1394 Camera pixel format list.
Format0_320x240_YUV422 = 0,
Format0_640x480_YUV411 = 1,
Format0_640x480_YUV422 = 2,
Format0_640x480_Mono8 = 3,
Format0_640x480_Mono16 = 4,
Format1_800x600_YUV422 = 5,
Format1_800x600_Mono8 = 6,
Format1_1024x768_YUV422 = 7,
Format1_1024x768_Mono8 = 8,
Format1_800x600_Mono16 = 9,
Format1_1024x768_Mono16 = 10,
Format2_1280x960_YUV422 = 11,
Format2_1280x960_Mono8 = 12,
Format2_1600x1200_YUV422 = 13,
Format2_1600x1200_Mono8 = 14,
Format2_1280x960_Mono16 = 15,
Format2_1600x1200_Mono16 = 16,
Format7_Mode0_Mono8 = 17,
Format7_Mode0_YUV411 = 18,
Format7_Mode0_YUV422 = 19,
Format7_Mode0_Mono16 = 20,
Format7_Mode0_Raw8 = 21,
Format7_Mode0_Raw16 = 22,
Format7_Mode0_Mono12 = 23,
Format7_Mode0_Raw12 = 24,
Format7_Mode1_Mono8 = 25,
Format7_Mode1_YUV411 = 26,

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 27

Format7_Mode1_YUV422 = 27,
Format7_Mode1_Mono16 = 28,
Format7_Mode1_Raw8 = 29,
Format7_Mode1_Raw16 = 30,
Format7_Mode1_Mono12 = 31,
Format7_Mode1_Raw12 = 32,
Format7_Mode2_Mono8 = 33,
Format7_Mode2_YUV411 = 34,
Format7_Mode2_YUV422 = 35,
Format7_Mode2_Mono16 = 36,
Format7_Mode2_Raw8 = 37,
Format7_Mode2_Raw16 = 38,
Format7_Mode2_Mono12 = 39,
Format7_Mode2_Raw12 = 40,

// GigE/USB3 Camera pixel format list.


Mono8 = 101,
Mono10 = 102,
Mono12 = 103,
Mono16 = 104,
BayerGR8 = 105,
BayerGR10 = 106,
BayerGR12 = 107,
YUV411Packed = 108,
YUV422Packed = 109
};

As listed above, the pixel format supported by the 1394 camera and GigE camera is different.
User can know the size of the pixel format supported by a camera by calling the “ntcGetPixelFormatList”
function with second parameter as “NULL”. If the send parameter is “NULL”, the API function only
returns the size of pixel format supported. Call again the “ntcGetPixelFormatList” function after
allocation the list as much as returned size.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptunePixelFormat* pFormatList = NULL;
_uint32_t nSize = 0;
if ( ntcGetPixelFormatList(hCamHandle, NULL, &nSize) == NEPTUNE_ERR_Success )
{
pFormatList = new ENeptunePixelFormat[nSize];
ntcGetPixelFormatList(hCamHandle, pFormatList, &nSize);
}

See Also
ntcGetPixelFormat, ntcSetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 28

4.4.2 ntcGetPixelFormat

Description
Get the current pixel format from a camera.

Definition
ENeptuneError ntcGetPixelFormat(NeptuneCamHandle hCamHandle,
ENeptunePixelFormat* peFormat)

Parameters
[IN] hCamHandle : camera handle
[OUT] peFormat : pixel format

Remark
This function is used the get the current pixel format of a cmera.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptunePixelFormat eFormat;
ntcGetPixelFormat(hCamHandle, &eFormat);

See Also
ntcGetPixelFormatList, ntcSetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 29

4.4.3 ntcGetPixelFormatString

Description
Get the string value from the pixel format enumeration(ENeptunePixelFormat).

Definition
ENeptuneError ntcGetPixelFormatString(NeptuneCamHandle hCamHandle,
const ENeptunePixelFormat eFormat,
_char_t* pStr, _uint32_t nSize)

Parameters
[IN] hCamHandle : camera handle
[IN] eFormat : pixel format enumeration value
[OUT] pStr : string
[IN/OUT] nSize : size of the string

Remark
User can get the string value from the pixel format enumeration. The string is converted like as the
enumeration value passed to the function. For example, the string “Format0_640x480_YUV422” is
returned if the input enumeration value is Format0_640x480_YUV422.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptunePixelFormat Format;
ntcGetPixelFormat(hCamHandle, &Format);
_char_t str[128];
ntcGetPixelFormatString(hCamHandle, Format, str, 128);

See Also
ntcGetPixelFormatList, ntcGetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 30

4.4.4 ntcSetPixelFormat

Description
Set pixel format to a camera.

Definition
ENeptuneError ntcSetPixelFormat(NeptuneCamHandle hCamHandle,
const ENeptunePixelFormat eFormat)

Parameters
[IN] hCamHandle : camera handle
[IN] eFormat : pixel format value

Remark
The camera may not transfer correct image data if the pixel format is not set. So, user should set the
pixel format want to receive after selecting the camera.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ntcSetPixelFormat(hCamHandle, Format0_640x480_YUV422);

See Also
ntcGetPixelFormatList, ntcGetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 31

4.4.5 ntcGetBitsPerPixel

Description
Get the number of bits per pixel for a given pixel format.

Definition
ENeptuneError ntcGetBitsPerPixel(NeptuneCamHandle hCamHandle, _uint32_t* pnBits)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnBits : data bits

Remark
The number of bits per pixel is the amount needed to express one pixel and it varies according to the
pixel format. For example, the number of bits per pixel is 8 for “Mono8” pixel format while the number
of bits per pixel is 16 for “Mono16”.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ntcSetPixelFormat(hCamHandle, Mono8);
_uint32_t nBits;
ntcGetBitsPerPixel(hCamHandle, &nBits);

See Also
ntcGetPixelFormat, ntcSetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 32

4.4.6 ntcGetFrameRateList

Description
Get the list of frame rate supported for a given pixel format.

Definition
ENeptuneError ntcGetFrameRateList(NeptuneCamHandle hCamHandle,
ENeptuneFrameRate* peList, _uint32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] peList : list of frame rate
[IN/OUT] pnSize : size of the list

Remark
User should set the frame rate after selecting the pixel format because the supported frame rate may
vary according to the pixel format for 1394 camera. But, for GigE and USB3 camera, it is not needed to
set the frame rate in advance.
The supported frame rate by the NeptuneC API is defined with “ENeptuneFrameRate” enumeration
declared in the “NeptuneDef.h”.

enum ENeptuneFrameRate {
FPS_UNKNOWN = -1,
FPS_1_875 = 0, // 1.875 frame (1394 camera)
FPS_3_75 = 1, // 3.75 frame (1394 camera)
FPS_7_5 = 2, // 7.5 frame (1394 camera)
FPS_15 = 3, // 15 frame (1394 camera)
FPS_30 = 4, // 30 frame (1394 camera)
FPS_60 = 5, // 60 frame (1394 camera)
FPS_120 = 6, // 120 frame (1394 camera)
FPS_240 = 7, // 240 frame (1394 camera)
FPS_VALUE = 20 // frame rate value(GigE and USB3 camera)
};

As defined above, from “FPS_1_875” to “FPS_240” enumeration value is used for 1394 camera and
“FPS_VALUE” is used for the GigE and USB3 camera.
This API function returns the list of enumeration value and it returns the size of supported frame rate
list if called with second parameter as “NULL”. User can get the list of frame rate by calling againg this
function with second parameter as the pointer allocated.

Example

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 33

ref. NeptuneC Library\Samples\C++\GUI\0.App


ENeptuneFrameRate* pRateList = NULL;
_uint32_t nSize = 0;
if ( ntcGetFrameRateList(hCamHandle, NULL, &nSize) == NEPTUNE_ERR_Success )
{
pRateList = new ENeptuneFrameRate[nSize];
ntcGetFrameRateList(hCamHandle, pRateList, &nSize);
}

See Also
ntcSetPixelFormat, ntcGetFrameRate, ntcSetFrameRate

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 34

4.4.7 ntcGetFrameRate

Description
Get current frame rate from a camera.

Definition
ENeptuneError ntcGetFrameRate(NeptuneCamHandle hCamHandle,
ENeptuneFrameRate* peRate, _double_t* pfValue)

Parameters
[IN] hCamHandle : camera handle
[OUT] peRate : current frame rate value
[OUT] pfValue : current frame rate value(valid only if the peRate=FPS_VALUE, GigE and USB3 camera)

Remark
For 1394 camera, only the frame rate enumeration value is returned and the last parameter has no
meaning. For GigE and USB3 camera, the peRate is always returned as “FPS_VALUE” and current
frame rate is returned by the pfValue parameter.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptuneFrameRate eRate;
_double_t fValue;
ntcGetFrameRate(hCamHandle, &eRate, &fValue);
if ( eRate == FPS_VALUE )
{
// GigE and USB3 camera
}
else
{
// 1394 camera
}

See Also
ntcGetFrameRate, ntcSetFrameRate

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 35

4.4.8 ntcGetFrameRateString

Description
Get the string from the frame rate enumeration value of 1394 camera.

Definition
ENeptuneError ntcGetFrameRateString(NeptuneCamHandle hCamHandle,
const ENeptuneFrameRate eRate,
_char_t* pStr, _uint32_t nSize)

Parameters
[IN] hCamHandle : camera handle
[IN] eRate : frame rate enumeration value
[OUT] pStr : string
[IN/OUT] nSize : size of the string

Remark
This API function is used for converting the enumeration value to string except the “FPS_VALUE”. The
converted string per enumeration is as below.

FPS_1_875 : “1.875”
FPS_3_75 : “3.75”
FPS_7_5 : “7.5”
FPS_15 : “15”
FPS_30 : “30”
FPS_60 : “60”
FPS_120 : “120”
FPS_240 : “240”

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptuneFrameRate eRate;
_double_t fValue;
_char_t str[128];
ntcGetFrameRate(hCamHandle, &eRate, &fValue);
if ( ntcGetFrameRateString(hCamHandle, eRate, str, 128) == NEPTUNE_ERR_Success )
{
}

See Also
ntcGetFrameRate, ntcSetFrameRate

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 36

4.4.9 ntcSetFrameRate

Description
Set the frame rate to a camera.

Definition
ENeptuneError ntcSetFrameRate(NeptuneCamHandle hCamHandle,
ENeptuneFrameRate eRate, _double_t fValue);

Parameters
[IN] hCamHandle : camera handle
[IN] eRate : frame rate enumeration value(eRate=FPS_VALUE for GigE and USB3 camera)
[IN] fValue : frame rate value(valid only for GigE and USB3 camera)

Remark
User can set the frame rate with this API function. For 1394 camera, only the “eRate” parameter has
meaning and the “fValue” parameter is ignored. For GigE and USB3 camera, the “eRate” parameter
should be “FPS_VALUE” and “fValue” parameter is the value want to set. A camera shoule be stopped
before setting the frame rate.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ENeptuneDevType eType;
ntcGetCameraType(hCamHandle, &eType);
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_FALSE);
if ( eType == NEPTUNE_DEV_TYPE_1394 )
ntcSetFrameRate(FPS_30, 0);
else
ntcSetFrameRate(FPS_VALUE, 15.0);

See Also
ntcGetFrameRateList, ntcGetFrameRate

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 37

4.4.10 ntcGetImageSize

Description
Get the size of an image of current pixel format.

Definition
ENeptuneError ntcGetImageSize(NeptuneCamHandle hCamHandle,
PNEPTUNE_IMAGE_SIZE pImageSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] pImageSize : image size information

Remark
The size of an image may vary according to the pixel format. This API function returns the size
information under current pixel format with the “NEPTUNE_IMAGE_SIZE” structure declared in the
“NeptuneDef.h” as below.

struct NEPTUNE_IMAGE_SIZE {
_int32_t nStartX; // start point of X coordinate(width direction)
_int32_t nStartY; // start point of Y coordinate(height direction)
_int32_t nSizeX; // width
_int32_t nSizeY; // height
};
typedef NEPTUNE_IMAGE_SIZE* PNEPTUNE_IMAGE_SIZE;

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
ntcSetPixelFormat(hCamHandle, Mono8);
NEPTUNE_IMAGE_SIZE imageSize;
ntcGetImageSize(hCamHandle, &imageSize);

See Also
ntcSetPixelFormat, ntcGetMaxImageSize, ntcSetImageSize

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 38

4.4.11 ntcGetMaxImageSize

Description
Get the maximum image size supported by the current pixel format.

Definition
ENeptuneError ntcGetMaxImageSize(NeptuneCamHandle hCamHandle,
PNEPTUNE_IMAGE_SIZE pImageSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] pImageSize : maximum image size

Remark
As commented, the size of an image may vary acoording to the pixel format and this function returns
the maximum image size supported by the current pixel format.
For 1394 camera, the current image size and maximum image size is equal if the current pixel format is
fixed size mode (Format0_XXX, Format1_XXX, Format2_XXX). The current image size and maximum
image size may different for GigE and USB3 camera. And variable size pixel format mode(Format7_XXX
or ROI) of 1394 camera also may have different size and maximum size.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\Format7Control
ntcSetPixelFormat(hCamHandle, Mono8);
NEPTUNE_IMAGE_SIZE imageSize;
ntcGetMaxImageSize(hCamHandle, &imageSize);

See Also
ntcSetPixelFormat, ntcGetImageSize, ntcSetImageSize

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 39

4.4.12 ntcSetImageSize

Description
Set image size to a camera.

Definition
ENeptuneError ntcSetImageSize(NeptuneCamHandle hCamHandle,
NEPTUNE_IMAGE_SIZE ImageSize)

Parameters
[IN] hCamHandle : camera handle
[IN] ImageSize : image size

Remark
User can change image size with this API function.
For 1394 camera, variable size pixel format mode(Format7_XXX, ROI) should be set in advance to
change the image size. For GigE and USB3 camera, all pixel formats except binning support variable
size. The size range should be small or equal to the maximum image size.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\ Format7Control
NEPTUNE_IMAGE_SIZE imageSize;
imageSize.nStartX = 0;
imageSize.nStartY = 20;
imageSize.nSizeX = 320;
imageSize.nSizeY = 240;
ntcSetPixelFormat(hCamHandle, Mono8); // GigE and USB3 camera
ntcSetPixelFormat(hCamHandle, Format7_Mode0_Mono8) // 1394 camera
ntcSetImageSize(hCamHandle, imageSize);

See Also
ntcSetPixelFormat, ntcGetMaxImageSize, ntcGetImageSize

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 40

4.4.13 ntcGetBayerConvert

Description
Get the bayer conversion information.

Definition
ENeptuneError ntcGetBayerConvert(NeptuneCamHandle hCamHandle,
ENeptuneBayerMethod* peMethod)

Parameters
[IN] hCamHandle : camera handle
[OUT] peMethod : bayer conversion state

Remark
For color camera set as bayer pattern pixel format(XXX_Mono8, XXX_Mono16, BayerXX_8, BayerXX_10,
BayerXX_12), the API converts bayer pattern image to color image according to the conversion flag. If
the bayer conversion is “Off”, then the bayter pattern image is look like as mono image. Please refer to
the camera manual for details about the bayer pattern.
This API function returns the bayer conversion state with the “ENeptuneBayerMethod” declared in the
“NeptuneDef.h”.

enum ENeptuneBayerMethod {
NEPTUNE_BAYER_METHOD_NONE = 0, // no bayer conversion
NEPTUNE_BAYER_METHOD_BILINEAR = 1, // bilinear conversion
NEPTUNE_BAYER_METHOD_HQ = 2, // HQ conversion
NEPTUNE_BAYER_METHOD_NEAREST = 3 // nearest conversion
};

The HQ conversion needs highest CPU power but shows high image quality compared to other
conversion method. And the nearest conversion comsumes lowest CPU power but shows poor image.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ntcSetPixelFormat(hCamHandle, Mono8);
ENeptuneBayerMethod eMethod;
ntcGetBayerConvert(hCamHandle, &eMethod);

See Also
ntcSetPixelFormat, ntcSetBayerConvert, ntcGetBayerLayour, ntcSetBayerLayout

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 41

4.4.14 ntcSetBayerConvert

Description
Set bayer conversion method.

Definition
ENeptuneError ntcSetBayerConvert(NeptuneCamHandle hCamHandle,
ENeptuneBayerMethod eMethod)

Parameters
[IN] hCamHandle : camera handle
[IN] eMethod : bayer conversion

Remark
User can use this API function to convert bayer pattern image to color image or not.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ntcSetPixelFormat(hCamHandle, Mono8);
ntcSetBayerConvert(hCamHandle, NEPTUNE_BAYER_METHOD_BILINEAR);

See Also
ntcSetPixelFormat, ntcGetBayerConvert, ntcGetBayerLayout, ntcSetBayerLayout

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 42

4.4.15 ntcGetBayerLayout
Description
Get the bayer patter layout used for conversion.

Definition
ENeptuneError ntcGetBayerLayout(NeptuneCamHandle hCamHandle,
ENeptuneBayerLayout* peLayout)

Parameters
[IN] hCamHandle : camera handle
[OUT] peLayout : bayer pattern layout

Remark
For bayer pattern, for color pattern layout is possible. The API convert bayer pattern image with the
layout correct to a camera. If the layout is not matched with the bayer data, the correct color is not
expressed even converted.
The bayer layout is controlled with the “ENeptuneBayerLayout” enumeration declared in the
“NeptuneDef.h” as below.

enum ENeptuneBayerLayout {
NEPTUNE_BAYER_GB_RG = 0, // GB/RG layout
NEPTUNE_BAYER_BG_GR = 1, // BG/GR layout
NEPTUNE_BAYER_RG_GB = 2, // RG/GB layout
NEPTUNE_BAYER_GR_BG = 3, // GR/BG layout
};

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ntcSetPixelFormat(hCamHandle, BayerGR8);
ENeptuneBayerLayout eLayout;
ntcGetBayerLayout(hCamHandle, &eLayout);

See Also
ntcSetBayerLayout, ntcGetBayerConvert, ntcSetBayerConvert

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 43

4.4.16 ntcSetBayerLayout

Description
Set the bayer layout for conversion.

Definition
ENeptuneError ntcSetBayerLayout(NeptuneCamHandle hCamHandle,
ENeptuneBayerLayout ePattern)

Parameters
[IN] hCamHandle : camera handle
[IN] ePattern : bayer pattern layout

Remark
User can change the bayer pattern layout used for conversion. If the layout is not matched with image
data, correct color is not expressed.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ntcSetPixelFormat(hCamHandle, Mono8);
ntcSetBayerLayout(hCamHandle, NEPTUNE_BAYER_GB_RG);

See Also
ntcGetBayerLayout, ntcGetBayerConvert, ntcSetBayerConvert

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 44

4.4.17 ntcGetBytePerPacket

Description
Get the packet size under Format7 mode of 1394 camera.

Definition
ENeptuneError ntcGetBytePerPacket(NeptuneCamHandle hCamHandle,
_uint32_t *pnBpp,
_uint32_t* pnMin=NULL, _uint32_t* pnMax=NULL)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnBpp : current byte per packet value
[OUT, Optional] pnMin : minimum byte per packet value supported
[OUT, Optional] pnMax : maximum byte per packet value supported

Remark
This API function is used for 1394 camera only and is user for variablze size pixel format mode
(Format7_XXX). The byte per packet is used to control frame rate under the variable size pixel format
mode (Format7_XXX) of 1394 camera.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\ Format7Control
ntcSetPixelFormat(hCamHandle, Format7_Mode0_Mono8);
_uint32_t nBpp, nBppMin, nBppMax;
ntcGetBytePerPacket(hCamHandle, &nBpp, &nBppMin, &nBppMax);

See Also
ntcSetBytePerPacket, ntcSetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 45

4.4.18 ntcSetBytePerPacket

Description
Set byte per packet to a 1394 camera.

Definition
ENeptuneError ntcSetBytePerPacket(NeptuneCamHandle hCamHandle, _uint32_t nBpp)

Parameters
[IN] hCamHandle : camera handle
[IN] nBpp : byte per packet value

Remark
This API function is used for 1394 camera only and is user for variablze size pixel format mode
(Format7_XXX). Use can adjust frame rate by controlling the byte per packet value uder variable size
pixel format mode.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\ Format7Control
ntcSetPixelFormat(hCamHandle, Format7_Mode0_Mono8);
ntcSetBytePerPacket(hCamHandle, 2500);

See Also
ntcGetBytePerPacket, ntcSetPixelFormat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 46

4.4.19 ntcGetPacketSize

Description
Get the size of one packet for a GigE camera.

Definition
ENeptuneError ntcSetPacketSize(NeptuneCamHandle hCamHandle,
_uint32_t* pnPacketSize,
_uint32_t* pnMin=NULL, _uint32_t* pnMax=NULL)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnPacketSize : current packet size
[OUT, Optional] pnMin : minimum packet size supported
[OUT, Optional] pnMax : maximum packet size supported

Remark
This function is used for GigE camera only and returns the size information of the packet for one
transmission.
The size of packet can be received in the system is dependent to the network card attached to the
system. If the camera stream is not received, then try to adjut the packet size with the
“ntcSetPacketSize” function.

Example
ntcSetPixelFormat(hCamHandle, Mono8);
_uint32_t nValue, nMin, nMax;
ntcGetPacketSize(hCamHandle, &nValue, &nMin, &nMax);

See Also
ntcSetPacketSize

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 47

4.4.20 ntcSetPacketSize

Description
Set the size of one packet for a GigE camera.

Definition
ENeptuneError ntcSetPacketSize(NeptuneCamHandle hCamHandle, _uint32_t nPacketSize)

Parameters
[IN] hCamHandle : camera handle
[IN] nPacketSize : packet size

Remark
This function is used for GigE camera only and user can adjust the size of the packet for one
transmission.
The size of packet can be received in the system is dependent to the network card attached to the
system. If the camera stream is not received, then try to adjut the packet size transmitted from a
camera. “1500” and “800” is used in general.

Example
ntcSetPixelFormat(hCamHandle, Mono8);
ntcSetPacketSize(hCamHandle, 1500);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 48

4.5 Acquire image


Uset can control camera to send image data when image setting has been finished and user should select the
way how image are sequenced out of the camera.
There are three methods for camera to sequence out images – single frame, multi frame, continuous.
In single frame mode, camera send just one frame image data and stop sending image until it receives control of
sending image. In multi frame mode, camera sends predefined number of images and stop sending image until it
receives control of sending image. In continuous mode, camera send images until it received stop control.
User can get image data with callback which is called whenever the API receives image data from a camera or
with grab function at any point.
For callback, the API calls the callback function with the original image data camera sends. So, user has to call
other API function in the callback to get the RGB image data. For grab, user can assign the image format
returned by the grab function – original data or RGB data.
User can save camera data to image with JPEG, TIFF or BMP format in callback function or after calling the grab
function. The NeptuneC API aso supports stream capture with H264 compressed or uncompressed format.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 49

4.5.1 ntcGetAcquisitionMode

Description
Get the camera’s data transfer method.

Definition
ENeptuneError ntcGetAcquisitionMode(NeptuneCamHandle hCamHandle,
ENeptuneAcquisitionMode* peMode,
_uint32_t* pnFrames)

Parameters
[IN] hCamHandle : camera handle
[OUT] peMode : data transfer method
[OUT] pnFrames : number of frames for multi-frame
(valid only when the peMode=NEPTUNE_ACQ_MULTIFRAME)

Remark
Camera can sequence out image in three ways – single-frame, multi-frame, continuous and user can
select one method with this API function. The transfer method is defined as “ENeptuneAcquisitionMode”
enumeration which is declared in the “NeptuneDef.h”.
The last parameter is valid only when the second parameter “peMode” is
“NEPTUNE_ACQ_MULTIFRAME” and it means the number of frames per one transfer.

enum ENeptuneAcquisitionMode {
NEPTUNE_ACQ_CONTINUOUS = 0, // continuous
NEPTUNE_ACQ_MULTIFRAME = 1, // multi frame
NEPTUNE_ACQ_SINGLEFRAME = 2, // single frame
};

Example
ENeptuneAcquisitionMode eMode;
_uint32_t nFrames;
ntcGetAcquisitionMode(hCamHandle, &eMode, &nFrames);

See Also
ntcSetAcquisitionMode, ntcGetAcquisition, ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 50

4.5.2 ntcSetAquisitionMode

Description
Set the way camera transfer image.

Definition
ENeptuneError ntcSetAcquisitionMode(NeptuneCamHandle hCamHandle,
ENeptuneAcquisitionMode eMode,
_uint32_t nFrames=2);

Parameters
[IN] hCamHandle : camera handle
[IN] eMode : transfer method
[IN, Optional] nFrames : number of frames
(valid only when eMode=NEPTUNE_ACQ_MULTIFRAME)

Remark
User can select the method camera transfer image data. In single-frame and multi-frame mode, user
has to control camera to send image agina when a camera finishes transfer. The NeptuneC API set
camera with continuous mode as default.

Example
ntcSetAcquisitionMode(hCamHandle, NEPTUNE_ACQ_SINGLEFRAME); // single frame
ntcSetAcquisitionMode(hCamHandle, NEPTUNE_ACQ_MULTIFRAME, 100); // multi frame
ntcSetAcquisitionMode(hCamHandle, NEPTUNE_ACQ_CONTINUOUS); // continuous

See Also
ntcGetAcquisitionMode, ntcGetAcquisition, ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 51

4.5.3 ntcOneShot

Description
Control camera to transfer single image.

Definition
ENeptuneError ntcOneShot(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
User has to set camera as a one-shot(single frame) mode(NEPTUNE_ACQ_SINGLEFRAME) with the
“ntcSetAcquisitionMode” function before calling this function.

Example
ntcSetAcquisitionMode(hCamHandle, NEPTUNE_ACQ_SINGLEFRAME);
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE);
ntcOneShot(hCamHandle);

See Also
ntcSetAcquisitonMode, ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 52

4.5.4 ntcMultiShot

Description
Control camera to transfer multiple images.

Definition
ENeptuneError ntcMultiShot(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
User has to set camera as a multi-shot(multi frame) mode(NEPTUNE_ACQ_MULTIFRAME) and number
of frames to transfer with the “ntcSetAcquisitionMode” function before calling this function.

Example
ntcSetAcquisitionMode(hCamHandle, NEPTUNE_ACQ_MULTIFRAME, 10);
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE);
ntcMultiShot(hCamHandle);

See Also
ntcSetAcquisitionMode, ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 53

4.5.5 ntcSetBufferCount

Description
Set the number of buffers of API.

Definition
ENeptuneError ntcSetBufferCount(NeptuneCamHandle hCamHandle, _uint32_t nCount)

Parameters
[IN] hCamHandle : camera handle
[IN] nCount : number of buffer

Remark
The NeptuneC API uses 10 frame buffers internally as default. User can change the number of buffer
with this API function. The number of buffer should be greater or queal to 3 and must be set before
cotrolling camera to send image data with “ntcSetAquisition”.

Example
ntcSetBufferCount (hCamHandle,5);

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 54

4.5.6 ntcGetBufferSize

Description
Get the size of an image frame data.

Definition
ENeptuneError ntcGetBufferSize(NeptuneCamHandle hCamHandle, _uint32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnSize : size of an image data

Remark
This API function returns the size of an image data in byte unit. User has to call this function after
setting the pixel format with “ntcSetPixelFormat” function. The returned size is used when calling the
“ntcSetUserBuffer” function.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
_uint32_t nSize;
ntcSetPixelFormat(hCamHandle, Mono8);
ntcGetBufferSize(hCamHandle, &nSize);

See Also
ntcSetPixelFormat, ntcSetUserBuffer

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 55

4.5.7 ntcSetUserBuffer

Description
Assign user allocated buffer to the NeptuneC API.

Definition
ENeptuneError ntcSetUserBuffer(NeptuneCamHandle hCamHandle,
_void_t* pBuffer,
_uint32_t nSize,
_uint32_t nCount)

Parameters
[IN] hCamHandle : camera handle
[IN] pBuffer: pointer of use allocated buffer
[IN] nSize : size of an image data
[IN] nCount : number of frames( > 1)

Remark
This API function is used to assign user allocated buffer to the NeptuneC API. User has to allocate
buffer with the size nSize*nCount and has to call this function before calling the “ntcSetAquisition”
function. User can know the size need for an image with the “ntcGetBufferSize” function. The assigned
user buffer is valid until user calls the “ntcSetAcquisiton” with “NEPTUNE_BOOL_FALSE”. User should
handle allocation and free for the buffer.

Example
_uint32_t nSize;
_int8_t* pBuffer = NULL;

ntcSetPixelFormat(hCamHandle, Mono8);
ntcGetBufferSize(hCamHandle, &nSize);
pBuffer = new _int8_t[nSize];
ntcSetUserBuffer(hCamHandle, pBuffer, nSize, 5);
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE);

See Also
ntcGetBufferSize, ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 56

4.5.8 ntcSetEffect

Description
Set the image effect.

Definition
ENeptuneError ntcSetEffect(NeptuneCamHandle hCamHandle, _int32_t nEffect)

Parameters
[IN] hCamHandle : camera handle
[IN] nEffect : image effect

Remark
The effect is applied only in display, RGB data, image capture and stream capture and is not applied
the raw data passed to the callback or grab function. The API supports three effects – flip, mirror,
negative and effects can be applied with combination also. The Effect is defined as below.

enum ENeptuneEffect {
NEPTUNE_EFFECT_NONE = 0,
NEPTUNE_EFFECT_FLIP = 0x01, // flip image
NEPTUNE_EFFECT_MIRROR = 0x02, // mirror
NEPTUNE_EFFECT_NEGATIVE = 0x04 // negative
};

Example
_int32_t effect = NEPTUNE_EFFECT_FLIP | NEPTUNE_EFFECT_MIRROR | NEPTUNE_EFFECT_NEGATIVE;
ntcSetEffect(hCamHandle, effect);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 57

4.5.9 ntcGrab

Description
Capture a single frame data.

Definition
ENeptuneError ntcGrab(NeptuneCamHandle hCamHandle, PNEPTUNE_IMAGE pImage,
ENeptuneGrabFormat eGrabFormat, _uint32_t nTimeout=1000)

Parameters
[IN] hCamHandle : camera handle
[OUT] pImage : image data
[IN] eGrabFormat : grab format
[IN] nTimeout : wait time (in mili-second unit)

Remark
User can get a single image data at any time with this API function and user has to allocate memory
for image data with the size needed. This function never returns until image data is received from a
camera and returns error after “nTimeout” delay if it didn’t receive any image data.
User can select the data format to capture – raw and RGB with the third parameter.
The “NEPTUNE_IMAGE” structure and “ENeptuneGrabFormat” is defined as below.

struct NEPTUNE_IMAGE {
_uint32_t uiWidth; // image data width
_uint32_t uiHeight; // image data height
_uint32_t uiBitDepth; // data bits per pixel

_uchar_t* pData; // image buffer


_uint32_t uiSize; // buffer length
_uint32_t uiIndex; // buffer index

_uint64_t uiTimestamp; // data timestamp

_uchar_t bFrameValid; // frame state : 1(Valid), 0(Invalid)


};
typedef NEPTUNE_IMAGE* PNEPTUNE_IMAGE;

enum ENeptuneGrabFormat
{
NEPTUNE_GRAB_RAW = 0,
NEPTUNE_GRAB_RGB = 1
};

Example

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 58

ref. NeptuneC Library\Samples\C++\0.SingleAcquisition


NEPTUNE_IMAGE GrabImage;
NEPTUNE_IMAGE_SIZE ImageSize;
static int nGrabCount = 0;
_uint32_t nBits = 0;
int nFrameSize;
ENeptuneGrabFormat eGrabFormat;
ENeptuneError tError;

ntcGetImageSize(m_CamHandle, &ImageSize);
ntcGetBitsPerPixel(m_CamHandle, &nBits);
if ( m_cboGrabFormat.GetCurSel() == 0 ) // raw data grab
{
eGrabFormat = NEPTUNE_GRAB_RAW;
nFrameSize = (int)(ImageSize.nSizeX*ImageSize.nSizeY*(float)nBits/8);
}
else // RGB data grab
{
eGrabFormat = NEPTUNE_GRAB_RGB;
nFrameSize = ImageSize.nSizeX*ImageSize.nSizeY*3;
}
GrabImage.pData = new BYTE[nFrameSize];
memset(GrabImage.pData, 0, nFrameSize);

tError = ntcGrab(m_CamHandle, &GrabImage, eGrabFormat);


if ( tError == NEPTUNE_ERR_Success )
{
sprintf_s(str, sizeof(str), "grab_data_%04d.raw", nGrabCount++);
FILE *fp = fopen(str, "wb");
fwrite(GrabImage.pData, GrabImage.uiSize, 1, fp);
fclose(fp);
}
else if ( tError == NEPTUNE_ERR_TimeOut )
AfxMessageBox("Data Grab TimeOut!");
else
AfxMessageBox("Data Grab Error!");

delete GrabImage.pData;
GrabImage.pData = NULL;

See Also
ntcGetImageSize, ntcGetBitsPerPixel, ntcSetFrameCallback

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 59

4.5.10 ntcSetFrameCallback

Description
Register frame callback function.

Definition
ENeptuneError ntcSetFrameCallback(NeptuneCamHandle hCamHandle,
NeptuneCFrameCallback callback, void* pContext=NULL)

Parameters
[IN] hCamHandle : camera handle
[IN] callback : frame callback function
[IN] pContext : user parameter passed to the callback function

Remark
Once registered, the API calls frame callback function whenever new image data is received from a
camera. The API allocates memory for image data internally and passes it as parameter of callback
function. After the callback is finished, the memory is freed by the API. Callback function is defined as
below and the “NEPTUNE_IMAGE” structure is same as explained in the ntcGrab section.

// image received callback


typedef void (*NeptuneCFrameCallback)(PNEPTUNE_IMAGE pImage, void* pContext);

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
void FrameCallback(PNEPTUNE_IMAGE pImage, void *pContext)
{
_char_t strFileName[_MAX_PATH];
sprintf_s(strFileName, _MAX_PATH, "%02d_%02d(%02d_%02d_%02d_%03d).raw",
sysTime.wMonth, sysTime.wDay, sysTime.wHour,
sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);

float length;
if( pImage->uiBitDepth == 8 ) length = 1.0;
else if( pImage->uiBitDepth == 12 ) length = 2.0;
else if( pImage->uiBitDepth == 16 ) length = 2.0;
else if( pImage->uiBitDepth == 24 ) length = 3.0;

FILE *fp = fopen(strFileName, "wb");

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 60

fwrite(pImage->pData, (unsigned int) ((float) length * pImage->uiWidth * pImage->uiHeight),


1, fp);
fclose(fp);
}

// register callback function at main


if ( ntcSetFrameCallback(m_CamHandle, FrameCallback, this) != NEPTUNE_ERR_Success )
{
AfxMessageBox("Error while setting callback!");
return;
}

See Also
ntcGrab

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 61

4.5.11 ntcSetFrameDropCallback

Description
Register frame drop callback function.

Definition
ENeptuneError ntcSetFrameDropCallback(NeptuneCamHandle hCamHandle,
NeptuneCFrameDropCallback callback,
void* pContext=NULL)

Parameters
[IN] hCamHandle : camera handle
[IN] callback : frame drop callback function
[IN] pContext : user parameter passed to the callback function

Remark
The API calls registered frame drop callback function whenever it finds corrupted image data. So, user
can check the loss of data in transmission layer. Callback function is defined as below.

// frame drop callback


typedef void (*NeptuneCFrameDropCallback)(void* pContext);

Example
void FrameDropCallback(void *pContext)
{
// do something
}

// register callback function at main


if ( ntcSetFrameDropCallback(m_CamHandle, FrameDropCallback, this) != NEPTUNE_ERR_Success )
{
AfxMessageBox("Error while setting callback!");
return;
}

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 62

4.5.12 ntcSetDisplay

Description
Set display window to show image.

Definition
ENeptuneError ntcSetDisplay(NeptuneCamHandle hCamHandle, HWND hWnd)

Parameters
[IN] hCamHandle : camera handle
[IN] hWnd : window handle

Remark
The NeptunC API doesn’t have internal display and it displays only when user assigns display window
handle with this function. The display image is resized to fit in the window. This function should be
called before calling the “ntcSetAquisition”.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
CWnd* pWnd = (CWnd*)GetDlgItem(IDC_PICTURE);
ntcSetDisplay(hCamHandle, pWnd->m_hWnd);

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 63

4.5.13 ntcSetAcquisition

Description
Control camera to play or stop.

Definition
ENeptuneError ntcSetAcquisition(NeptuneCamHandle hCamHandle, ENeptuneBoolean eSate)

Parameters
[IN] hCamHandle : camera handle
[IN] eState : play/stop control

Remark
This function is used to control camera to transfer image data or not. The pixel format, frame rate an
display window if needed should be set in advance before calling this fuinction.

Example
ref. NeptuneC Library\Samples\C++\0.SingleAcquisition
// play
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE);

// stop
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_FALSE);

See Also
ntcGetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 64

4.5.14 ntcGetAcquisition

Description
Get the play/stop state of camera.

Definition
ENeptuneError ntcGetAcquisition(NeptuneCamHandle hCamHandle,
ENeptuneBoolean* peState)

Parameters
[IN] hCamHandle : camera handle
[OUT] peState : play/stop state

Remark
User can know the camera’s play status with this function.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
ENeptuneBoolean eState;
ntcGetAcquisition(hCamHandle, &eState);

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 65

4.5.15 ntcSetMulticastAddress

Description
Set the multicast address of GigE camera.

Definition
ENeptuneError ntcSetMulticastAddress(NeptuneCamHandle hCamHandle,
_char_t* pstrAddress)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrAddress: multicast address

Remark
This API function is used to set the multicast address for GigE camera when a camera sends stream
with multicast. The multicast address should be set before calling the “ntcSetAcquisition” and should
be in range 239.0.0.0 ~ 239.255.255.255.

Example
ntcSetMulticastAddress(hCamHandle, “239.0.0.0”);
ntcSetAcquisition(;

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 66

4.5.16 ntcGetReceiveFrameRate

Description
Get the real frame rate received.

Definition
ENeptuneError ntcGetReceiveFrameRate(NeptuneCamHandle hCamHandle,
_float32_t* pfRate)

Parameters
[IN] hCamHandle : camera handle
[OUT] pfRate : data receive rate

Remark
This API function returns calculated real receive frame rate.

Example
ref. NeptuneC Library\Samples\C++\GUI\0.App
_float32_t fRate;
ntcGetReceiveFrameRate(hCamHandle, &fRate);

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 67

4.5.17 ntcGetRGBData

Description
Get the RGB image data.

Definition
ENeptuneError ntcGetRGBData(NeptuneCamHandle hCamHandle,
_uchar_t* pBuffer, _uint32_t nSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] pBuffer : data buffer
[IN] nSize : size of buffer

Remark
If callback is used, user can get the RGB converted image data by calling this function in the frame
callback function. The RGB data is composed in “B-G-R” order and user should allocate the memory for
image data.

Example
ref. NeptuneC Library\Samples\C++\GUI\4.ImageCapture
void FrameCallback(PNEPTUNE_IMAGE pImage, void *pContext)
{
_uint32_t nSize = pImage->uiWidth*pImage->uiHeight*3;
_uchar_t *pBuf;
pBuf = new _uchar_t[nSize]
if ( ntcGetRGBData(hCamHandle, pBuf, nSize) == NEPTUNE_ERR_Success )
; // do something

delete pBuf;
}

See Also
ntcSetCallback

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 68

4.5.18 ntcSaveImage

Description
Save image data to an image.

Definition
ENeptuneError ntcSaveImage(NeptuneCamHandle hCamHandle,
_char_t* strFileName, _uint32_t nQuality=80)

Parameters
[IN] hCamHandle : camera handle
[IN] strFileName : save file name
[IN, Optional] nQuality : JPEG image quality

Remark
User can capture frame data to an image with this function as JPEG, TIFF or BMP format. User should
use the extension of file name “.jpg”, “.tif” or “.bmp” because the API identifies saving format with the
file name extension. User can set the quality of JPEG image with third parameter.

Example
ref. NeptuneC Library\Samples\C++\GUI\4.ImageCapture
sprintf_s(strFileName, _MAX_PATH, "%02d_%02d(%02d_%02d_%02d_%03d).bmp",
sysTime.wMonth, sysTime.wDay, sysTime.wHour,
sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds);
ntcSaveImage(hCamHandle, strFileName);

See Also
ntcSetAcquisition

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 69

4.5.19 ntcStartStreamCapture

Description
Capture frame data to stream.

Definition
ENeptuneError ntcStartStreamCapture(NeptuneCamHandle hCamHandle,
_char_t* strFileName, _bool8_t bCompress,
_uint32_t nBitrate=1000)

Parameters
[IN] hCamHandle : camera handle
[IN] strFileName : stream file name
[IN] bCompress : compression flag
[IN, Optional] nBitrate : bitrate of compression

Remark
User can save frame data to AVI stream in compressed with H264 or uncompressed format with this
function.

Example
ref. NeptuneC Library\Samples\C++\GUI\4.ImageCapture
// compressed AVI
ntcStartStreamCapture(hCamHandle, “capture.avi”, NEPTUNE_BOOL_TRUE);

// uncompressed AVI
ntcStartStreamCapture(hCamHandle, “capture.avi”, NEPTUNE_BOOL_FALSE);

See Also
ntcStopStreamCapture

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 70

4.5.20 ntcStopStreamCapture

Description
Stop stream capture.

Definition
ENeptuneError ntcStopStreamCapture(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
This API function stops AVI stream capture.

Example
ref. NeptuneC Library\Samples\C++\GUI\4.ImageCapture
ntcStopStreamCapture(hCamHandle);

See Also
ntcStartStreamCapture

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 71

4.5.21 ntcSetRecvDroppedFrame

Description
Controls receiving of broken image frame.

Definition
ENeptuneError ntcSetRecvDroppedFrame(NeptuneCamHandle hCamHandle,
ENeptuneBoolean eRecvDroppedFrame)

Parameters
[IN] hCamHandle : camera handle
[IN] eRecvDroppedFrame : control flag

Remark
This control flag with API function should be set before calling the “ntcSetAcquisition” function.

Example
if ( want to receive )
ntcSetRecvDroppedFrame(hCamHandle, NEPTUNE_BOOL_TRUE); // receive broken frame
else
ntcSetRecvDroppedFrame(hCamHandle, NEPTUNE_BOOL_FALSE); // don’t receive broken frame
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE); // play camera

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 72

4.5.22 ntcSetRotation

Description
Set rotation angle to an image.

Definition
ENeptuneError ntcSetRotation(NeptuneCamHandle hCamHandle,
ENeptuneRotationAngle eRotationAngle)

Parameters
[IN] hCamHandle : camera handle
[IN] eRecvDroppedFrame : rotation angle

Remark

enum ENeptuneRotationAngle
{
NEPTUNE_ROTATE_0 = 0, // 0 degree
NEPTUNE_ROTATE_90 = 1, // 90 degree
NEPTUNE_ROTATE_180 = 2, // 180 degree
NEPTUNE_ROTATE_270 = 3 // 270 degree
};

The rotation in display is applied only when the DirectX device is usable. If the DirectX device is not
successful, then the display rotation is not used. The API suppored rotation angle is 0, 90, 180 and 270
degree and it rotates image to clock wise direction if enabled. The “ENeptuneRotationAngle”
enumeration value is deinfed in the “NeptuneDef.h”.
The Rotation is applied all images including RGB data, save image format(BMP, JPG, TIF) and AVI
except raw data.

Example
ntcSetAcquisition(hCamHandle, NEPTUNE_BOOL_TRUE); // receive broken frame
ntcSetRotation(hCamHandle, NEPTUNE_ROTATE_90); // rotate 90 degree to clockwise direction

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 73

4.6 Feature Control


API functions in this section are used to control features of camera.
Feature is dependent to camera and a feature may not supported by some camera model. Please refer to the
camera manual for details about features camera model supports.
The NeptuneC API provides functions for getting information about feature supported by a camera and functions
for setting/getting feature values. The API supports following features defined with “ENeptuneFeature”
enumeration.

enum ENeptuneFeature {
NEPTUNE_FEATURE_GAMMA = 0, // AnalogControls, Gamma
NEPTUNE_FEATURE_GAIN = 1, // AnalogControls, Gain or GainRaw
NEPTUNE_FEATURE_RGAIN = 2, // AnalogControls, Gain or GainRaw
NEPTUNE_FEATURE_GGAIN = 3, // AnalogControls, Gain or GainRaw
NEPTUNE_FEATURE_BGAIN = 4, // AnalogControls, Gain or GainRaw
NEPTUNE_FEATURE_BLACKLEVEL = 5, // AnalogControls, BlackLevel or BlackLevelRaw
NEPTUNE_FEATURE_SHARPNESS = 6, // AnalogControls, Sharpness or SharpnessRaw
NEPTUNE_FEATURE_SATURATION = 7, // AnalogControls, Saturation or SaturationRaw
NEPTUNE_FEATURE_AUTOEXPOSURE = 8, // AcquisitionControl, AutoExposure
NEPTUNE_FEATURE_SHUTTER = 9, // AcquisitionControl, ExposureTime
NEPTUNE_FEATURE_HUE = 10, // AnalogControls, Hue or HueRaw
NEPTUNE_FEATURE_PAN = 11, // AcquisitionControl, PanCtrl
NEPTUNE_FEATURE_TILT = 12, // AcquisitionControl, TiltCtrl
NEPTUNE_FEATURE_OPTFILTER = 13, // AnalogControls, OpticalFilter
NEPTUNE_FEATURE_AUTOSHUTTER_MIN = 14, // CustomControl, AutoShutterSpeedMin
NEPTUNE_FEATURE_AUTOSHUTTER_MAX = 15, // CustomControl, AutoShutterSpeedMin
NEPTUNE_FEATURE_AUTOGAIN_MIN = 16, // CustomControl, AutoGainMin
NEPTUNE_FEATURE_AUTOGAIN_MAX = 17, // CustomControl, AutoGainMax
NEPTUNE_FEATURE_TRIGNOISEFILTER = 18, // CustomControl, TriggerNoiseFilter
NEPTUNE_FEATURE_BRIGHTLEVELIRIS = 19, // CustomControl, BrightLevelForIRIS
NEPTUNE_FEATURE_SNOWNOISEREMOVE = 20, // CustomControl, SnowNosieRemoveControl
NEPTUNE_FEATURE_WATCHDOG = 21, // CustomControl, WDGControl
NEPTUNE_FEATURE_WHITEBALANCE = 22, // AnalogControls, BalanceWhiteAuto
NEPTUNE_FEATURE_CONTRAST = 23, // CustomControl, Contrast
NEPTUNE_FEATURE_LCD_BLUE_GAIN = 24, // CustomControl, LCD_BLUE_GAIN
NEPTUNE_FEATURE_LCD_RED_GAIN = 25, // CustomControl, LCD_RED_GAIN
};

Information of each feature is passed with the “NEPTUNE_FEATURE” structure as defined below.

struct NEPTUNE_FEATURE {
ENeptuneBoolean bSupport;
ENeptuneBoolean bOnOff; // on/off state, on/off control(SnowNoiseRemove only)
_uint8_t SupportAutoModes; // bit flag for support(bit0:Off, bit1:Once, bit2:Continuous)
ENeptuneAutoMode AutoMode; // current Auto mode, valid only when "SupportAutoModes != 0"
_int32_t Min; // minimum value
_int32_t Max; // maximum value
_int32_t Inc; // increment step
_int32_t Value; // current value
ENeptuneNodeAccessMode ValueAccessMode; // access state of the value
};
typedef NEPTUNE_FEATURE* PNEPTUNE_FEATURE;

In this structure, the “bSupport” element indicates whether the feature is supported or not and the “bOnOff”

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 74

feature means the on and off state of feature. The “SupportAutoMode” element means whether auto mode is
supported or not with bit flag as below.

Element Bit Meaning


0 Support Manual mode
SupportAutoModes 1 Support Once(one-push) mode
2 Auto(Continuous) mode 지원

The “AutoMode”, “Min”, “Max”, “Inc” and “Value” elements represent current auto mode, value and range. User
uses “Value” and “AutoMode” to set a feature.
The “NEPTUNE_FEATURE_RGAIN”, “NEPTUNE_FEATURE_GGAIN”, “NEPTUNE_FEATURE_BGAIN” is interlocked
with the “NEPTUNE_FEATURE_WHITBALANCE”. As those color gains are controllable only if the
“NEPTUNE_FEATURE_WHITEBALANCE” feature in manual mode, use should check the “WhiteBalance” feature
when controls color gains. For “NEPTUNE_FEATURE_WHITEBALANCE”, only the “AutoMode” is used to set the
value.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 75

4.6.1 ntcGetFeature

Description
Get the support and value of given feature.

Definition
ENeptuneError ntcGetFeature(NeptuneCamHandle hCamHandle, ENeptuneFeature eFeature,
PNEPTUNE_FEATURE pInfo)

Parameters
[IN] hCamHandle : camera handle
[IN] eFeature : feature ID
[OUT] pInfo : feature information

Remark
User can know the support, value and range with this API function.

Example
ref. NeptuneC Library\Samples\C++\GUI\6.Feature
NEPTUNE_FEATURE FeatureInfo;

if ( ntcGetFeature(hCamHandle, NEPTUNE_FEATURE_GAIN, &FeatureInfo) ==


NEPTUNE_ERR_Success )
{
// support
if ( FeatureInfo.bSupport )
{
// range information
int nMin = FeatureInfo.Min;
int nMax = FeatureInfo.Max;

// current value
int nValue = FeatureInfo.Value;

// is controllable
if ( FeatureInfo.ValueAccessMode == NEPTUNE_NODE_ACCESSMODE_RO )
{
// can not control
}
else

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 76

{
// controllable
}

// auto mode support


if ( FeatureInfo.SupportAutoModes != 0 )
{
if ( FeatureInfo.SupportAudoModes & 0x1 )
// support off(manual) mode
if ( FeatureInfo.SupportAutoModes & 0x2 )
// support once(one-push) mode
if ( FeatureInfo.SupportAutoModes & 0x4 )
// support continuous(auto) mode
} // support
}

See Also
ntcSetFeature

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 77

4.6.2 ntcSetFeature

Description
Set feature value and auto state.

Definition
ENeptuneError ntcSetFeature(NeptuneCamHandle hCamHandle, ENeptuneFeature eFeature,
NEPTUNE_FEATURE Info)

Parameters
[IN] hCamHandle : camera handle
[IN] Info : feature value and auto state

Remark
This API function is used to set the feature value and auto state. The color gains - “RGain”, “Gain”,
“BGain”, are not support auto and are not controllable if the “WhiteBalance” feature is auto state.
If auto state changed from auto to manual or from manual to auto, the value is not applied and only
the auto state is applied.

Example
ref. NeptuneC Library\Samples\C++\GUI\6.Feature
NEPTUNE_FEATURE FeatureInfo;
FeatureInfo.Value = 50;
ntcSetFeature(hCamHandle, NEPTUNE_FEATURE_GAIN, FeatureInfo);

// set to auto mode


FeatureInfo.AutoMode = NEPTUNE_AUTO_CONTINOUS;
ntcSetFeature(hCamHandle, NEPTUNE_FEATURE_GAIN, FeatureInfo);

See Also
ntcGetFeature

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 78

4.6.3 ntcSetShutterString

Description
Set shutter with string.

Definition
ENeptuneError ntcSetShutterString(NeptuneCamHandle hCamHandle, _char_t* pstrShutter)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrShutter : shutter value string

Remark
This API function is used to set the shutter with real time value string. User can use this function or
“ntcSetFeature” to control the shutter value. The “pstrShutter” parameter should include time unit like
as “500us”, “1.2ms” or “5s” and both lower and upper case letters are accepted.

Example
ntcSetShutterString(hCamHandle, “500ms”);

See Also
ntcSetFeature

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 79

4.6.4 ntcGetAutoAreaControl

Description
Get region information used for auto functions – auto exposure, auto white balance and auto focus.

Definition
ENeptuneError ntcGetAutoAreaControl(NeptuneCamHandle hCamHandle,
ENeptuneAutoAreaSelect eSelect,
PNEPTUNE_AUTOAREA pArea)

Parameters
[IN] hCamHandle : camera handle
[IN] eSelect: feature name for getting area control information
[OUT] pArea : area control information

Remark

enum ENeptuneAutoAreaSelect
{
NEPTUNE_AUTOAREA_SELECT_AE = 0, // for AutoExposure
NEPTUNE_AUTOAREA_SELECT_AWB = 1, // for AutoWhiteBalance
NEPTUNE_AUTOAREA_SELECT_AF =2 // for AutoFocus
};

enum ENeptuneAutoAreaSize
{
NEPTUNE_AUTOAREA_SIZE_SELECTED = 0, // selected size
NEPTUNE_AUTOAREA_SIZE_FULL = 1, // full image size
};

struct NEPTUNE_AUTOAREA {
ENeptuneBoolean OnOff;
ENeptuneAutoAreaSize SizeControl;
NEPTUNE_IMAGE_SIZE AreaSize;
};
typedef NEPTUNE_AUTOAREA* PNEPTUNE_AUTOAREA;

This API function is used to get region information used for the auto functions – auto exposure, auto
white balance and auto focus. User can select one of auto function with the “ENeptuneAutoAreaSelect”
enumeration. The auto area information is passed with the “NEPTUNE_AUTOAREA” structure includes
“ENeptuneAutoAreaSize” enumeration and “NEPTUNE_IMAGE_SIZE” structure. The
“ENeptuneAutoAreaSize” enumeration value means that the auto algorithm is using whole image or

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 80

selected region.
Please refer to the camera manual for details about the auto area control.

Example
NEPTUNE_AUTOAREA AutoArea;
// Auto Exposure Area
ntcGetAutoAreaControl(hCamHandle,NEPTUNE_AUTOAREA_SELECT_AE, &AutoArea);
// Auto White Balance Area
ntcGetAutoAreaControl(hCamHandle,NEPTUNE_AUTOAREA_SELECT_AWB, &AutoArea);
// Auto Focus Area
ntcGetAutoAreaControl(hCamHandle,NEPTUNE_AUTOAREA_SELECT_AF, &AutoArea);

See Also
ntcSetAutoAreaControl

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 81

4.6.5 ntcSetAutoAreaControl

Description
Set region information used for auto function – auto exposure, auto white balance and auto focus.

Definition
ENeptuneError ntcSetAutoAreaControl(NeptuneCamHandle hCamHandle,
ENeptuneAutoAreaSelect eSelect,
NEPTUNE_AUTOAREA Area)

Parameters
[IN] hCamHandle : camera handle
[IN] eSelect: feature name for getting area control information
[IN] Area : area control information

Remark

enum ENeptuneAutoAreaSelect
{
NEPTUNE_AUTOAREA_SELECT_AE = 0, // for AutoExposure
NEPTUNE_AUTOAREA_SELECT_AWB = 1, // for AutoWhiteBalance
NEPTUNE_AUTOAREA_SELECT_AF =2 // for AutoFocus
};

enum ENeptuneAutoAreaSize
{
NEPTUNE_AUTOAREA_SIZE_SELECTED = 0, // selected size
NEPTUNE_AUTOAREA_SIZE_FULL = 1, // full image size
};

struct NEPTUNE_AUTOAREA {
ENeptuneBoolean OnOff;
ENeptuneAutoAreaSize SizeControl;
NEPTUNE_IMAGE_SIZE AreaSize;
};
typedef NEPTUNE_AUTOAREA* PNEPTUNE_AUTOAREA;

This API function is used to set specific region in an image used for the auto functions – auto exposure,
auto white balance and auto focus. User can select one of auto function with the
“ENeptuneAutoAreaSelect” enumeration. The auto area information is passed with the
“NEPTUNE_AUTOAREA” structure includes “ENeptuneAutoAreaSize” enumeration and
“NEPTUNE_IMAGE_SIZE” structure. The “ENeptuneAutoAreaSize” enumeration value means that the

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 82

auto algorithm is using whole image or selected region.


Please refer to the camera manual for details about the auto area control.

Example
NEPTUNE_AUTOAREA Area;
Area.OnOff = NEPTUNE_BOOL_TRUE;
Area.SizeControl = NEPTUNE_AUTOAREA_SIZE_SELECTED;
Area.AreaSize.nStartX = 100;
Area.AreaSize.nStartY = 100;
Area.AreaSize.nSizeX = 500;
Area.AreaSize.nSizeY = 400;
ntcSetAutoAreaControl(hCamHandle, NEPTUNE_AUTOAREA_SELECT_AE, Area);

See Also
ntcGetAutoAreaControl

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 83

4.6.6 ntcSetAFControl

Description
Set Auto Focus operation mode.

Definition
ENeptuneError ntcSetAFControl(NeptuneCamHandle hCamHandle,
ENeptuneAFMode eControlMode)

Parameters
[IN] hCamHandle : camera handle
[IN] eControlMode: Auto Focus operation mode

Remark
This API function is used to control the Auto Focus to one-push auto and manual operation mode. User
can control the Auto Focus with the “ENeptuneAFMode” enumeration which is defined as below.
Please refer to the camera manual for details about the Auto Focus.

enum ENeptuneAFMode
{
NEPTUNE_AF_ORIGIN = 0, // set focus to origin point
NEPTUNE_AF_ONEPUSH = 1, // one-push auto focus
NEPTUNE_AF_STEP_FORWARD = 2, // move one step forward
NEPTUNE_AF_STEP_BACKWARD = 3 // move one step backward
};

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\AFControl
ntcSetAFcontrol(hCamHandle, NEPTUNE_AF_ONEPUSH);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 84

4.6.7 ntcSaveCameraParameter

Description
Save camera parameter to a file.

Definition
ENeptuneError ntcSaveCameraParameter(NeptuneCamHandle hCamHandle,
_char_t* pstrFileName)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrFileName: file name to save camera parameter

Remark
This API function is used to save camera parameters to a file. All basic information including pixel
format, frame rate and feature values are saved to a file as below.

; Camera parameter file

[Camera Info] ; camera information


SerialNumber=436FFFFF ; serial number
PixelFormat=2 ; pixel format
FrameRate=4 ; frame rate for 1394 camera
FrameRateValue=-1 ; frame rate for GigE and USB3 camera

[ROI / Byte per packet Info] ; image information


Width=640 ; width size
Height=480 ; height size
OffsetX=0 ; start point X
OffsetY=0 ; start point Y
BytePerPacket=4092 ; byte per packet for 1394 camera in case

[Feature Info] ; feature information


Gamma=10 ; gamma
Gain=300 ; gain
GainAuto=2 ; gain auto state
RGain=284 ; red gain
GGain=-1 ; green gain
BGain=319 ; blue gain
WhiteBalance=2 ; white balance
BlackLevel=330 ; black level
Sharpness=550 ; sharpness
Saturation=128 ; saturation
AutoExposure=50 ; auto exposure
Shutter=1270 ; shutter
ShutterAuto=0 ; shutter auto state
Hue=128 ; hue
AutoShutterMin=150 ; auto shutter minimum value
AutoShutterMax=1270 ; auto shutter maximum value
AutoGainMin=0 ; auto gain minimum value
AutoGainMax=300 ; auto gain maximum value

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 85

SnowNoiseRemoveOnOff=0 ; snow noise removal on/off flag


SnowNoiseRemove=187 ; snow noise removal threshold
WatchDogOnOff=0 ; watchdog on/off flag
WatchDog=32 ; watchdog time value

[Trigger Info]
TriggerOnOff=0 ; trigger on/off flag
TriggerMode=15 ; trigger mode
TriggerPolarity=1 ; trigger signal polarity
TriggerSource=0 ; trigger source
TriggerParameter=1 ; trigger parameter
TriggerDelay=1 ; trigger delay value

[Strobe Info]
StroberOnOff=0 ; strobe on/off flag
StrobeMode=1 ; strobe mode
StrobePolarity=3 ; strobe signal polarity
StrobeDelay=0 ; strobe delay value
StrobeDuration=2000 ; strobe duration value

[TransPort Layer Info]


StreamPacketSize=-1 ; packet size for GigE camera

Example
ntcSaveCameraParameter(hCamHandle, “camera_param.txt”);

See Also
ntcLoadCameraParameter

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 86

4.6.8 ntcLoadCameraParameter

Description
Load camera parameter from a file and write to a camera.

Definition
ENeptuneError ntcLoadCameraParameter(NeptuneCamHandle hCamHandle,
_char_t* pstrFileName)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrFileName: file name to load camera parameter

Remark
This API function is used to load camera parameters from a file and write to a camera. The input file
should be on that is create with the “ntcSaveCameraParameter” function.

Example
ntcLoadCameraParameter(hCamHandle, “camera_param.txt”);

See Also
ntcSaveCameraParameter

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 87

4.6.9 ntcSetNTSCPALSelector

Description
Set video mode of a USB3 camera. (322UC)

Definition
ENeptuneError ntcSetNTSCPALSelector(NeptuneCamHandle hCamHandle,
ENeptuneVideoMode eVideoMode)

Parameters
[IN] hCamHandle : camera handle
[IN] eVideoMode : NTSC or PAL

Remark
In case of NTSC mode, frame rate of camera is set to 30 or 60. In case of PAL mode, frame rate of
camera is set to 25 or 50. ENeptuneVideMode is defined in "NeptuneDef.h" as follows:

enum ENeptuneVideoMode
{
NEPTUNE_VIDEOMODE_NTSC = 0,
NEPTUNE_VIDEOMODE_PAL = 1,
};

Example
ntcSetNTSCPALSelector(hCamHandle, NEPTUNE_VIDEOMODE_NTSC);

See Also
ntcGetNTSCPALSelector

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 88

4.6.10 ntcGetNTSCPALSelector

Description
Get video mode of a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetNTSCPALSelector(NeptuneCamHandle hCamHandle,
ENeptuneVideoMode* peVideoMode)

Parameters
[IN] hCamHandle : camera handle
[OUT] peVideoMode : NTSC or PAL

Remark

Example
ENeptuneVideoMode eMode;
ntcGetNTSCPALSelector(hCamHandle, &eMode);

See Also
ntcSetNTSCPALSelector

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 89

4.6.11 ntcSetAcquisitionFrameRateSel

Description
Set acquisition fps of a USB3 camera. (322UC)

Definition
ENeptuneError ntcSetAcquisitionFrameRateSel(NeptuneCamHandle hCamHandle,
ENeptuneAcqFPS eFPS)

Parameters
[IN] hCamHandle : camera handle
[IN] eFPS : FPS_30or25 or FPS_60or50

Remark
It is only valid if the trigger mode is turned off. ENeptuneAcqFPS is defined in "NeptuneDef.h" as follows:

enum ENeptuneAcqFPS
{
NEPTUNE_FPS_30or25 = 0,
NEPTUNE_FPS_60or50 = 1,
};

Example
ntcSetAcquisitionFrameRateSel(hCamHandle, NEPTUNE_FPS_30or25);

See Also
ntcGetAcquisitionFrameRateSel, ntcGetAcquisitionFrameRateList

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 90

4.6.12 ntcGetAcquisitionFrameRateSel

Description
Get acquisition fps from a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetAcquisitionFrameRateSel(NeptuneCamHandle hCamHandle,
ENeptuneAcqFPS* peFPS)

Parameters
[IN] hCamHandle : camera handle
[OUT] peFPS : FPS_30or25 or FPS_60or50

Remark

Example
ENeptuneAcqFPS eFPS;
ntcGetAcquisitionFrameRateSel(hCamHandle, &eFPS);

See Also
ntcSetAcquisitionFrameRateSel, ntcGetAcquisitionFrameRateList

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 91

4.6.13 ntcGetAcquisitionFrameRateList

Description
Get acquisition fps list from a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetAcquisitionFrameRateList(NeptuneCamHandle hCamHandle,
ENeptuneAcqFPS* peList, _uint32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] peList : List of supported frame rate
[IN/OUT] pnSize : Count of peList

Remark
This API function should be called twice. When count of pnSize is returned, the user can get a list of
frame rate after the array of peList is allocated as pnSize.

Example
ENeptuneAcqFPS* eFPSArr;
_uint32_t nSize = 0;
if( ntcGetAcquisitionFrameRateList(hCamHandle, eFPSArr, &nSize) == NEPTUNE_ERR_Success )
{
if( nSize > 0 )
ntcGetAcquisitionFrameRateList(hCamHandle, eFPSArr, &nSize);
}

See Also
ntcSetAcquisitionFrameRateSel, ntcGetAcquisitionFrameRateSel

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 92

4.6.14 ntcSetResolutionSelector

Description
Set resolution of a USB3 camera. (322UC)

Definition
ENeptuneError ntcSetResolutionSelector(NeptuneCamHandle hCamHandle,
ENeptuneResolution eResolution)

Parameters
[IN] hCamHandle : camera handle
[IN] eResolution : 1920x1080 or 1280x720

Remark
You may select the resolution of the image by using this API function (1080p, 720p).
ENeptuneResolution is defined in "NeptuneDef.h" as follows:

enum ENeptuneResolution
{
NEPTUNE_RESOLUTION_1280x720 = 0,
NEPTUNE_RESOLUTION_1920x1080 = 1,
};

Example
ntcSetResolutionSelector(hCamHandle, NEPTUNE_RESOLUTION_1920x1080);

See Also
ntcGetResolutionSelector, ntcGetResolutionList

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 93

4.6.15 ntcGetResolutionSelector

Description
Get resolution from a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetResolutionSelector(NeptuneCamHandle hCamHandle,
ENeptuneResolution* peResolution)

Parameters
[IN] hCamHandle : camera handle
[OUT] peResolution : 1920x1080 or 1280x720

Remark

Example
ENeptuneResolution eResolution;
ntcGetResolutionSelector(hCamHandle, &eResolution);

See Also
ntcSetResolutionSelector, ntcGetResolutionList

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 94

4.6.16 ntcGetResolutionList

Description
Get resolution list from a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetResolutionList(NeptuneCamHandle hCamHandle,
ENeptuneResolution* peList, _uint32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[OUT] peList : List of supported frame rate
[IN/OUT] pnSize : Count of peList

Remark
This API function should be called twice. When count of pnSize is returned, the user can get list of
resolution after the array of peList is allocated as pnSize.

Example
ENeptuneResolution* eResArr;
_uint32_t nSize = 0;
if( ntcGetResolutionList(hCamHandle, eResArr, &nSize ) == NEPTUNE_ERR_Success )
{
if( nSize > 0 )
ntcGetResolutionList(hCamHandle, eResArr, &nSize);
}

See Also
ntcSetResolutionSelector, ntcGetResolutionSelector

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 95

4.6.17 ntcSetDayNightModeSelector

Description
Set DayNight mode of a USB3 camera. (322UC)

Definition
ENeptuneError ntcSetDayNightModeSelector(NeptuneCamHandle hCamHandle,
ENeptuneDayNightMode eDayNightMode);

Parameters
[IN] hCamHandle : camera handle
[IN] eDayNightMode : DayNight mode

Remark
You may select the DayNight mode of the camera by using this API function. ENeptuneDayNightMode
is defined in "NeptuneDef.h" as follows:

enum ENeptuneDayNightMode
{
NEPTUNE_DAYNIGHT_AUTO = 0,
NEPTUNE_DAYNIGHT_COLOR = 1,
NEPTUNE_DAYNIGHT_MONO = 2,
NEPTUNE_DAYNIGHT_EXT = 3,
};

Example
ntcSetDayNightModeSelector(hCamHandle,NEPTUNE_DAYNIGHT_AUTO);

See Also
ntcGetDayNightModeSelector

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 96

4.6.18 ntcGetDayNightModeSelector

Description
Get DayNight mode from a USB3 camera. (322UC)

Definition
ENeptuneError ntcGetDayNightModeSelector(NeptuneCamHandle hCamHandle,
ENeptuneDayNightMode* peDayNightMode)

Parameters
[IN] hCamHandle : camera handle
[OUT] peDayNightMode : DayNight mode

Remark

Example
ENeptuneDayNightMode eMode;
ntcGetDayNightModeSelector(hCamHandle, &eMode);

See Also
ntcSetDayNightModeSelector

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 97

4.7 Trigger information and setting


The trigger is used to get a single or multiple frames from camera synchronized with a signal. A camera stops
transfer image when it is set as trigger mode and starts transfer by the signel.
Please refer to the camera manual for details about trigger mode supported by a camera.
The NeptuneC API provides functions for getting information and for getting values with
“NEPTUNE_TRIGGER_INFO” and “NEPTUNE_TRIGGER” structure defined as below.

struct NEPTUNE_TRIGGER_INFO {
ENeptuneBoolean bSupport; // trigger support flag
_uint16_t nModeFlag; // bit mask for trigger mode
_uint16_t nSourceFlag; // bit mask for trigger source
_uint16_t nPolarityFlag; // bit mask for polarity
_uint16_t nParamMin; // trigger parameter minimum value
_uint16_t nParamMax; // trigger parameter maximum value
};
typedef NEPTUNE_TRIGGER_INFO * PNEPTUNE_TRIGGER_INFO;

struct NEPTUNE_TRIGGER {
ENeptuneTriggerSource Source; // trigger source value
ENeptuneTriggerMode Mode; // trigger mode value
ENeptunePolarity Polarity; // trigger polarity value
ENeptuneBoolean OnOff; // trigger on/off
_uint16_t nParam; // trigger parameter
};
typedef NEPTUNE_TRIGGER* PNEPTUNE_TRIGGER;

In the “NEPTUNE_TRIGGER_INFO” structure, the “bSupport” element means the support of trigger. The
“nModeFlag”, “nSourceFlag” and “nPolarityFlag” express support of trigger mode, trigger source and trigger
polarity with bit flag as below.

Element Bit Meaning


nModeFlag 0~15 Support trigger mode [0~15]
0 Support external trigger
nSourceFlag
7 Support software trigger
0 Support rising edge trigger signal
1 Support Falling edge trigger signal
nPolarityFlag 2 Support any edge trigger signal
3 Support high level trigger signel
4 Support low level trigger signal

The “nParamMin” and “nParamMax” are the range of trigger parameter supported which is used for several
trigger modes except mode0. Please refer to the camera manual for details about the trigger parameter.
The “NEPTUNE_TRIGGER” structure is used to get the current trigger value or to set the trigger.
Enumeration values are defined as below.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 98

enum ENeptuneTriggerSource
{
NEPTUNE_TRIGGER_SOURCE_LINE1 = 0, // external(H/W trigger)
NEPTUNE_TRIGGER_SOURCE_SW =7 // software trigger
};

enum ENeptuneTriggerMode
{
NEPTUNE_TRIGGER_MODE_0 = 0, // trigger mode 0
NEPTUNE_TRIGGER_MODE_1, // trigger mode 1
NEPTUNE_TRIGGER_MODE_2, // trigger mode 2
NEPTUNE_TRIGGER_MODE_3, // trigger mode 3
NEPTUNE_TRIGGER_MODE_4, // trigger mode 4
NEPTUNE_TRIGGER_MODE_5, // trigger mode 5
NEPTUNE_TRIGGER_MODE_6, // trigger mode 6
NEPTUNE_TRIGGER_MODE_7, // trigger mode 7
NEPTUNE_TRIGGER_MODE_8, // trigger mode 8
NEPTUNE_TRIGGER_MODE_9, // trigger mode 9
NEPTUNE_TRIGGER_MODE_10, // trigger mode 10
NEPTUNE_TRIGGER_MODE_11, // trigger mode 11
NEPTUNE_TRIGGER_MODE_12, // trigger mode 12
NEPTUNE_TRIGGER_MODE_13, // trigger mode 13
NEPTUNE_TRIGGER_MODE_14, // trigger mode 14
NEPTUNE_TRIGGER_MODE_15 // trigger mode 15
};

enum ENeptunePolarity
{
NEPTUNE_POLARITY_RISINGEDGE = 0, // rising edge
NEPTUNE_POLARITY_FALLINGEDGE = 1, // falling edge
NEPTUNE_POLARITY_ANYEDGE = 2, // any edge
NEPTUNE_POLARITY_LEVELHIGH = 3, // high level
NEPTUNE_POLARITY_LEVELLOW = 4 // low level
};

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 99

4.7.1 ntcGetTriggerInfo

Description
Get the trigger information supported by a camera.

Definition
ENeptuneError ntcGetTriggerInfo(NeptuneCamHandle hCamHandle,
PNEPTUNE_TRIGGER_INFO pTriggerInfo)

Parameters
[IN] hCamHandle : camera handle
[OUT] pTriggerInfo : trigger information

Remark
This API function returns the trigger information of a camera. As the trigger mode, trigger source,
trigger polarity is expressed with bit flag, user can know the trigger information by checking the
respective bit values.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_TRIGGER_INFO TriggerInfo;

if( ntcGetTriggerInfo(hCamHandle, &TriggerInfo) == NEPTUNE_ERR_Success )


{
// trigger mode
_uint16_t nMode = TriggerInfo.nModeFlag;
for ( _uint16_t i = 0; i < i++ )
{
// Mode [0 ~ 15] support check
if ( (nMode >> i) & 0x1 )
{
// do something
}
}

// trigger source
if ( TriggerInfo.nSourceFlag & 0x1 )
// external(H/W) trigger support
if ( TriggerInfo.nSourceFlag & 0x7 )

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 100

// software trigger support

// trigger polarity
_uint16_t nPolarity = TriggerInfo.nPolarityFlag;
for ( _uint16_t i = 0; i < 16; i++ )
{
// polarity check
if ( (nPolarty >> i) & 0x1 )
{
// do something
}
}
}

See Also
ntcGetTrigger, ntcSetTrigger

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 101

4.7.2 ntcGetTrigger

Description
Get the current trigger value from a camera.

Definition
ENeptuneError ntcGetTrigger(NeptuneCamHandle hCamHandle,
PNEPTUNE_TRIGGER pTrigger)

Parameters
[IN] hCamHandle : camera handle
[OUT] pTrigger : trigger value

Remark
This API function is used to get the current trigger value of a camera. All values except parameter is
expressed as enumeration type.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_TRIGGER Trigger;

if( ntcGetTrigger(hCamHandle, &Trigger) == NEPTUNE_ERR_Success )


{
Trigger.Source; // trigger source
Trigger.Mode; // trigger mode
Trigger.Polarit; // trigger polarity
Trigger.OnOff; // trigger on/off
Trigger.nParam; // trigger parameter
}

See Also
ntcSetTrigger

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 102

4.7.3 ntcSetTrigger

Description
Set trigger value to a camera.

Definition
ENeptuneError ntcSetTrigger(NeptuneCamHandle hCamHandle, NEPTUNE_TRIGGER Trigger)

Parameters
[IN] hCamHandle : camera handle
[IN] Trigger : trigger value

Remark
This function is used to set user trigger values to a camera.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_TRIGGER Trigger;

Trigger.Source = NEPTUNE_TRIGGER_SOURCE_LINE1; // external trigger


Trigger.Mode = NEPTUNE_TRIGGER_MODE0; // trigger mode 0
Trigger.Polarity = NEPTUNE_POLARITY_RISINGEDGE; // rising edge
Trigger.OnOff = NEPTUNE_BOOL_TRUE; // trigger on

if( ntcSetTrigger(hCamHandle, Trigger) == NEPTUNE_ERR_Success )


{
// do something
}

See Also
ntcGetTrigger

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 103

4.7.4 ntcGetTriggerDelay

Description
Get trigger delay value.

Definition
ENeptuneError ntcGetTriggerDelay(NeptuneCamHandle hCamHandle, _uint32_t* pnDelay,
_uint32_t* pnMin=NULL, _uint32_t* pnMax=NULL)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnDelay : trigger delay value
[OUT] pnMin : minimum trigger delay value
[OUT] pnMax : maximum trigger delay value

Remark
This API function is used to read the trigger delay value from a camera. Please refer to the camera
manual for details about the trigger delay.

Example
_uint32_t nValue, nMin, nMax;

ntcGetTriggerDelay(hCamHandle, &nValue, &nMin, &nMax);

See Also
ntcSetTriggerDelay

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 104

4.7.5 ntcSetTriggerDelay

Description
Set trigger delay value.

Definition
ENeptuneError ntcSetTriggerDelay(NeptuneCamHandle hCamHandle, _uint32_t nDelay)

Parameters
[IN] hCamHandle : camera handle
[IN] nDelay : trigger delay value

Remark
This API function is used set trigger delay value to a camera.

Example
ntcSetTriggerDelay(hCamHandle, 500);

See Also
ntcGetTriggerDelay

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 105

4.7.6 ntcRunSWTrigger

Description
Generate the software trigger signal.

Definition
ENeptuneError ntcRunSWTrigger(NeptuneCamHandle hCamHandle)

Parameters
[IN] hCamHandle : camera handle

Remark
This API function make camera to transfer trigger image data if trigger source is set as “Software”.
User should set the trigger source as “NEPTUNE_TRIGGER_SOURCE_SW” when he calls the
“ntcSetTrigger” function.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
ntcRunSWTrigger(hCamHandle);

See Also
ntcGetTrigger, ntcSetTrigger

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 106

4.7.7 ntcReadTriggerTable

Description
Read trigger table of given index.

Definition
ENeptuneError ntcReadTriggerTable(NeptuneCamHandle hCamHandle,
PNEPTUNE_TRIGGER_TABLE pTriggerTable)

Parameters
[IN] hCamHandle : camera handle
[OUT] pTriggerTable : trigger table

Remark
This API function is used to get the trigger table which is used for trigger mode 12 and 13. The trigger
mode 12 and 13 can send up to 255 frames and user can set different gain and shutter values for each
frame. Please refer to the camera manual for details about the trigger mode 12 and 13.
The trigger table is passed with the “NEPTUNE_TRIGGER_TABLE” structure as defined below.

struct NEPTUNE_TRIGGER_PARAM {
_uint32_t nShutterValue; // shutter feature value
_uint32_t nGainValue; // gain feature value
_uint32_t nIncrement; // end of table(0) or continuous(1)
_uint32_t nFrameOrder; // frame sequence number
};

struct NEPTUNE_TRIGGER_TABLE {
// trigger parameter : max 255
NEPTUNE_TRIGGER_PARAM Param[MAX_TRIGGER_PARAM];
_uint32_t Index; // 0 ~ 15
};
typedef NEPTUNE_TRIGGER_TABLE* PNEPTUNE_TRIGGER_TABLE;

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\TriggerExtraParam
NEPTUNE_TRIGGER_TABLE TriggerTable;

TriggerTable.Index = 0; // index from which to load table


if ( ntcReadTriggerTable(hCamHandle, &TriggerTable) == NEPTUNE_ERR_Success )
{
for ( int i = 0; i < MAX_TRIGGER_PARAM; i++ )
{

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 107

TriggerTable.Param[i].nFrameOrder; // frame sequence


TriggerTable.Param[i].nIncrement; // table end flag
TriggerTable.Param[i].nGainValue; // gain feature value
TriggerTable.Param[i].nShutterValue; // shutter feature value

// if end of table
if ( TriggerTable.Param[i].nIncrement == 0 )
break;
}
}

See Also
ntcSaveTriggerTable, ntcLoadTriggerTable

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 108

4.7.8 ntcSaveTriggerTable

Description
Save trigger table to a given index.

Definition
ENeptuneError ntcSaveTriggerTable(NeptuneCamHandle hCamHandle,
NEPTUNE_TRIGGER_TABLE TriggerTable)

Parameters
[IN] hCamHandle : camera handle
[IN] TriggerTable : trigger table

Remark
This API function is used to save trigger table to a camera. The number of trigger table indexes
supported by a camera may different according to the camera mode and maximum value is 15. Please
refer to the camera manual for details about the trigger table.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\TriggerExtraParam
NEPTUNE_TRIGGER_TABLE TriggerTable;

TriggerTable.Index = 0; // index to save trigger table

// set only 200 table elements


for ( int i = 0; i < MAX_TRIGGER_PARAM; i++ )
{
TriggerTable.Param[i].nFrameOrder;
TriggerTable.Param[i].nIncrement = (i == 200) ? 0 : 1;
TriggerTable.Param[i].nShutterValue = 1100;
TriggerTable.Param[i].nGainValue = 30;
}
ntcSaveTriggerTable(hCamHandle, TriggerTable);

See Also
ntcGetTriggerTable, ntcLoadTriggerTable

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 109

4.7.9 ntcLoadTriggerTable

Description
Make camera to load trigger table of given index.

Definition
ENeptuneError ntcLoadTriggerTable(NeptuneCamHandle hCamHandle, _uint32_t nIndex)

Parameters
[IN] hCamHandle : camera handle
[IN] nIndex : trigger table index

Remark
This API function is used to make camera to load trigger table when the trigger table is saved in a
camera with the “ntcSaveTriggerTable” function.

Example
ntcLoadTriggerTable(hCamHandle, 0);

See Also
ntcGetTriggerTable, ntcSaveTriggerTable

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 110

4.7.10 ntcSetTriggerMode14Exposure

Description
Set exposure time value for trigger mode14 to a camera.

Definition
ENeptuneError ntcSetTriggerMode14Exposure(NeptuneCamHandle hCamHandle,
_uint32_t nExposure, _uint32_t nInterval)

Parameters
[IN] hCamHandle : camera handle
[IN] nExposure : exposure time value for trigger mode14
[IN] nInterval : exposure time interval for trigger mode14

Remark
This function is used to exposure time and interval used for trigger mode14. Please refer to the camera
manual for details how trigger mode14 works.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
_uint32_t nExposure = 1000;
_uint32_t nInterval = 1000;

if( ntcSetTriggerMode14Exposure(hCamHandle, nExposure, nInterval) == NEPTUNE_ERR_Success )


{
// do something
}

See Also
ntcSetTrigger

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 111

4.7.11 ntcSetUSBTriggerBufferCount

Description
Set the number of buffers used in trigger mode of the USB3 camera

Definition
ENeptuneError ntcSetUSBTriggerBufferCount(NeptuneCamHandle hCamHandle, _uint32_t
nCount)

Parameters
[IN] hCamHandle : camera handle
[IN] nCount : number of buffer

Remark
It is valid to a usb3 camera only, default value is 10.

Example
_uint32_t nCount = 5;

if( ntcSetUSBTriggerBufferCount (hCamHandle, nCount) == NEPTUNE_ERR_Success )


{
// do something
}

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 112

4.8 Strobe information and setting


Functions in this section are for setting information and value about strobe and for setting value. Please refer to
the camera manual for details about the strobe.
The strobe information is expressed as “NEPTUNE_STROBE_INFO” structure and the strobe value is expressed as
“NEPTUNE_STROBE” structure.

struct NEPTUNE_STROBE_INFO {
ENeptuneBoolean bSupport; // support of strobe
_uint16_t nStrobeFlag; // support strobes bit flag
_uint16_t nDurationMin; // strobe duration minimum value
_uint16_t nDurationMax; // strobe duration maximum value
_uint16_t nDelayMin; // strobe delay minimum value
_uint16_t nDelayMax; // strobe delay maximum value
_uint16_t nPolarityFlag; // strobe polarity support bit flag
};
typedef NEPTUNE_STROBE_INFO* PNEPTUNE_STROBE_INFO;

struct NEPTUNE_STROBE {
ENeptuneBoolean OnOff; // strobe on/off control
ENeptuneStrobe Strobe; // strobe index
_uint16_t nDuration; // strobe duration value
_uint16_t nDelay; // strobe delay value
ENeptunePolarity Polarity; // strobe polarity
};
typedef NEPTUNE_STROBE* PNEPTUNE_STROBE;

In “NEPTUNE_STROBE_INFO” structure, “nStrobeFlag” and “nPolarityFlag” express the strobe and polarity
supported by a camera with bit flag as was in trigger section. Bit value has meaning as below.

Element Bit Meaning


nStrobeFlag 0~4 Support strobe [0~4]
0 Support rising edge signal
1 Support falling edge signal
nPolarityFlag 2 Support any edge signal
3 Support high level signal
4 Support low level signal

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 113

4.8.1 ntcGetStrobeInfo

Description
Get the strobe information from a camera.

Definition
ENeptuneError ntcGetStrobeInfo(NeptuneCamHandle hCamHandle,
PNEPTUNE_STROBE_INFO pStrobeInfo)

Parameters
[IN] hCamHandle : camera handle
[OUT] pStrobeInfo : strobe information

Remark
The strobe supported by a camera depends on the camera model. Please refer to the camera manual
for details.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_STROBE_INFO StrobeInfo;

if ( ntcGetStrobeInfo(hCamHandle, &StrobeInfo) == NEPTUNE_ERR_Success )


{
// check strobe support
if ( StrobeInfo.bSupport )
{
_uint16_t i, nFlag, nPolarity;

// check support strobes


nFlag = StrobeInfo.nStrobeFlag;
for ( i = 0; i < 16; i++ )
if ( (nFlag >> i) & 0x1 )
{
// strobe support, do something
}

// strobe polarity
nPolarity = StrobeInfo.nPolarityFlag;
for ( i = 0; i < 16; i++ )
if ( (nPolarityFlag >> i) & 0x1 )

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 114

{
// polarity support, do something
}

// strobe duration range value


StrobeInfo.nDurationMin;
StrobeInfo.nDurationMax;

// strobe delay range value


StrobeInfo.nDelayMin;
StrobeInfo.nDelayMax;
}
}

See Also
ntcGetStrobe, ntcSetStrobe

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 115

4.8.2 ntcGetStrobe

Description
Get current strobe value.

Definition
ENeptuneError ntcGetStrobe(NeptuneCamHandle hCamHandle, PNEPTUNE_STROBE pStrobe)

Parameters
[IN] hCamHandle : camera handle
[OUT] pStrobe : strobe value

Remark
This API function is used for getting current strobe value from a camera.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_STROBE Strobe;

if ( ntcGetStrobe(hCamHandle, &Strobe) == NEPTUNE_ERR_Success )


{
Strobe.Strobe; // current strobe index
Strobe.Polarity; // current strobe polarity
Strobe.nDuration; // strobe duration value
Strobe.nDelay; // strobe delay value
Strobe.OnOff; // strobe on/off
}

See Also
ntcGetStrobeInfo, ntcSetStrobe

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 116

4.8.3 ntcSetStrobe

Description
Set strobe value to a camera.

Definition
ENeptuneError ntcSetStrobe(NeptuneCamHandle hCamHandle, NEPTUNE_STROBE Strobe)

Parameters
[IN] hCamHandle : camera handle
[IN] Strobe : strobe value

Remark
This API function is used to set strobe value to a camera.

Example
ref. NeptuneC Library\Samples\C++\GUI\3.Trigger
NEPTUNE_STROBE Strobe;

Strobe.Strobe = NEPTUNE_STROBE0;
Strobe.Polarity = NEPTUNE_POLARITY_RISINGEDGE;
Strobe.nDuration = 200;
Strobe.nDelay = 150;
Strobe.OnOff = NEPTUNE_BOOL_TRUE;

ntcSetStrobe(hCamHandle, Strobe);

See Also
ntcGetStrobeInfo, ntcGetStrobe

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 117

4.9 Auto iris control


User can control auto iris of camera if a camera supports auto iris. The NeptuneC API provides functions for
controlling auto iris mode, frame number used for auto iris and target brightness of auto iris.
Please refer to the camera manual for details about the auto iris.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 118

4.9.1 ntcSetAutoIrisMode

Description
Set auto iris operation mode to a camera.

Definition
ENeptuneError ntcSetAutoIrisMode(NeptuneCamHandle hCamHandle,
ENeptuneAutoIrisMode eMode)

Parameters
[IN] hCamHandle : camera handle
[IN] eMode: auto iris operation mode

Remark
This API function is used to set the operation mode of auto iris. The operation mode is controlled with
the “ENeptuneAutoIrisMode” enumeration defined as below.

enum ENeptuneAutoIrisMode
{
NEPTUNE_AUTOIRIS_MODE_MANUAL = 0,
NEPTUNE_AUTOIRIS_MODE_AUTO = 1,
};

Example
ntcSetAutoIrisMode(hCamHandle, NEPTUNE_AUTOIRIS_MODE_AUTO);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 119

4.9.2 ntcGetAutoIrisAverageFrame

Description
Get the number of frames used for the auto iris.

Definition
ENeptuneError ntcGetAutoIrisAverageFrame(NeptuneCamHandle hCamHandle,
_uint32_t* pnValue,
_uint32_t* pnMin=NULL,
_uint32_t* pnMax=NULL)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnValue : the number of frames used for the auto iris
[OUT, Optional] pnMin : minimum value of the number of frames used for the auto iris
[OUT, Optional] pnMax : maximum value of the number of frames used for the auto iris

Remark
This API function is used to get the number of frames used for calculating brightness when auto iris is
working.

Example
_uint32_t nValue, nMin, nMax;
ntcGetAutoIrisAverageFrame(hCamHandle, &nValue, &nMin, &nMax);

See Also
ntcSetAutoIrisAverageFrame

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 120

4.9.3 ntcSetAutoIrisAverageFrame

Description
Set the number of frames used for the auto iris.

Definition
ENeptuneError ntcSetAutoIrisAverageFrame(NeptuneCamHandle hCamHandle,
_uint32_t nValue)

Parameters
[IN] hCamHandle : camera handle
[IN] nValue : the number of frames used for the auto iris

Remark
This API function is used to set the number of frames used for calculating brightness when auto iris is
working.

Example
ntcSetAutoIrisAverageFrame(hCamHandle, 10);

See Also
ntcGetAutoIrisAverageFrame

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 121

4.9.4 ntcGetAutoIrisTargetValue

Description
Get the target brightness information of auto iris.

Definition
ENeptuneError ntcGetAutoIrisTargetValue(NeptuneCamHandle hCamHandle,
_uint32_t* pnValue,
_uint32_t* pnMin=NULL, _uint32_t* pnMax=NULL)

Parameters
[IN] hCamHandle : camera handle
[OUT] pnValue : target brightness value of auto iris
[OUT, Optional] pnMin : minimum target brightness value of auto iris
[OUT, Optional] pnMax : maximum target brightness value of auto iris

Remark
This API function is used to get information of target brightness used for auto iris.

Example
_uint32_t nValue, nMin, nMax;
ntcGetAutoIrisTargetValue(hCamHandle, &nValue, &nMin, &nMax);

See Also
ntcSetAutoIrisTargetValue

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 122

4.9.5 ntcSetAutoIrisTargetValue

Description
Set the target brightness value of auto iris.

Definition
ENeptuneError ntcSetAutoIrisTargetValue(NeptuneCamHandle hCamHandle,
_uint32_t nValue)

Parameters
[IN] hCamHandle : camera handle
[IN] nValue : target brightness value of auto iris

Remark
This API function is used to set target brightness of auto iris.

Example
ntcSetAutoIrisTargetValue(hCamHandle, 128);

See Also
ntcGetAutoIrisTargetValue

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 123

4.10 GPIO control


Functions in this section are used to control the I/O pin of a camera. Please refer to the camera manual for
details about the GPIO.
The API controls GPIO with the “NEPTUNE_GPIO” structure and following enumerations.

struct NEPTUNE_GPIO {
ENeptuneGPIO Gpio; // GPIO index
ENeptuneGPIOSource Source; // GPIO source
ENeptuneGPIOValue Value; // GPIO value
};
typedef NEPTUNE_GPIO* PNEPTUNE_GPIO;

enum ENeptuneGPIO {
NEPTUNE_GPIO_LINE0 = 0, // GPIO 0
NEPTUNE_GPIO_LINE1 // GPIO 1
};

enum ENeptuneGPIOSource {
NEPTUNE_GPIO_SOURCE_STROBE = 0, // strobe
NEPTUNE_GPIO_SOURCE_USER // user defined
};

enum ENeptuneGPIOValue {
NEPTUNE_GPIO_VALUE_LOW = 0, // low level
NEPTUNE_GPIO_VALUE_HIGH // high level
};

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 124

4.10.1 ntcSetGPIO

Description
Set GPIO to camera.

Definition
ENeptuneError ntcSetGPIO(NeptuneCamHandle hCamHandle, NEPTUNE_GPIO Gpio)

Parameters
[IN] hCamHandle : camera handle
[IN] Gpio

Remark

Example
NEPTUNE_GPIO GPIO;

GPIO.Gpio = NEPTUNE_GPIO_LINE0;
GPIO.Source = NEPTUNE_GPIO_SOURCE_STROBE;
GPIO.Value = NEPTUNE_GPIO_VALUE_HIGH;

ntcSetGPIO(hCamHandle, GPIO);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 125

4.11 UserSet control


Functions in this section are used to control the UserSet(MemoryChannel) of a camera. With this function, user
can make camera to save some information (feature, pixel format, frame rate etc) to its memory for later use.
Please refer to the camera manul for details about the UserSet(MemoryChannel).
The API uses “NEPTUNE_USERSET” structure to get information of UserSet or to set value to a camera and the
structure is defined as below.

struct NEPTUNE_USERSET {
_uint16_t SupportUserSet; // bit flag for supported user set, 0 is "Default"
ENeptuneUserSet UserSetIndex; // user set index to save or load
ENeptuneUserSetCommand Command; // save or load
};
typedef NEPTUNE_USERSET* PNEPTUNE_USERSET;

The “SupportUserSet” expresses the supported UserSet as bit flag and each bit has meaning as below.

Support UserSet [1~15]


SupportUserSet 1~15
* UserSet0 is default, supported by all cameras.

The “UserSetIndex” is the index information and “Command” is control to save or load as defined below.

enum ENeptuneUserSet {
NEPTUNE_USERSET_DEFAULT = 0,
NEPTUNE_USERSET_1 = 1,
NEPTUNE_USERSET_2 = 2,
NEPTUNE_USERSET_3 = 3,
NEPTUNE_USERSET_4 = 4,
NEPTUNE_USERSET_5 = 5,
NEPTUNE_USERSET_6 = 6,
NEPTUNE_USERSET_7 = 7,
NEPTUNE_USERSET_8 = 8,
NEPTUNE_USERSET_9 = 9,
NEPTUNE_USERSET_10 = 10,
NEPTUNE_USERSET_11 = 11,
NEPTUNE_USERSET_12 = 12,
NEPTUNE_USERSET_13 = 13,
NEPTUNE_USERSET_14 = 14,
NEPTUNE_USERSET_15 = 15
};

enum ENeptuneUserSetCommand {
NEPTUNE_USERSET_CMD_LOAD = 0,
NEPTUNE_USERSET_CMD_SAVE = 1,
};

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 126

4.11.1 ntcGetUserSet

Description
Get UserSet information supported by a camera.

Definition
ENeptuneError ntcGetUserSet(NeptuneCamHandle hCamHandle,
PNEPTUNE_USERSET pUserSet)

Parameters
[IN] hCamHandle : camera handle
[OUT] pUserSet : UserSet information

Remark
Only the “SupportedUserSet” element is used for getting information from a camera and number of
supported UserSet may different to the camera model.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\UserSet
NEPTUNE_USERSET UserSet;
if ( ntcGetUserSet(hCamHandle, &UserSet) == NEPTUNE_ERR_Success )
{
// check support user set
for ( _uint16_t i = 0; i < 16; i++ )
{
if ( UserSet.SupportUserSet & (0x0001 << i) )
{
// bit 0 is default
if ( i == 0 )
// default
else
// userset[1~15]
}
}
}

See Also
ntcSetUserSet, ntcSetDefaultUserSet, ntcSetPowerOnDefaultUserSet

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 127

4.11.2 ntcSetUserSet

Description
Control camera to save or load UserSet.

Definition
ENeptuneError ntcSetUserSet(NeptuneCamHandle hCamHandle,
NEPTUNE_USERSET UserSet)

Parameters
[IN] hCamHandle : camera handle
[IN] UserSet : UserSet information

Remark
This API is used to save camera information to given UserSet index or load camera information from
given UserSet. The information save to UserSet is diffent to the UserSet index. From UserSet1 to
UserSet4, only the feature information is saved. And other UserSets save other control information
including pixel format, frame rate, trigger information etc. Please refer to the camera manual for details.
If a camera loads the saved information, the information between the camera and application is not
matched because camera applies value to current setting. So, read the camera information after
loading the UserSet to synchronize application and camera.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\UserSet
NEPTUNE_USERSET UserSet;
UserSet.UserSetIndex = NEPTUNE_USERSET_1;
UserSet.Command = NEPTUNE_USERSET_CMD_SAVE

// save user set


ntcSetUserSet(hCamHandle, UserSet);

// load user set


UserSet.Command = NEPTUNE_USERSET_CMD_LOAD;
ntcSetUserSet(hCamHandle, UserSet);

See Also
ntcGetUserSet, ntcSetDefaultUserSet, ntcSetPowerOnDefaultUserSet

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 128

4.11.3 ntcSetDefaultUserSet

Description
Set the UserSet index used as default.

Definition
ENeptuneError ntcSetDefaultUserSet(NeptuneCamHandle hCamHandle,
ENeptuneUserSet eUserSet)

Parameters
[IN] hCamHandle : camera handle
[IN] eUserSet : UserSet index

Remark
This API function is used to set the default UserSet other then “Default” UserSet.

Example
// save information to user set 2
NEPTUNE_USERSET UserSet;
UserSet.UserSetIndex = NEPTUNE_USERSET_2;
UserSet.Command = NEPTUNE_USERSET_CMD_SAVE
ntcSetUserSet(hCamHandle, UserSet);

// set user set 2 as default


ntcSetDefaultUserSet(hCamHandle, NEPTUNE_USERSET_2);

See Also
ntcGetUserSet, ntcSetUserSet, ntcSetPowerOnDefaultUserSet

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 129

4.11.4 ntcSetPowerOnDefaultUserSet

Description
Set the UserSet used when camera is power on.

Definition
ENeptuneError ntcSetPowerOnDefaultUserSet(NeptuneCamHandle hCamHandle,
ENeptuneUserSet eUserSet)

Parameters
[IN] hCamHandle : camera handle
[IN] eUserSet : UserSet index

Remark
This API function is used to set a camera to use specific UserSet when a camera is power on. With this
function, user can set camera to power on with desired value always.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\UserSet
// save information to user set 2
NEPTUNE_USERSET UserSet;
UserSet.UserSetIndex = NEPTUNE_USERSET_2;
UserSet.Command = NEPTUNE_USERSET_CMD_SAVE
ntcSetUserSet(hCamHandle, UserSet);

// set user set 2 as power on default user set


ntcSetPowerOnDefaultUserSet(hCamHandle, NEPTUNE_USERSET_2);

See Also
ntcGetUserSet, ntcSetUserSet, ntcSetDefaultUserSet

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 130

4.12 Look-up-table control


Funtions in this section is used to control the table supported by a camera and they controls Knee-point look-up-
table and User Defined look-up-table.
Knee-point look-up-table uses 4 points to make a table and User Defined look-up-table uses every output values
for all pixels. Please refer to the camera manual for details about the look-up-table.
The NeptuneC API uses “NEPTUNE_KNEE_LUT” and “NEPTUNE_USER_LUT” defined as below for each look-up-
table.

struct NEPTUNE_POINT {
_uint32_t x; // x-coordinate
_uint32_t y; // y-coordinate

};

struct NEPTUNE_KNEE_LUT {
NEPTUNE_POINT Points[4]; // 4 points
ENeptuneBoolean bEnable; // enable/disable state/control
};
typedef NEPTUNE_KNEE_LUT* PNEPTUNE_KNEE_LUT;

struct NEPTUNE_USER_LUT {
_uint16_t SupportLUT; // bit Flag
_uint16_t LUTIndex; // current LUT index
ENeptuneBoolean Enable; // enable/disable state/control
_int16_t Data[4096]; // LUT data, valid only in Set function
};
typedef NEPTUNE_USER_LUT* PNEPTUNE_USER_LUT;

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 131

4.12.1 ntcGetKneeLUT

Description
Get Knee-point look-up-table information.

Definition
ENeptuneError ntcGetKneeLUT(NeptuneCamHandle hCamHandle,
PNEPTUNE_KNEE_LUT pLUTPoints)

Parameters
[IN] hCamHandle : camera handle
[OUT] pLUTPoints : point infomration

Remark
This API function returns the coordinates of 4-points composing Knee-point look-up-table and the
enable/disblae state.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\4StepLUT
NEPTUNE_KNEE_LUT KneeLUT;

ntcGetKneeLUT(hCamHandle, &KneeLUT);
KneeLUT.Points[0]; // point1 x, y coordinate
KneeLUT.Points[1]; // point2 x, y coordinate
KneeLUT.Points[2]; // point3 x, y coordinate
KneeLUT.Points[3]; // point4 x, y, coordinate
KneeLUT.bEnable; // enable/disable state

See Also
ntcSetKneeLUT

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 132

4.12.2 ntcSetKneeLUT

Description
Set 4-point look-up-table to a camera.

Definition
ENeptuneError ntcSetKneeLUT(NeptuneCamHandle hCamHandle,
NEPTUNE_KNEE_LUT LUTPoints)

Parameters
[IN] hCamHandle : camera handle
[IN] LUTPoints : point information

Remark
This API function is used to set 4-point composing Knee-point look-up-table.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\4StepLUT
NEPTUNE_KNEE_LUT KneeLUT;

KneeLUT.Points[0].x = 100, KneeLUT.Points[0].y = 100; // point1 x, y coordinate


KneeLUT.Points[1].x = 300, KneeLUT.Points[1].y = 300; // point2 x, y coordinate
KneeLUT.Points[2].x = 800, KneeLUT.Points[2].y = 800; // point3 x, y coordinate
KneeLUT.Points[3].x = 1000, KneeLUT.Points[3].y = 1000; // point4 x, y, coordinate
KneeLUT.bEnable = NEPTUNE_BOOL_TRUE;
ntcSetKneeLUT(hCamHandle, KneeLUT);

See Also
ntcGetKneeLUT

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 133

4.12.3 ntcGetUserLUT

Description
Get the number of User Defined look-up-table supported by a camera.

Definition
ENeptuneError ntcGetUserLUT(NeptuneCamHandle hCamHandle,
PNEPTUNE_USER_LUT pLUTData)

Parameters
[IN] hCamHandle : camera handle
[OUT] pLUTData : table information

Remark
This API function returns the number of look-up-table, current table index and enable state of a table.
The supported look-up-table is expressed as bit flag in the “SupportLUT” element.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\UserLUT
NEPTUNE_USER_LUT UserLUT;

if ( ntcGetUserLUT(hCamHandle, &UserLUT) == NEPTUNE_ERR_Success )


{
// check support indexes
for ( _uint16_t i = 0; i < 16; i++ )
{
if ( UserLUT.SupportLUT & (0x0001 << i) ) // support
; // do something
}

UserLUT.LUTIndex; // current index

UserLUT.Enable; // enable state


}

See Also
ntcSetUserLUT

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 134

4.12.4 ntcSetUserLUT

Description
Save look-up-table to a camera.

Definition
ENeptuneError ntcSetUserLUT(NeptuneCamHandle hCamHandle,
NEPTUNE_USER_LUT LUTData)

Parameters
[IN] hCamHandle : camera handle
[IN] LUTData : look-up-table

Remark
This API function is used to save look-up-table to a given index and to control table state. The size of
the table is 4096.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\UserLUT
NEPTUNE_USER_LUT UserLUT;

UserLUT.LUTIndex = 0; // index to save


UserLUT.Enable = NEPTUNE_BOOL_TRUE; // enable table
// load table to UserLUT.Data
for ( i = 0; i < USER_LUT_TABLE_SIZE; i++ )
UserLUT.Data[i] = i;
ntcSetUserLUT(hCamHandle, UserLUT);

See Also
ntcGetUserLUT

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 135

4.13 Frame Save control


Functions in this section can control camera to save image data to camera’s internal memory and to transfer
number of image data. The number of frames can be saved in camera’s memory is vary according to the pixel
format and image size. Please refer to the camera manual for details about the frame save.
Currently, only 1394 camera support this function.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 136

4.13.1 ntcGetFrameSave

Description
Get frame save information from a camera.

Definition
ENeptuneError ntcGetFrameSave(NeptuneCamHandle hCamHandle,
ENeptuneBoolean* peOnOff,
_uint32_t* pnFrameRemained)

Parameters
[IN] hCamHandle : camera handle
[OUT] peOnOff : On/Off state
[OUT] pnFrameRemained : number of frames remained in camera memory
(valid only when peOnOff=NEPTUNE_BOOL_TRUE)

Remark
This API function returns frame save control state and the number of frames saved in camera’s
memory.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\FrameSave
ENeptuneBoolean bOnOff; // enable state
_uint32_t nFrames; // number of frames in camera memory

ntcGetFrameSave(hCamHandle, &bOnOff, &nFrames);

See Also
ntcSetFrameSave

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 137

4.13.2 ntcSetFrameSave

Description
Set frame save control to a camera.

Definition
ENeptuneError ntcSetFrameSave(NeptuneCamHandle hCamHandle,
ENeptuneBoolean eOnOff, ENeptuneBoolean eTransfer,
_uint32_t nFrames)

Parameters
[IN] hCamHandle : camera handle
[IN] eOnOff : on/off control
[IN] eTransfer : transfer control
[IN] nFrames : number of frames to transfer

Remark
This API function is used to get the frames saved in the camera memory.
Once frame save is enabled, camera stop transfer image to interface and start save image to its
memory. User can control camera to transfer with “eTransfer” and “nFrames” parameter. If the second
parameter is “NEPTUNE_BOOL_FALSE”, then third and fourth parameter is ignored.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\FrameSave
// enable frame save
ntcSetFrameSave(hCamHandle, NEPTUNE_BOOL_TRUE, NEPTUNE_BOOL_FALSE, 0);

// transfer control
ntcSetFrameSave(hCamHandle, NEPTUNE_BOOL_TRUE, NEPTUNE_BOOL_TRUE, 10);

// disable frame save


ntcSetFrameSave(hCamHandle, NEPTUNE_BOOL_FALSE, NEPTUNE_BOOL_FALSE, 0);

See Also
ntcGetFrameSave

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 138

4.14 SIO control


User can transfer RS232 data to the camera interface with the SIO.
A camera transfer RS232 data to serial interface located back side when it receives RS232 data via the interface
from user. And user can read the RS232 data passed to camera with the camera interface.
Please refer to the camera manual for details about the SIO control.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 139

4.14.1 ntcSetSIO

Description
Set RS232 environment to camera.

Definition
ENeptuneError ntcSetSIO(NeptuneCamHandle hCamHandle,
NEPTUNE_SIO_PROPERTY Property)

Parameters
[IN] hCamHandle : camera handle
[IN] Property : RS232 information

Remark
This API function is used to set the RS232 port information in a camera. The
“NEPTUNE_SIO_PROPERTY” structure is defined as below.

enum ENeptuneSIOParity
{
NEPTUNE_SIO_PARITY_NONE = 0,
NEPTUNE_SIO_PARITY_ODD = 1,
NEPTUNE_SIO_PARITY_EVEN = 2,
};

struct NEPTUNE_SIO_PROPERTY
{
ENeptuneBoolean bEnable; // RS232 enable
_uint32_t Baudrate; // serial baudrate
ENeptuneSIOParity Parity; // parity bit
_uint32_t DataBit; // data bit
_uint32_t SoptBit; // stop bit

NEPTUNE_SIO_PROPERTY()
{
bEnable = NEPTUNE_BOOL_FALSE;
Baudrate = 9600;
Parity = NEPTUNE_SIO_PARITY_NONE;
DataBit = 8;
SoptBit = 1;
}
};
typedef NEPTUNE_SIO_PROPERTY* PNEPTUNE_SIO_PROPERTY;

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\SIOControl
NEPTUNE_SIO_PROPERTY SIOProp;

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 140

SIOProp.BaudRate = 9600;
SIOProp.Parity = NEPTUNE_SIO_PARITY_NONE;
SIOProp.DataBit = 8;
SIOProp.StopBit = 1;
SIOProp.bEnable = NEPTUNE_BOOL_TRUE;

ntcSetSIO(hCamHandle, SIOProp);

See Also
ntcWriteSIO, ntcReadSIO

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 141

4.14.2 ntcWriteSIO

Description
Write RS232 data to a camera.

Definition
ENeptuneError ntcWriteSIO(NeptuneCamHandle hCamHandle, NEPTUNE_SIO Data)

Parameters
[IN] hCamHandle : camera handle
[IN] Data : RS232 data

Remark
This API function is used to send RS232 data to a camera after setting the RS232 environment and it
tries to send data for “nTimeOut”. The “NEPTUNE_SIO” structure defined as below.

struct NEPTUNE_SIO
{
_uint32_t TextCount; // should be smaller than or equal to 256
_char_t strText[256]; // RS232 data
_uint32_t TimeOut; // in ms unit
};
typedef NEPTUNE_SIO* PNEPTUNE_SIO;

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\SIOControl
NEPTUNE_SIO SIOData;

strcpy(SIOData.strText, “RS232 data”);


SIOData.TextCount = strlen(SIOData.strText);
SIOData.nTimeOut = 3000;

ntcWriteSIO(hCamHandle, SIOData);

See Also
ntcSetSIO, ntcReadSIO

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 142

4.14.3 ntcReadSIO

Description
Read RS232 data from a camera.

Definition
ENeptuneError ntcReadSIO(NeptuneCamHandle hCamHandle, PNEPTUNE_SIO pData)

Parameters
[IN] hCamHandle : camera handle
[OUT] pData : RS232 data

Remark
This API function returns the RS232 data passed to a camera frome external device via RS232.

Example
ref. NeptuneC Library\Samples\C++\GUI\7.Advanced\SIOControl
NEPTUNE_SIO SIOData;

SIOData.TextCount = 10;
SIOData.TimeOut = 3000;

// read 10 RS232 data


ntcReadSIO(hCamHandle, &SIOData);

See Also
ntcSetSIO, ntcWriteSIO

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 143

4.15 Register access


Functions in this section are used to read and write camera register. The camera register may different according
to the camera type(1394, GigE and USB3).

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 144

4.15.1 ntcReadRegister

Description
Read camera register.

Definition
ENeptuneError ntcReadRegister(NeptuneCamHandle hCamHandle,
_ulong32_t ulAddr, _ulong32_t* pulVal)

Parameters
[IN] hCamHandle : camera handle
[IN] ulAddr : register address
[OUT] pulVal : register value

Remark
This API function returns register value of given register in 4-byte unit.

Example
_ulong32_t ulVal;
ntcReadRegister(hCamHandle, 0xa000, &ulVal);

See Also
ntcWriteRegister, ntcReadBlock, ntcWriteBlock

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 145

4.15.2 ntcWriteRegister

Description
Write data to a camera register.

Definition
ENeptuneError ntcWriteRegister(NeptuneCamHandle hCamHandle,
_ulong32_t ulAddr, _ulong32_t ulVal)

Parameters
[IN] hCamHandle : camera handle
[IN] ulAddr : register address
[IN] ulVal : data value

Remark
This API function is used to write value to camera register in 4-byte unit.

Example
ntcWriteRegister(hCamHandle, 0xF2F10144, 0x82000000);

See Also
ntcReadRegister, ntcReadBlock, ntcWriteBlock

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 146

4.15.3 ntcReadBlock

Description
Read data from camera registers

Definition
ENeptuneError ntcReadBlock(NeptuneCamHandle hCamHandle,
_ulong32_t ulAddr, _uint8_t* pBuf, _ulong32_t* pnSize)

Parameters
[IN] hCamHandle : camera handle
[IN] ulAddr : start register address
[OUT] pBuf : data buffer
[IN/OUT] pnSize : size of buffer

Remark
This API function is used to read multiple camera register at once. Camera register is increased
internally.

Example
_uint8_t Buf[32];
_ulong32_t nSize = 32;

ntcReadBlock(hCamHandle, 0xF2F10144, Buf, &nSize);

See Also
ntcReadRegister, ntcWriteRegister, ntcWriteBlock

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 147

4.15.4 ntcWriteBlock

Description
Write data to camera registers.

Definition
ENeptuneError ntcWriteBlock(NeptuneCamHandle hCamHandle,
_ulong32_t ulAddr, _uint8_t* pBuf, _ulong32_t nSize)

Parameters
[IN] hCamHandle : camera handle
[IN] ulAddr : start register address
[IN] pBuf : data buffer
[IN] nSize : size of buter

Remark
This API function is used for writing data to several registers at once.

Example
_uint8_t Buf[32];
_ulong32_t nSize = 32;

// write data to Buf


for ( int i = 0; i < 32; i++ )
Buf[i] = i;
ntcWriteBlock(hCamHandle, 0xF2F10144, Buf, nSize);

See Also
ntcReadRegister, ntcWriteRegister, ntcReadBlock

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 148

4.15.5 ntcWriteBroadcast

Description
Write data to all connected 1394 camera register.

Definition
ENeptuneError ntcWriteBroadcast(NeptuneCamHandle hCamHandle,
_ulong32_t ulAddr, _ulong32_t ulVal)

Parameters
[IN] hCamHandle : camera handle
[IN] ulAddr : register address
[IN] ulVal : data value

Remark
This API function is used to write same value to all connected 1394 camra which is located in same bus
at the same time. User can use any handle of 1394 camera.

Example
// write gain to all 1394 camera
ntcWriteBroadcast(hCamHandle, 0xF0F00820, 0x82000014);

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 149

4.16 XML control


All 1394, GigE and USB3 camera is based on the GenICamTM specification(www.genicam.org) standardized by the
EMVA(European Machine Vision Association). And the NeptuneC API is also based on the GenICam standard.
The GenICam uses XML tree to control camera and provides basic XML parser for the standard.
User can user functions in this section to access the GenICam XML tree node directly after identifying type of a
node.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 150

4.16.1 ntcGetNodeVisibility

Description
Get the visibility of XML tree.

Definition
ENeptuneError ntcGetNodeVisibility(NeptuneCamHandle hCamHandle,
ENeptuneNodeVisibility* peVisibility)

Parameters
[IN] hCamHandle : camera handle
[OUT] peVisibility : XML tree visibility

Remark
There are 3 visibilities in the camera XML tree – Beginner, Expert, Guru and this visibility restrain from
showing some node according to the value. The Beginner visibility shows only basic nodes and the
Guru visibility shows full XML tree.
The visibility is controlled by the “ENeptuneNodeVisibility” as defined below.

enum ENeptuneNodeVisibility
{
NEPTUNE_NODE_VISIBLE_UNKNOWN = -1,
NEPTUNE_NODE_VISIBLE_BEGINNER = 0, // beginner
NEPTUNE_NODE_VISIBLE_EXPERT = 1, // expert
NEPTUNE_NODE_VISIBLE_GURU = 2 // guru
};

Example
// get XML tree visibility
ENeptuneNodeVisibility eVisibility;
ntcGetNodeVisibility(hCamHandle, &eVisibility);

See Also
ntcSetNodeVisibility

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 151

4.16.2 ntcSetNodeVisibility

Description
Set visibility of XML tree.

Definition
ENeptuneError ntcSetNodeVisibility(NeptuneCamHandle hCamHandle,
ENeptuneNodeVisibility eVisibility)

Parameters
[IN] hCamHandle : camera handle
[IN] eVisibility : XML tree visibility

Remark
This API function is used to control the number of XML tree nodes to be shown.

Example
// set XML tree visibility
ntcSetNodeVisibility(hCamHandle, NEPTUNE_NODE_VISIBLE_GURU);

See Also
ntcGetNodeVisibility

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 152

4.16.3 ntcGetNodeList

Description
Get child nodes of a given node.

Definition
ENeptuneError ntcGetNodeList(NeptuneCamHandle hCamHandle,
const _char_t* pstrCategory,
PNEPTUNE_XML_NODE_LIST pList)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrCategory : parent node
[OUT] pList : child node list

Remark
This API function returns list of child nodes below the given node. If a node doesn’t have any child, the
API returns the structure with “nCount” element as 0.
The list is passed as “NEPTUNE_XML_NODE_LIST” structure defined as below.

struct NEPTUNE_XML_NODE_LIST
{
// number of nodes
_uint32_t nCount;
// XML node list
_char_t pstrList[MAX_NODE_LIST_LENGTH][MAX_STRING_LENGTH];
};
typedef NEPTUNE_XML_NODE_LIST* PNEPTUNE_XML_NODE_LIST;

Example
NEPTUNE_XML_NODE_LIST NodeList;

ntcGetNodeList(hCamHandle, &NodeList);
for ( int i = 0; i < NodeList.nCount; i++ )
NodeList.pstrList[i]; // XML node

See Also
ntcGetNodeInfo

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 153

4.16.4 ntcGetNodeInfo

Description
Get information of a XML tree node.

Definition
ENeptuneError ntcGetNodeInfo(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode,
PNEPTUNE_XML_NODE_INFO pInfo)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : node name
[OUT] pInfo : node information

Remark
The API uses “NEPTUNE_XML_NODE_INFO” structure which includes node type, access mode, visibility
and textual information.

struct NEPTUNE_XML_NODE_INFO
{
// node type(int, float, boolean, string, enumeration, command)
ENeptuneNodeType Type;
// access mode
ENeptuneNodeAccessMode AccessMode;
// node visibility
ENeptuneNodeVisibility Visibility;
// has child ?
_bool8_t bHasChild;
// node name
_char_t strDisplayName[MAX_STRING_LENGTH];
// node tooltip
_char_t strTooltip[MAX_STRING_LENGTH];
// node description
_char_t strDescription[MAX_STRING_LENGTH];
};
typedef NEPTUNE_XML_NODE_INFO* PNEPTUNE_XML_NODE_INFO;

There are integer, float, Boolean, string, enumeration and command types in XML node tree and
appropriate function should be used according the the node type. Node type and access mode
supported by the API is defined as below.

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 154

enum ENeptuneNodeType
{
NEPTUNE_NODE_TYPE_UKNOWN = -1,
NEPTUNE_NODE_TYPE_CATEGORY = 0,
NEPTUNE_NODE_TYPE_COMMAND, // command type node
NEPTUNE_NODE_TYPE_RAW, // raw node
NEPTUNE_NODE_TYPE_STRING, // string node
NEPTUNE_NODE_TYPE_ENUM, // enumeration node
NEPTUNE_NODE_TYPE_INT, // int type node
NEPTUNE_NODE_TYPE_FLOAT, // float type node
NEPTUNE_NODE_TYPE_BOOLEAN // boolean type node
};

enum ENeptuneNodeAccessMode
{
NEPTUNE_NODE_ACCESSMODE_NI = 0, // Not Implemented
NEPTUNE_NODE_ACCESSMODE_NA = 1, // Not Available
NEPTUNE_NODE_ACCESSMODE_WO = 2, // Write Only
NEPTUNE_NODE_ACCESSMODE_RO = 3, // Read Only
NEPTUNE_NODE_ACCESSMODE_RW = 4, // Read, Write
NEPTUNE_NODE_ACCESSMODE_UNDEFINED = 5 // undefined
};

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “PixelFormat”, &NodeInfo) == NEPTUNE_ERR_Success )


{
NodeInfo.Type; // node type
NodeInfo.AccessMode; // node access mode
NodeInfo.Visibility; // node visibility
NodeInfo.bHasChild; // node has child
NodeInfo.strDisplayName; // node display name
NodeInfo.strTooltip; // node tooltip
NodeInfo.strDescription; // node description
}

See Also

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 155

4.16.5 ntcGetNodeInt

Description
Get information of integer type XML node.

Definition
ENeptuneError ntcGetNodeInt(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode,
PNEPTUNE_XML_INT_VALUE_INFO pValueInfo)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[OUT] pValueInfo : node information

Remark
This function is used to get the information when type of a node is “integer”. The information structure
is defined as below.

struct NEPTUNE_XML_INT_VALUE_INFO {
_int64_t nValue; // current value
_int64_t nMin; // minimum value supported
_int64_t nMax; // maximum value supported
_int64_t nInc; // increment step
ENeptuneNodeAccessMode AccessMode; // access mode
};
typedef NEPTUNE_XML_INT_VALUE_INFO* PNEPTUNE_XML_INT_VALUE_INFO;

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “Width”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_INT )
{
NEPTUNE_XML_INT_VALUE_INFO ValueInfo;
if ( ntcGetNodeInt(hCamHandle, “Width”, &ValueInfo) == NEPTUNE_ERR_Success )
{
ValueInfo.nValue; // current value
ValueInfo.nMin; // minimum value supported
ValueInfo.nMax; // maximum value supported

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 156

ValueInfo.nInc; // increment value


ValueInfo.AccessMode; // node access mode
}
}
}

See Also
ntcGetNodeInfo, ntcSetNodeInt

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 157

4.16.6 ntcSetNodeInt

Description
Set value to an integer type XML node.

Definition
ENeptuneError ntcSetNodeInt(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, _int64_t nValue)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[IN] nValue : value

Remark
This function is use to set value to an integer type XML node.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “Width”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_INT )
{
ntcSetNodeInt(hCamHandle, “Width”, 320);
}
}

See Also
ntcGetNodeInfo, ntcGetNodeInt

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 158

4.16.7 ntcGetNodeFloat

Description
Get information of float type XML node.

Definition
ENeptuneError ntcGetNodeFloat(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode,
PNEPTUNE_XML_FLOAT_VALUE_INFO pValueInfo)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[OUT] pValueInfo : node 정보

Remark
This function is used to get the information when type of a node is “float”. The information structure is
defined as below.

struct NEPTUNE_XML_FLOAT_VALUE_INFO {
_double_t dValue; // current value
_double_t dMin; // minimum
_double_t dMax; // maximum
_double_t dInc; // increment
ENeptuneNodeAccessMode AccessMode;
};
typedef NEPTUNE_XML_FLOAT_VALUE_INFO* PNEPTUNE_XML_FLOAT_VALUE_INFO;

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “AcquisitionFrameRateAbs”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_FLOAT )
{
NEPTUNE_XML_FLOAT_VALUE_INFO ValueInfo;
if ( ntcGetNodeFloat(hCamHandle, “AcquisitionFrameRateAbs”, &ValueInfo)
== NEPTUNE_ERR_Success )
{
ValueInfo.dValue; // current value
ValueInfo.dMin; // minimum value supported

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 159

ValueInfo.dMax; // maximum value supported


ValueInfo.dInc; // increment value
ValueInfo.AccessMode; // node access mode
}
}
}

See Also
ntcGetNodeInfo, ntcSetNodeFloat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 160

4.16.8 ntcSetNodeFloat

Description
Set value to an float type XML node.

Definition
ENeptuneError ntcSetNodeFloat(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, _double_t dValue)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[IN] dValue : node value

Remark
This function is use to set value to a float type XML node.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “AcquisitionFrameRateAbs”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_FLOAT )
{
ntcSetNodeFloat(hCamHandle, “AcquisitionFrameRateAbs”, 30.0);
}
}

See Also
ntcGetNodeInfo, ntcGetNodeFloat

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 161

4.16.9 ntcGetNodeEnum

Description
Get information of enumeation type XML node.

Definition
ENeptuneError ntcGetNodeEnum(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode,
PNEPTUNE_XML_ENUM_LIST pList)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[OUT] pList : node information

Remark
This function is used to get the information when type of a node is “enumeration”. The information
structure is defined as below.

struct NEPTUNE_XML_ENUM_LIST
{
// number of enumeration node string
_uint32_t nCount;
// enumeration node string list
_char_t pstrList[MAX_LIST_LENGTH][MAX_STRING_LENGTH];
// current index of the string list
_uint32_t nIndex;
};
typedef NEPTUNE_XML_ENUM_LIST* PNEPTUNE_XML_ENUM_LIST;

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “PixelFormat”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_ENUM)
{
NEPTUNE_XML_ENUM_LIST NodeList;
if ( ntcGetNodeEnum(hCamHandle, “PixelFormat”, &NodeList)
== NEPTUNE_ERR_Success )
{
for ( int i = 0; i < NodeList.nCount; i++ )

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 162

{
// enumeration value
NodeList.pstrList[i];
}
NodeList.nIndex; // current value
}
}
}

See Also
ntcGetNodeInfo, ntcSetNodeEnum

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 163

4.16.10 ntcSetNodeEnum

Description
Set value to an enumeration type XML node.

Definition
ENeptuneError ntcSetNodeEnum(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, const _char_t* pstrEnum)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[IN] pstrEnum : node value

Remark
This function is use to set value to an enumeration type XML node. The enumeration value must be the
one returned from the “ntcGetNodeEnum” function.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “PixelFormat”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_ENUM)
{
ntcSetNodeEnum(hCamHandle, “Pixel”, “Mono8”);
}
}

See Also
ntcGetNodeInfo, ntcGetNodeEnum

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 164

4.16.11 ntcGetNodeString

Description
Get information of string type XML node.

Definition
ENeptuneError ntcGetNodeString(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode,
_char_t* pstrString, _uint32_t* pnSize,
ENeptuneNodeAccessMode* peAccessMode)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[OUT] pstrString : node value
[IN/OUT] pnSize : size of buffer
[OUT] peAccessMode : node access mode

Remark
This function is used to get the information when type of a node is “string”.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “DeviceUserID”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_STRING )
{
_char_t str[256];
_uint32_t nSize = 256;
ENeptuneNnodeAccessMode eMode;
ntcGetNodeString(hCamHandle, “DeviceUserID”, str, &nSize, &eMode);
}
}

See Also
ntcGetNodeInfo, ntcSetNodeStrnig

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 165

4.16.12 ntcSetNodeString

Description
Set value to an string type XML node.

Definition
ENeptuneError ntcSetNodeString(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, const _char_t* pstrString)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[IN] pstrString : node value

Remark
This function is use to set value to a string type XML node.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “DeviceUserID”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_STRING )
{
ntcSetNodeString(hCamHandle, “DeviceUserID”, “CAM1”);
}
}

See Also
ntcGetNodeInfo, ntcGetNodeString

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 166

4.16.13 ntcGetNodeBoolean

Description
Get information of boolean type XML node.

Definition
ENeptuneError ntcGetNodeBoolean(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, ENeptuneBoolean *peState)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[OUT] peState : node value

Remark
This function is used to get the information when type of a node is “boolean”.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “LUTEnable”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_BOOLEAN)
{
ENeptuneBoolean eState;
ntcGetNodeBoolean(hCamHandle, “LUTEnable”, &eState);
}
}

See Also
ntcGetNodeInfo, ntcSetNodeBoolean

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 167

4.16.14 ntcSetNodeBoolean

Description
Set value to an boolean type XML node.

Definition
ENeptuneError ntcSetNodeBoolean(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode, ENeptuneBoolean eState)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node
[IN] eState : node value

Remark
This function is use to set value to a boolean type XML node.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “LUTEnable”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_BOOLEAN )
{
ntcSetNodeBoolean(hCamHandle, “LUTEnable”, NEPTUNE_BOOL_TRUE);
}
}

See Also
ntcGetNodeInfo, ntcGetNodeBoolean

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 168

4.16.15 ntcSetNodeCommand

Description
Make command node to execute.

Definition
ENeptuneError ntcSetNodeCommand(NeptuneCamHandle hCamHandle,
const _char_t* pstrNode)

Parameters
[IN] hCamHandle : camera handle
[IN] pstrNode : XML node

Remark
This function is use to execute command type XML node.

Example
NEPTUNE_XML_NODE_INFO NodeInfo;

if ( ntcGetNodeInfo(hCamHandle, “TriggerSoftware”, &NodeInfo) == NEPTUNE_ERR_Success )


{
if ( NodeInfo.Type == NEPTUNE_NODE_TYPE_COMMAND )
{
ntcSetNodeCommand(hCamHandle, “TriggerSoftware”);
}
}

See Also
ntcGetNodeInfo

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g
NeptuneC API Manual – V5.0.0.0 Page 169

5. Revision History
5.1 Changes from previous version (1.0.0.0)
- 4.6.1 ntcGetFeature is changed(Contrast feature is added).
- 4.6.2 ntcSetFeature is changed(Contrast feature is added).
- 4.6.4 ntcGetAutoAreaControl is newly added.
- 4.6.5 ntcSetAutoAreaControl is newly added.
- 4.6.6 ntcSetAFControl is newly added.

5.2 Changes from previous version (1.0.1.0)


- 4.7.10 ntcSetTriggerMode14Exposure is newly added.
- 4.6.7 ntcSaveCameraParameter is newly added.
- 4.6.8 ntcLoadCameraParameter is newly added.

5.3 Changes from previous version (1.0.2.0)


- USB3 camera is newly supported.
- ENeptuneDevType enumeration has changed(USB3 value is added).

5.4 Changes from previous version (2.0.0.0)


- NEPTUNE_IMAGE structure is changed
- 4.3.7 ntcSetPacketResend is newly added.
- 4.5.21 ntcRecvDroppedFrame is newly added.
- 4.5.22 ntcSetRotation is newly added.
- 4.7.11 ntcSetUSBTriggerBufferCount is newly added.

5.5 Changes from previous version (2.0.1.0)


- 322UC control method is newly added. (ntcSetNTSCPALSelector, ntcGetNTSCPALSelector,
ntcSetAcquisitionFrameRateSel, ntcGetAcquisitionFrameRateSel, ntcGetAcquisitionFrameRateList,
ntcSetResolutionSelector, ntcGetResolutionSelector, ntcGetResolutionList,
ntcSetDayNightModeSelector, ntcGetDayNightModeSelector)

T h e F i r s t Cl a s s of D i gi ta l Im a gi n g

You might also like