SR Research Support Site
Functions
Calibration Camera Image Presentation Example

Functions

INT16 setup_image_display (INT16 width, INT16 height)
 
void exit_image_display (void)
 
void image_title (INT16 threshold, char *title)
 
void set_image_palette (INT16 ncolors, byte r[], byte g[], byte b[])
 
void draw_image_line (INT16 width, INT16 line, INT16 totlines, byte *pixels)
 

Detailed Description

Function Documentation

void draw_image_line ( INT16  width,
INT16  line,
INT16  totlines,
byte *  pixels 
)

This function is called to supply the image line by line from top to bottom.

Parameters
widthwidth of the picture. Essentially, number of bytes in pixels.
linecurrent line of the image
totlinestotal number of lines in the image. This will always equal the height of the image.
pixelspixel data.

Eg. Say we want to extract pixel at position (20,20) and print it out as rgb values.

1 if(line == 19) // y = 20
2  {
3  byte pix = pixels[19];
4  // Note the r,g,b arrays come from the call to set_image_palette
5  printf("RGB %d %d %d\n",r[pix],g[pix],b[pix]);
6  }
Remarks
certain display draw the image up side down. eg. GDI.
void exit_image_display ( void  )

This is called to notify that all camera setup things are complete. Any resources that are allocated in setup_image_display can be released in this function.

void image_title ( INT16  threshold,
char *  title 
)

This function is called to update any image title change.

Parameters
thresholdif -1 the entire tile is in the title string otherwise, the threshold of the current image.
titleif threshold is -1, the title contains the whole title for the image. Otherwise only the camera name is given.
void set_image_palette ( INT16  ncolors,
byte  r[],
byte  g[],
byte  b[] 
)

This function is called after setup_image_display and before the first call to draw_image_line. This is responsible to setup the palettes to display the camera image.

Parameters
ncolorsnumber of colors in the palette.
rred component of rgb.
gblue component of rgb.
bgreen component of rgb.
INT16 setup_image_display ( INT16  width,
INT16  height 
)

This function is responsible for initializing any resources that are required for camera setup.

Parameters
widthwidth of the source image to expect.
heightheight of the source image to expect.
Returns
-1 if failed, 0 otherwise.

Copyright ©2002-2023, SR Research Ltd.