SK91USB3-WIN  5.5.0
Functions
Thresholding

Background and explanations about the Threshold Mode. More...

Functions

int SK_GRABTHRESHOLDMODE (int CamID, unsigned short *pData, size_t lines, int subpixel, int noisesuppress, size_t iTimeOutMs, BOOL NoWait, int FrameSync, int LineSyncMode)
 Grabbing in Threshold operating mode. More...
 
int SK_GRABTHRESHOLDCONTINUOUS (int CamID, int iLinesPerBlock, int nMaxTransitions, int subpixel, int noisesuppress, bool FrameSync, int LineSyncMode)
 Continuous grabbing in Threshold operating mode. More...
 
int SK_GETTRANSITIONS (int CamID, unsigned short **pTransitions, size_t *nTransitions, size_t timeoutMS)
 Returns the pointer to currently filled buffer. More...
 
int SK_SETTHRESHOLDMODE (int CamID, int ON, int subPixel)
 Activates and deactivates the Threshold operating mode. More...
 
int SK_GETTHRESHOLDSUBPIXELFACTOR (int CamID)
 Returns the subpixel factor in threshold operating mode. More...
 
int SK_SETTHRESHOLDLEVEL (int CamID, int Threshold)
 Set the threshold level. More...
 
int SK_GETTHRESHOLDLEVEL (int CamID)
 Returns the current threshold level of the camera. More...
 
int SK_SETTHRESHOLDNOISEFILTER (int CamID, int nFilter)
 Set a filter for noise reduction in thresholding. More...
 
int SK_GETTHRESHOLDNOISEFILTER (int CamID)
 Get the status for the filter for noise reduction. More...
 
int SK_GETNROFTRANSITIONS (int CamID)
 Returns the number of transitions of the camera. More...
 

Detailed Description

Background and explanations about the Threshold Mode.

The Threshold operating mode is an pre-processing inside the line scan camera. It is an alternative operating mode to the acquistion of grayscaled images. The result of a grab is an array of pixel addresses of the transitions at a programmable intensity threshold. The calculation of distances between the transitions is possible by masking and subtraction the data very simple and efficient. The Threshold operating mode is predestined for edge tracking, position check, measuring of object width, diameters, gap width, or particle counting. Useful parameters for Thresholding are the noise suppression to ignore very small transition spikes, and sub-pixel mode for increasing the resolution of transition positions.

Data format without subpixel: Format: 16 bit word Bit 0...13: 14 bit pixel address of a transition or of the line end Bit 14: 0= transition from High to Low 1= transition from Low to High Bit 15: 1= end of line code (e.g. 0x8000 = eol)

Data format with subpixel (sensors up to 2048 pixel): Format: 16 bit word Bit 0...2: 3 bit subpixel resolution Bit 3...13: 11 bit pixel address of a transition (limited up to 2048 pixels) Bit 14: 0= transition from High to Low 1= transition from Low to High Bit 15: 1= end of line code

Data format with subpixel (sensors > 2048 pixel): Format: 32 bit unsigned integer Lower word: Bit 0...7: 8 bit subpixel resolution Upper word: Bit 15...29: 14 bit pixel address of a transition Bit 30: 0= transition from High to Low 1= transition from Low to High Bit 31: 1= end of line code

The alignment is lower word – upper word.

Function Documentation

◆ SK_GETNROFTRANSITIONS()

int SK_GETNROFTRANSITIONS ( int  CamID)

Returns the number of transitions of the camera.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
number of transitions, else see Error Code Table

◆ SK_GETTHRESHOLDLEVEL()

int SK_GETTHRESHOLDLEVEL ( int  CamID)

Returns the current threshold level of the camera.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_GETTHRESHOLDNOISEFILTER()

int SK_GETTHRESHOLDNOISEFILTER ( int  CamID)

Get the status for the filter for noise reduction.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
0 = not active
1 = active
else see Error Code Table

◆ SK_GETTHRESHOLDSUBPIXELFACTOR()

int SK_GETTHRESHOLDSUBPIXELFACTOR ( int  CamID)

Returns the subpixel factor in threshold operating mode.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_GETTRANSITIONS()

int SK_GETTRANSITIONS ( int  CamID,
unsigned short **  pTransitions,
size_t *  nTransitions,
size_t  timeoutMS 
)

Returns the pointer to currently filled buffer.

This function gives access to current array of transitions, which were written in a buffer of the queue.

Since
camera revision 1.22 / 2.22
Remarks
After result SK_RESULT_IMAGE_COMPLETED the pointer to the last grabbed buffer is stored in pTransitions.
See also
SK_GRABTHRESHOLDCONTINUOUS
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
pTransitionspointer to pointer of the buffer with last filled buffer
nTransitionsnumber of transisitons
timeoutMStimeout in milliseconds
Returns
SK_RESULT_OPERATION_PENDING means camera is busy
SK_RESULT_IMAGE_COMPLETED means image is ready
else see Error Code Table

◆ SK_GRABTHRESHOLDCONTINUOUS()

int SK_GRABTHRESHOLDCONTINUOUS ( int  CamID,
int  iLinesPerBlock,
int  nMaxTransitions,
int  subpixel,
int  noisesuppress,
bool  FrameSync,
int  LineSyncMode 
)

Continuous grabbing in Threshold operating mode.

Activates Threshold operating mode and starts the continuous grabbing of transitions in into an internal buffer queue

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
iLinesPerBlockit is the base for internal calculation of the buffer queue size
nMaxTransitionsdata transfer limit per block
subpixelprovides a higher resolution of transition positions
noisesuppressignores very smal transition spikes
FrameSync-1 = no change,
1 = wait for FrameSync trigger,
0 = FrameSync trigger off
LineSyncMode-1 = no change,
0 = Free Run,
1 = Line Start,
4 = Exporsure Start,
5 = Exposure Control
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_GRABTHRESHOLDMODE()

int SK_GRABTHRESHOLDMODE ( int  CamID,
unsigned short *  pData,
size_t  lines,
int  subpixel,
int  noisesuppress,
size_t  iTimeOutMs,
BOOL  NoWait,
int  FrameSync,
int  LineSyncMode 
)

Grabbing in Threshold operating mode.

The camera outputs an array of pixel addresses of High-Low and Low-High transitions

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
pDataDestination buffer to write grabbed image into
linesnumber of lines, it is also used for internal calculation of memory size
subpixelprovides a higher resolution of transition positions
noisesuppressignores very smal transition spikes
iTimeOutMstime in milliseconds (ms) to wait before the function returns, only valid if NoWait= FALSE
NoWaittrue = function returns immediately, useful for asynchonuous image acquistion
false = function blocks until image is ready
FrameSync-1 = no change,
1 = wait for FrameSync trigger,
0 = FrameSync trigger off
LineSyncMode-1 = no change,
0 = Free Run,
1 = Line Start,
4 = Exporsure Start,
5 = Exposure Control
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_SETTHRESHOLDLEVEL()

int SK_SETTHRESHOLDLEVEL ( int  CamID,
int  Threshold 
)

Set the threshold level.

This function sets the intensity value, which determines a transition from Low to High, or from High to Low. Inside the camera works with an 8 bit resolution of this level. The level step size at 12 bit ADC resolution is 16.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Thresholdthreshold level, range of
8 bit = 0 ... 255
10 bit = 0 ... 1023
12 bit = 0 ... 4095
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_SETTHRESHOLDMODE()

int SK_SETTHRESHOLDMODE ( int  CamID,
int  ON,
int  subPixel 
)

Activates and deactivates the Threshold operating mode.

Since
camera revision 1.22 / 2.22
Note
This function can be called before the continuous grabbing in threshold operating mode. If it was not called, the activation will be done inside the SK_GRABTHRESHOLDCONTINUOUS function. For finishing the threshold operating mode call this function with ON = false. The grayscale operating mode is active with the bitdepth like before activation of Thresholding. The changing the operating modes is also possible by SK_SETBITDEPTH.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
ON1 = threshold operating mode is activated
0 = threshold operating mode is deactivated
subPixeltrue = transitions with subpixel resolution
false = transitions with integer subpixel resolution
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_SETTHRESHOLDNOISEFILTER()

int SK_SETTHRESHOLDNOISEFILTER ( int  CamID,
int  nFilter 
)

Set a filter for noise reduction in thresholding.

Since
camera revision 1.22 / 2.22
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
nFilter0 = off
1 = on
Returns
SK_RESULT_OK on success, else see Error Code Table