![]() |
SK91GigE-WIN
5.5.2
|
Additional functions to create and display images from raw data. More...
Functions | |
void | SK_DISPLAY_LINE (int CamID, HDC hDC, PUCHAR source, int n, RECT dwin, int fmin, int fmax, int pixWise) |
Plots an 8-bit line scan signal in an oscilloscopic style. More... | |
void | SK_DISPLAY_LINE12 (int CamID, HDC hDC, USHORT *source, int n, RECT dwin, int fmin, int fmax, int pixWise) |
Plots an 12-bit line scan signal in an oscilloscopic style. More... | |
void | SK_DISPLAY_TRANSITIONS (int CamID, HDC hDC, unsigned short *source, int p1, int n, RECT dwin, int high, int low) |
Displays a binary plots of a array of transitions. More... | |
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_DISPLAY_IMAGE (int CamID, HDC hDC, int widthOfView, int heightOfView, int x0, int y0, int pixel, int lines) |
Displays the last created bitmap with SK_MAKE_BITMAP. 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, LPCSTR fileName) |
Saves the image, which was created by SK_MAKE_BITMAP. More... | |
int | SK_READ_IMAGE (int CamID, LPCSTR fileName) |
Loading an image from a file. More... | |
int | SK_LINESPACECORRECTION (int CamID, PUCHAR pDestination, PUCHAR 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, PVOID pRed, PVOID pGreen, PVOID pBlue, PVOID pSource, int bitdepth, int pixelsAtLine, int iLines) |
Splits the RGB signal of the color line scan camera in three different buffers. More... | |
Additional functions to create and display images from raw data.
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 grayscale 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_DISPLAY_IMAGE | ( | int | CamID, |
HDC | hDC, | ||
int | widthOfView, | ||
int | heightOfView, | ||
int | x0, | ||
int | y0, | ||
int | pixel, | ||
int | lines | ||
) |
Displays the last created bitmap with SK_MAKE_BITMAP.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
hDC | device context of the drawing window |
widthOfView | width of the drawing window |
heightOfView | height of the drawing window |
x0 | start pixel on the x-axis of top left corner |
y0 | start pixel on the y-axis of top left corner |
pixel | number of pixel to display |
lines | number of lines to display |
void SK_DISPLAY_LINE | ( | int | CamID, |
HDC | hDC, | ||
PUCHAR | source, | ||
int | n, | ||
RECT | dwin, | ||
int | fmin, | ||
int | fmax, | ||
int | pixWise | ||
) |
Plots an 8-bit line scan signal in an oscilloscopic style.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
hDC | device context of the drawing window |
source | pointer to video data |
n | number of pixel per line |
dwin | drawing range inside of the hDC owner window |
fmin | scale minimum |
fmax | scale maximum |
pixWise | 1 = draw pixel intensity as bars (square) 0 = connect pixel intensities (round) |
void SK_DISPLAY_LINE12 | ( | int | CamID, |
HDC | hDC, | ||
USHORT * | source, | ||
int | n, | ||
RECT | dwin, | ||
int | fmin, | ||
int | fmax, | ||
int | pixWise | ||
) |
Plots an 12-bit line scan signal in an oscilloscopic style.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
hDC | device context of the drawing window |
source | pointer to video data (12 bit) |
n | number of pixel per line |
dwin | drawing range inside of the hDC owner window |
fmin | scale minimum |
fmax | scale maximum |
pixWise | 1 = draw pixel intensity as bars (square) 0 = connect pixel intensities (round) |
void SK_DISPLAY_TRANSITIONS | ( | int | CamID, |
HDC | hDC, | ||
unsigned short * | source, | ||
int | p1, | ||
int | n, | ||
RECT | dwin, | ||
int | high, | ||
int | low | ||
) |
Displays a binary plots of a array of transitions.
CamID | id of camera from 0 ... n - 1, 0 = 1st camera |
hDC | device context of the drawing window |
source | unsigned short pointer to transitions |
p1 | start pixel for display |
n | number of displayed pixel |
dwin | drawing range inside of the hDC owner window |
high | intensity for high level |
low | intensity for low level |
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 | width |
[out] | height | height |
[out] | bitsPerPixel | bits per pixel |
[out] | pImageData | pointer to the image data |
int SK_LINESPACECORRECTION | ( | int | CamID, |
PUCHAR | pDestination, | ||
PUCHAR | 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 |
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.
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 camrera 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 a new bitmap false = using of existing bitmap structure, the 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. |
int SK_READ_IMAGE | ( | int | CamID, |
LPCSTR | fileName | ||
) |
Loading an image from a file.
Example for loading grayscale 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, |
LPCSTR | fileName | ||
) |
Saves the image, which was created by SK_MAKE_BITMAP.
Example for saving grayscale 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, |
PVOID | pRed, | ||
PVOID | pGreen, | ||
PVOID | pBlue, | ||
PVOID | 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 |