![]() |
SK91USB3-LX
1.2.0
|
Describes how to create images. More...
Functions | |
int | SK_MAKE_BITMAP (int CamID, unsigned char *pSource, int bitdepth, int pixel, int lines, bool newBitmap, bool copyData, double brightness, int yMin, int yMax) |
Creates an internal bitmap, converts the camera raw data to this bitmap, and prepares it for display and saving. More... | |
int | SK_GET_BITMAPINFO (int CamID, int *width, int *height, int *bitsPerPixel, unsigned char **pImageData) |
Returns the information about the current used bitmap, which was created with SK_MAKE_BITMAP. More... | |
int | SK_SAVE_IMAGE (int CamID, const char *fileName) |
Saves the image, which was created by SK_MAKE_BITMAP. More... | |
int | SK_READ_IMAGE (int CamID, const char *fileName) |
Loading an image from a file. More... | |
int | SK_LINESPACECORRECTION (int CamID, unsigned char *pDestination, unsigned char *pSource, int bitdepth, int iPixel, int iLines, double factor, int direction) |
Corrects the line spacing between RGB distances of camera raw data. More... | |
int | SK_SEPARATECOLORS (int CamID, void *pRed, void *pGreen, void *pBlue, void *pSource, int bitdepth, int pixelsAtLine, int iLines) |
Splits the RGB signal of the color line scan camera in three different buffers. More... | |
Describes how to create images.
This module contains various functions for creation, display, saving and loading of images from camera raw data. The function SK_MAKE_BITMAP converts the raw data to a bitmap format, and prepares it for display and saving. The function SK_GET_BITMAPINFO returns information about the bitmap, like dimension, bit depth, and the pointer to bitmap data. The storing of a bitmap is possible with SK_SAVE_IMAGE, SK_READ_IMAGE loads a bitmap from file into an internal bitmap buffer for display.
In the following subsection is the creation and saving of an gray scaled image described.
Color line scan cameras with triple line sensor have three different sensor lines for red (R), green (G) and blue (B). Between the sensor lines exists a gap, called line spacing (details are described in the camera manual). The line spacing is sensor specific and, between two color lines, it can be 1 up to 9 times the pixel height. For the correct color mixing in a image the different locations of R, G, and B have to be considered.
This is be done by the function SK_LINESPACECORRECTION. The source data must be the unchanged camera raw data. The result are RGB triple with corrected line spacing, which may be the input for SK_MAKE_BITMAP. Notes:
The extracting of a single color from a RGB color image is possible with SK_SEPARATECOLORS.
The function SK_SEPARATECOLORS splits the red, green, and blue part from a color image or from a single line in separate memories:
int SK_GET_BITMAPINFO | ( | int | CamID, |
int * | width, | ||
int * | height, | ||
int * | bitsPerPixel, | ||
unsigned char ** | pImageData | ||
) |
Returns the information about the current used bitmap, which was created with SK_MAKE_BITMAP.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera | |
[out] | width | pointer for the width of the bitmap |
[out] | height | pointer for the height of the bitmap |
[out] | bitsPerPixel | pointer for the bits per pixel / bit depth of the bitmap |
[out] | pImageData | pointer for the image data of the bitmap |
int SK_LINESPACECORRECTION | ( | int | CamID, |
unsigned char * | pDestination, | ||
unsigned char * | pSource, | ||
int | bitdepth, | ||
int | iPixel, | ||
int | iLines, | ||
double | factor, | ||
int | direction | ||
) |
Corrects the line spacing between RGB distances of camera raw data.
Triple line color cameras have a Line Spacing between R, G, and B sensor line from 1 up to 9 times the pixel height. This function corrects the RGB distances in a grabbed image. The result is a RGB matched data matrix in the destination buffer. Furthermore the wrong transport direction can be corrected.
Between the sensor lines exists a gap, called line spacing (details are described in the camera manual). The line spacing is sensor specific and, between two color lines, it can be 1 up to 9 times the pixel height. For the correct color mixing in a image the different locations of R, G, and B have to be considered.
This is be done by the function SK_LINESPACECORRECTION. The source data must be the unchanged camera raw data. The result are RGB triple with corrected line spacing, which may be the input for SK_MAKE_BITMAP. Notes:
Example for using this function: Create Color Images
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
pDestination | destination buffer |
pSource | source data array, must be unchanged raw data |
bitdepth | bit depth of source data (e.g. 8 or 12 bit) |
iPixel | number of pixels per line |
iLines | number of lines |
factor | factor for modify the default line spacing, usable in case of wrong transport velocity, default = 1.0 |
direction | 0= scan in preferably direction else against this |
int SK_MAKE_BITMAP | ( | int | CamID, |
unsigned char * | pSource, | ||
int | bitdepth, | ||
int | pixel, | ||
int | lines, | ||
bool | newBitmap, | ||
bool | copyData, | ||
double | brightness, | ||
int | yMin, | ||
int | yMax | ||
) |
Creates an internal bitmap, converts the camera raw data to this bitmap, and prepares it for display and saving.
With the input parameter brightness
, it is possible to down or upscale the intensities of the image. A brightness
of 0 (zero) generates a black image!
Normally, the input parameters yMin
and yMax
are from 0 to 255 (8 bit) or 4095 (12 bit). But it is possible to use these parameters for a manual histogram stretching.
For example: If yMin
is set to 70 and yMax
to 128, then the functions spreads the intensities which have normally a range from 58 stages, to 255 stages.
Example for creating grey scaled image: Create and save a grayscale image
Example for creating color image: Create Color Images
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
pSource | pointer to camera raw data |
bitdepth | ADC resolution, valid values: 8 or 12 |
pixel | number of pixel, image width |
lines | number of lines, image height |
newBitmap | true = creates new bitmap false = using of existing bitmap structure (lines, pixel, color space), image data will be refreshed |
copyData | true = only for monochrome cameras, the raw data will be copied directly into the bitmap, the result is a grayscale image false = must be set for color camera, the raw data will be sorted to a bitmap compliant alignment, the result is a color image |
brightness | brigthness factor, which the intensity is multiplied, default= 1.0, > 1.0 image is brighter, < 1.0 image is darker |
yMin | the intensity range between yMin and yMax will be scaled by a linear spreading to full grayscale range, which depends on the ADC resolution, yMin: default 0, maximum yMax-1 |
yMax | upper intensity for spreading, at 8 bit: maximum 255, at 12 bit: maximum 4095. Values for yMin > 0 and yMax < maximum increase the contrast of the image. |
GV::instance()->m_pCam[CamID]->privat[sk_bytesPerPixel]
int SK_READ_IMAGE | ( | int | CamID, |
const char * | fileName | ||
) |
Loading an image from a file.
Example for loading gray scaled image: Load an image from a file
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
fileName | file name |
int SK_SAVE_IMAGE | ( | int | CamID, |
const char * | fileName | ||
) |
Saves the image, which was created by SK_MAKE_BITMAP.
Example for saving gray scaled image: Create and save a grayscale image
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
fileName | file name |
int SK_SEPARATECOLORS | ( | int | CamID, |
void * | pRed, | ||
void * | pGreen, | ||
void * | pBlue, | ||
void * | pSource, | ||
int | bitdepth, | ||
int | pixelsAtLine, | ||
int | iLines | ||
) |
Splits the RGB signal of the color line scan camera in three different buffers.
Example for using this function: Color splitting
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
pRed | pointer to pointer of red result array |
pGreen | pointer to pointer of green result array |
pBlue | pointer to pointer of blue result array |
pSource | pointer to source data |
bitdepth | bit depth of the source data, valid values 8 or 12 bit |
pixelsAtLine | all pixels per line |
iLines | number of lines for separation |