SK91USB3-WIN  5.5.0
Functions
Window Function (ROI)

Definition a Region of Interest on the sensor using the Window Function. More...

Functions

int SK_SETWINDOW (int CamID, int xStart, int width)
 Defines a Region of Interest (ROI) More...
 
void SK_ADJWIN (int CamID, unsigned char *pDest, unsigned char *pSrc, BOOL compress)
 Shifts the ROI to correct pixel address. More...
 
int SK_GETWINSTART (int CamID)
 Returns the start pixel of the window. More...
 
int SK_GETWINSTARTFROMCAMERA (int CamID)
 Returns the start pixel of the window direct from camera. More...
 
int SK_GETWINSIZE (int CamID)
 Returns the size of the window (roi) in pixel. More...
 
int SK_GETWINSIZEFROMCAMERA (int CamID)
 Returns the size of the window (roi) in pixel direct from camera. More...
 

Detailed Description

Definition a Region of Interest on the sensor using the Window Function.

Function Documentation

◆ SK_ADJWIN()

void SK_ADJWIN ( int  CamID,
unsigned char *  pDest,
unsigned char *  pSrc,
BOOL  compress 
)

Shifts the ROI to correct pixel address.

This function shifts a ROI to the pixel address of xStart (from function SK_SETWINDOW) in a line. The left and right ranges outside the ROI will be filled by 0.

Example for adjusting the window:

// initialize the camera, allocate the memory, etc.
// allocate memory for the adjusted line
unsigned char * lineAdjusted = new unsigned char[SK_GETPIXELSPERLINE(m_CamID)];
// set the new window with start pixel 512 and a window size of 512 pixels, note the multiply by 3 for RGB cameras
SK_SETWINDOW(m_CamID, 512, 512);
// Grab an 1 line with 2s timeout, wait until image is ready, no frame sync
SK_GRAB(m_CamID, m_pData, 1, 2000, false, 0, SK_FREERUN);
// adjust the window to be synchronous with the start pixel and the size of the window
SK_ADJWIN(m_CamID, lineAdjusted, m_pData, false);
Note
Size of destination buffer is determined by the sensor length
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
pDestdestination buffer for the shifted ROI
pSrcsource buffer of the windowed line scan signal
compresstrue = left bounding
false = synchronous to pixel
Returns
SK_RESULT_OK on success, else see Error Code Table

◆ SK_GETWINSIZE()

int SK_GETWINSIZE ( int  CamID)

Returns the size of the window (roi) in pixel.

Note
For color line scan cameras the size is multiplied by 3.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
size of window in pixel, else see Error Code Table

◆ SK_GETWINSIZEFROMCAMERA()

int SK_GETWINSIZEFROMCAMERA ( int  CamID)

Returns the size of the window (roi) in pixel direct from camera.

Note
For color line scan cameras the size is multiplied by 3.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
size of window in pixel, else see Error Code Table

◆ SK_GETWINSTART()

int SK_GETWINSTART ( int  CamID)

Returns the start pixel of the window.

Note
For color line scan cameras the size is multiplied by 3.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
start pixel of window, else see Error Code Table

◆ SK_GETWINSTARTFROMCAMERA()

int SK_GETWINSTARTFROMCAMERA ( int  CamID)

Returns the start pixel of the window direct from camera.

Note
For color line scan cameras the size is multiplied by 3.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
Returns
start pixel of window, else see Error Code Table

◆ SK_SETWINDOW()

int SK_SETWINDOW ( int  CamID,
int  xStart,
int  width 
)

Defines a Region of Interest (ROI)

How to set windows (using SK2048U3PD):

// initialize the camera, allocate the memory, etc.
// set the new window with start pixel 512 and a window size of 512 pixels
SK_SETWINDOW(m_CamID, 512, 512);
// reset the window to full size
SK_SETWINDOW(m_CamID, 0, SK_GETPIXELSPERLINE(m_CamID));

How to set windows (using SK6288U3KOC):

// initialize the camera, allocate the memory, etc.
// set the new window with start pixel 512 and a window size of 512 pixels, note the multiply by 3 for RGB cameras
SK_SETWINDOW(m_CamID, 3 * 512, 3 * 512);
// reset the window to full size
SK_SETWINDOW(m_CamID, 0, SK_GETPIXELSPERLINE(m_CamID));
Remarks
The parameter width determines the number of pixels per line. The data will be stored left-aligned in the image buffer.
Note
For color line scan cameras the size is multiplied by 3.
Parameters
CamIDid of camera from 0 ... n - 1, 0 = 1st camera
xStartstart address of the ROI (divisible by 8)
widthwidth of ROI (divisible by 8)
Returns
SK_RESULT_OK on success, else see Error Code Table