Basler Logo

Basler Frame Grabber SDK: sisoIo.h File Reference

sisoIo.h File Reference

Functions to load and store image files. More...

#include "os_type.h"

Go to the source code of this file.

Defines

#define COMPRESSION_CCITT_T4   3
#define COMPRESSION_CCITT_T6   4
#define COMPRESSION_CCITTFAX3   3
#define COMPRESSION_CCITTFAX4   4
#define COMPRESSION_CCITTRLE   2
#define COMPRESSION_CCITTRLEW   32771
#define COMPRESSION_JPEG   7
#define COMPRESSION_LZW   5
#define COMPRESSION_NEXT   32766
#define COMPRESSION_NONE   1
#define COMPRESSION_OJPEG   6
#define COMPRESSION_PACKBITS   32773
#define COMPRESSION_THUNDERSCAN   32809
#define dlldir

Typedefs

typedef char * LPCWSTR
typedef void SisoIoImageEngine

Functions

dlldir int IoCloseAVI (void *AviRef)
dlldir int IoCloseBmp (void *bmpHandle)
dlldir int IoCloseSeq (void *SeqRef)
dlldir int IoConvert1BitTo8BitData (SisoIoImageEngine *handle)
 converts a bitmap in an 8 bit gray image. It normalizes the gray values.
dlldir int IoCreateAVIColor (void **AviRef, const char *filename, int width, int height, double fps)
dlldir int IoCreateAVIColorW (void **AviRef, const LPCWSTR filename, int width, int height, double fps)
dlldir int IoCreateAVIGray (void **AviRef, const char *filename, int width, int height, double fps)
dlldir int IoCreateAVIGrayW (void **AviRef, const LPCWSTR filename, int width, int height, double fps)
dlldir int IoCreateSeq (void **SeqRef, const char *pFilename, int width, int height, int bitdepth, int format)
dlldir int IoFreeImage (SisoIoImageEngine *handle)
dlldir int IoFreeRaw (unsigned char *data)
dlldir int IoFreeTiff (unsigned char *data)
 Release the memory resources of previously read image files.
dlldir int IoGetBitsPerComponent (const SisoIoImageEngine *handle)
dlldir int IoGetBitsPerPixel (const SisoIoImageEngine *handle)
dlldir int IoGetHeight (const SisoIoImageEngine *handle)
dlldir int IoGetNrOfComponents (const SisoIoImageEngine *handle)
dlldir int IoGetSeqInfo (void *SeqRef, int *nrOfImages, int *nrOfLostImages)
dlldir int IoGetWidth (const SisoIoImageEngine *handle)
dlldir const void * IoImageGetData (const SisoIoImageEngine *handle)
 query the pixel data from an image. The channel order for color images is BLUE GREEN RED.
dlldir int IoImageOpen (const char *filename, SisoIoImageEngine **handle)
 open an existing image file. The channel order for color images is BLUE GREEN RED. Supported file formats:

  • TIFF uncompressed, LZW, PackBits
    1. 1 Bit ( line width must be byte aligned )
      1. 8 Bit gray
      2. 16 Bit gray
      3. 24 Bit color
      4. 48 Bit color -BMP uncompressed
    2. 1 Bit ( line width must be byte aligned )
    3. 8 Bit gray
    4. 24 Bit color

dlldir int IoImageOpenEx (const char *filename, SisoIoImageEngine **handle, int RGBSequence)
 open an existing image file
dlldir int IoOpenAVI (void **AviRef, const char *fileName, int *width, int *height, int *bitDepth)
dlldir SisoIoImageEngineIoOpenImage (const char *filename)
 open an existing image file
dlldir SisoIoImageEngineIoOpenImageExt (const char *filename, unsigned char **data, int *width, int *height, int *bits)
 open an existing image file
dlldir int IoOpenSeq (void **SeqRef, const char *pFilename, int *width, int *height, int *bitdepth, int mode)
dlldir int IoReadAVIPicture (void *AviRef, int PicNr, unsigned char *buffer)
dlldir void * IoReadBmp (const char *filename, unsigned char **data, int *width, int *height, int *bits)
 Load data from a bitmap file to a memory buffer This functions loads the image data of a bitmap file to a memory buffer. The function allocates the memory buffer according to the detected image information inside the bitmap file and returns the pointer to the memory. In case of colored images, the ordering sequence of the color channels is BGR. Please note, that the image information inside the buffer is starting at the point ( X = 0, Y = 0), which means, that the data of the bitmap file is mirrored along a diagonal line compared to the bitmap format.
dlldir int IoReadNextSeqPicture (void *SeqRef, int *PicNr, unsigned char *buffer)
dlldir int IoReadRaw (const char *filename, unsigned char **data, int *width, int *height, int *bits)
dlldir int IoReadSeqPicture (void *SeqRef, int PicNr, unsigned char *buffer)
dlldir void * IoReadTiff (const char *filename, unsigned char **data, int *width, int *height, int *bitPerSample, int *samplePerPixel)
 Load a TIF file into a memory buffer.
dlldir void * IoReadTiffEx (const char *filename, unsigned char **data, int *width, int *height, int *bitPerSample, int *samplePerPixel, int RGBSequence)
 Load a TIF file into a memory buffer (enhanced version).
dlldir void * IoReadTiffExW (const LPCWSTR filename, unsigned char **data, int *width, int *height, int *bitPerSample, int *samplePerPixel, int RGBSequence)
 Load a TIF file into a memory buffer.
dlldir void * IoReadTiffW (const LPCWSTR filename, unsigned char **data, int *width, int *height, int *bitPerSample, int *samplePerPixel)
 Load a TIF file into a buffer,.
dlldir int IoSaveImageExt (const char *filename, unsigned char *data, int width, int height, int bits)
 save image to File. The channel order for color images is RED GREEN BLUE. Supported file formats:

  • TIFF uncompressed, LZW, PackBits
    1. 1 Bit ( line width must be byte aligned )
      1. 8 Bit gray
      2. 16 Bit gray
      3. 24 Bit color
      4. 48 Bit color -BMP uncompressed
    2. 1 Bit ( line width must be byte aligned )
    3. 8 Bit gray
    4. 24 Bit color

dlldir int IoSeqCreateAvi (void *SeqRef, const char *aviFilename, int StartPicNr, int StopPicNr)
dlldir int IoWriteAVIPicture (void *AviRef, int PicNr, unsigned char *buffer)
dlldir int IoWriteBmp (const char *filename, unsigned char *data, int width, int height, int bits)
dlldir int IoWriteBmpW (const LPCWSTR filename, unsigned char *data, int width, int height, int bits)
dlldir int IoWriteRaw (const char *filename, unsigned char *data, int width, int height, int bits)
dlldir int IoWriteRawW (const LPCWSTR filename, unsigned char *data, int width, int height, int bits)
dlldir int IoWriteSeqPicture (void *SeqRef, int PicNr, unsigned char *buffer)
dlldir int IoWriteTiff (const char *filename, unsigned char *data, int width, int height, int bitPerSample, int samplePerPixel)
 Save Image data to to a file in TIF format.
dlldir int IoWriteTiffCompression (const char *filename, unsigned char *data, int width, int height, int bitPerSample, int samplePerPixel, int compressionFlag)
dlldir int IoWriteTiffEx (const char *filename, unsigned char *data, int width, int height, int bitPerSample, int samplePerPixel, int RGBSequence)
 Save Image data to to a file in TIF format.
dlldir int IoWriteTiffExW (const LPCWSTR filename, unsigned char *data, int width, int height, int bitPerSample, int samplePerPixel, int RGBSequence)
 Save Image data to to a file in TIF format.
dlldir int IoWriteTiffW (const LPCWSTR filename, unsigned char *data, int width, int height, int bitPerSample, int samplePerPixel)
 Save Image data to to a file in TIF format.

Detailed Description

Functions to load and store image files.

-------------------------------------------------------------------

MicroEnable Io Library Copyright (C) Basler AG, 1997-2014

This includes code from: LIBTIFF, Version 3.7.4 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.

--------------------------------------------------------------------

Author:
Basler AG

Define Documentation

#define COMPRESSION_CCITT_T4   3
#define COMPRESSION_CCITT_T6   4
#define COMPRESSION_CCITTFAX3   3
#define COMPRESSION_CCITTFAX4   4
#define COMPRESSION_CCITTRLE   2
#define COMPRESSION_CCITTRLEW   32771
#define COMPRESSION_JPEG   7
#define COMPRESSION_LZW   5
#define COMPRESSION_NEXT   32766
#define COMPRESSION_NONE   1
#define COMPRESSION_OJPEG   6
#define COMPRESSION_PACKBITS   32773
#define COMPRESSION_THUNDERSCAN   32809
#define dlldir

Typedef Documentation

typedef char* LPCWSTR
typedef void SisoIoImageEngine

Function Documentation

dlldir int IoCloseAVI ( void *  AviRef  ) 
Warning:
this function only works on Windows
dlldir int IoCloseBmp ( void *  bmpHandle  ) 
Warning:
this function only works on Windows
dlldir int IoCloseSeq ( void *  SeqRef  ) 
dlldir int IoConvert1BitTo8BitData ( SisoIoImageEngine handle  ) 

converts a bitmap in an 8 bit gray image. It normalizes the gray values.

Parameters:
handle the image handle as opened by IoImageOpen(), IoOpenImage(), or IoOpenImageExt().
Returns:
0 on success, negative values on error
dlldir int IoCreateAVIColor ( void **  AviRef,
const char *  filename,
int  width,
int  height,
double  fps 
)
Warning:
this function only works on Windows
dlldir int IoCreateAVIColorW ( void **  AviRef,
const LPCWSTR  filename,
int  width,
int  height,
double  fps 
)
Warning:
this function only works on Windows
dlldir int IoCreateAVIGray ( void **  AviRef,
const char *  filename,
int  width,
int  height,
double  fps 
)
Warning:
this function only works on Windows
dlldir int IoCreateAVIGrayW ( void **  AviRef,
const LPCWSTR  filename,
int  width,
int  height,
double  fps 
)
Warning:
this function only works on Windows
dlldir int IoCreateSeq ( void **  SeqRef,
const char *  pFilename,
int  width,
int  height,
int  bitdepth,
int  format 
)
dlldir int IoFreeImage ( SisoIoImageEngine handle  ) 
dlldir int IoFreeRaw ( unsigned char *  data  ) 
dlldir int IoFreeTiff ( unsigned char *  data  ) 

Release the memory resources of previously read image files.

Parameters:
data pointer to the memory buffer retrieved by the functions IoReadTiff, IoReadTiffEx
dlldir int IoGetBitsPerComponent ( const SisoIoImageEngine handle  ) 
dlldir int IoGetBitsPerPixel ( const SisoIoImageEngine handle  ) 
dlldir int IoGetHeight ( const SisoIoImageEngine handle  ) 
dlldir int IoGetNrOfComponents ( const SisoIoImageEngine handle  ) 
dlldir int IoGetSeqInfo ( void *  SeqRef,
int *  nrOfImages,
int *  nrOfLostImages 
)
dlldir int IoGetWidth ( const SisoIoImageEngine handle  ) 
dlldir const void* IoImageGetData ( const SisoIoImageEngine handle  ) 

query the pixel data from an image. The channel order for color images is BLUE GREEN RED.

Parameters:
handle the image handle as opened by IoImageOpen(), IoOpenImage(), or IoOpenImageExt().
Returns:
the pixel data of the image
Return values:
NULL the handle is invalid or no image data was loaded
dlldir int IoImageOpen ( const char *  filename,
SisoIoImageEngine **  handle 
)

open an existing image file. The channel order for color images is BLUE GREEN RED. Supported file formats:

  • TIFF uncompressed, LZW, PackBits
    1. 1 Bit ( line width must be byte aligned )
      1. 8 Bit gray
      2. 16 Bit gray
      3. 24 Bit color
      4. 48 Bit color -BMP uncompressed
    2. 1 Bit ( line width must be byte aligned )
    3. 8 Bit gray
    4. 24 Bit color

Parameters:
filename name of the file that should be loaded
handle the opened handle will be stored here
Returns:
0 on success, negative values on error

This function is superior to IoOpenImage() as you will get an error code if what went wrong.

Parameters:
filename name of the file that should be loaded
handle return value for access to worker functions
dlldir int IoImageOpenEx ( const char *  filename,
SisoIoImageEngine **  handle,
int  RGBSequence 
)

open an existing image file

Parameters:
filename name of the file that should be loaded
handle return value for access to worker functions
RGBSequence 0 -> Buffer sequence always BGR, 1 -> always RGB
dlldir int IoOpenAVI ( void **  AviRef,
const char *  fileName,
int *  width,
int *  height,
int *  bitDepth 
)
Warning:
this function only works on Windows
dlldir SisoIoImageEngine* IoOpenImage ( const char *  filename  ) 

open an existing image file

Parameters:
filename name of the file that should be loaded
Returns:
image handle on success, NULL otherwise
Deprecated:
In new code you should use IoImageOpen() as this does the same operation but returns an error code if what went wrong.

Old code:

 SisoIoImageEngine *handle = IoOpenImageExt("example.tif");
 if (handle == NULL) {
  // error handling
 }

New code:

 SisoIoImageEngine *handle;
 int err = IoImageOpen("example.tif", &handle);
 if (err != 0) {
  // error handling
 }
dlldir SisoIoImageEngine* IoOpenImageExt ( const char *  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bits 
)

open an existing image file

Parameters:
filename name of the file that should be loaded
data image data will be referenced here
width width of opened image
height height of opened image
bits bit per pixel setting of opened image
Returns:
image handle on success, NULL otherwise
Deprecated:
In new code you should use IoImageOpen() and query the image settings by the appropiate functions.

Old code:

 unsigned char *data;
 int width, height, bits;
 SisoIoImageEngine *handle = IoOpenImageExt("example.tif", &data, &width, &height, &bits);
 if (handle == NULL) {
  // error handling
 }

New code:

 const unsigned char *data;
 int width, height, bits;
 SisoIoImageEngine *handle;
 int err = IoImageOpen("example.tif", &handle);
 if (err != 0) {
  // error handling
 }
 data = (const unsigned char *)IoImageGetData(handle);
 width = IoGetWidth(handle);
 height = IoGetHeight(handle);
 bits = IoGetBitsPerPixel(handle);
dlldir int IoOpenSeq ( void **  SeqRef,
const char *  pFilename,
int *  width,
int *  height,
int *  bitdepth,
int  mode 
)
dlldir int IoReadAVIPicture ( void *  AviRef,
int  PicNr,
unsigned char *  buffer 
)
Warning:
this function only works on Windows
dlldir void* IoReadBmp ( const char *  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bits 
)

Load data from a bitmap file to a memory buffer This functions loads the image data of a bitmap file to a memory buffer. The function allocates the memory buffer according to the detected image information inside the bitmap file and returns the pointer to the memory. In case of colored images, the ordering sequence of the color channels is BGR. Please note, that the image information inside the buffer is starting at the point ( X = 0, Y = 0), which means, that the data of the bitmap file is mirrored along a diagonal line compared to the bitmap format.

Parameters:
filename filename including file extension
data resulting memory buffer.
width dimension of the image
height dimension of the image
bits bitwidth of a pixel
Warning:
this function only works on Windows
dlldir int IoReadNextSeqPicture ( void *  SeqRef,
int *  PicNr,
unsigned char *  buffer 
)
dlldir int IoReadRaw ( const char *  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bits 
)
dlldir int IoReadSeqPicture ( void *  SeqRef,
int  PicNr,
unsigned char *  buffer 
)
dlldir void* IoReadTiff ( const char *  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bitPerSample,
int *  samplePerPixel 
)

Load a TIF file into a memory buffer.

Parameters:
filename filename including file extension
data a pointer to the newly created memory containing the image data
width image dimension: width
height image dimension: height
bitPerSample no. of bits per sample (bitwidth)
samplePerPixel no. of samples per pixel

This functions reads the image information and puts the images data to a memory buffer, that will be allocated by the IO-library. In case of color formats, the ordering sequence of the RGB channels will always be BGR

dlldir void* IoReadTiffEx ( const char *  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bitPerSample,
int *  samplePerPixel,
int  RGBSequence 
)

Load a TIF file into a memory buffer (enhanced version).

Parameters:
filename filename including file extension
data a pointer to the newly created memory containing the image data
width image dimension: width
height image dimension: height
bitPerSample no. of bits per sample (bitwidth)
samplePerPixel no. of samples per pixel
RGBSequence defines the sequence of RGB channels at the resulting buffer: 0 order will be RGB, 1 order will be BGR
Returns:
0 in case of success, otherwise various error codes

This functions reads the image information and puts the images data to a memory buffer, that will be allocated by the IO-library. The functions returns a pointer to then buffer of the image data, the dimensions of the image and details about the image format as well. The buffer memory will be released by the IOFreTiff function. The buffer is organized as a array of char line by line.

dlldir void* IoReadTiffExW ( const LPCWSTR  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bitPerSample,
int *  samplePerPixel,
int  RGBSequence 
)

Load a TIF file into a memory buffer.

Wide string version of the IoReadTiffEx function

dlldir void* IoReadTiffW ( const LPCWSTR  filename,
unsigned char **  data,
int *  width,
int *  height,
int *  bitPerSample,
int *  samplePerPixel 
)

Load a TIF file into a buffer,.

Widestring version of IoWriteTiff

Parameters:
filename filename including file extension
data a pointer to the newly created memory containing the image data
width image dimension: width
height image dimension: height
bitPerSample no. of bits per sample (bitwidth)
samplePerPixel no. of samples per pixel
dlldir int IoSaveImageExt ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bits 
)

save image to File. The channel order for color images is RED GREEN BLUE. Supported file formats:

  • TIFF uncompressed, LZW, PackBits
    1. 1 Bit ( line width must be byte aligned )
      1. 8 Bit gray
      2. 16 Bit gray
      3. 24 Bit color
      4. 48 Bit color -BMP uncompressed
    2. 1 Bit ( line width must be byte aligned )
    3. 8 Bit gray
    4. 24 Bit color

Parameters:
filename filename of the destination image
data image data array
width image width
height image height
bits bits per pixel
Returns:
0 on success, negative values on error
dlldir int IoSeqCreateAvi ( void *  SeqRef,
const char *  aviFilename,
int  StartPicNr,
int  StopPicNr 
)
dlldir int IoWriteAVIPicture ( void *  AviRef,
int  PicNr,
unsigned char *  buffer 
)
Warning:
this function only works on Windows
dlldir int IoWriteBmp ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bits 
)
Warning:
this function only works on Windows
dlldir int IoWriteBmpW ( const LPCWSTR  filename,
unsigned char *  data,
int  width,
int  height,
int  bits 
)
Warning:
this function only works on Windows
dlldir int IoWriteRaw ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bits 
)
dlldir int IoWriteRawW ( const LPCWSTR  filename,
unsigned char *  data,
int  width,
int  height,
int  bits 
)
dlldir int IoWriteSeqPicture ( void *  SeqRef,
int  PicNr,
unsigned char *  buffer 
)
dlldir int IoWriteTiff ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bitPerSample,
int  samplePerPixel 
)

Save Image data to to a file in TIF format.

See also:
IOWriteTiffEx
Parameters:
filename 
data 
width 
height 
bitPerSample 
samplePerPixel 
dlldir int IoWriteTiffCompression ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bitPerSample,
int  samplePerPixel,
int  compressionFlag 
)
dlldir int IoWriteTiffEx ( const char *  filename,
unsigned char *  data,
int  width,
int  height,
int  bitPerSample,
int  samplePerPixel,
int  RGBSequence 
)

Save Image data to to a file in TIF format.

Parameters:
filename name of the target file to store the data
data pointer to a memory buffer e.g. retrieved by a call to IOReadTif
width image dimension at the memory buffer, in this case the width in pixel
height image dimension at the memory buffer, in this case the height in pixel
bitPerSample no. of bits for a sample
samplePerPixel no. of samples per pixel
RGBSequence allows to swap the RGB data a the image data (in case of color formats). Note that the buffer data will be modified in this case
Returns:
0 in case of success, otherwise various error codes

This functions writes image form a memory buffer to the according file. The image data is located at the given buffer (data), which is filled according to the IOReadTiff functions. When using color formats, the sequence of RGB at the file can be swapped in order to allow conversions from different image formats (e.g. BMP-> TIFF). The buffer itself doesn't get modified in this case.

dlldir int IoWriteTiffExW ( const LPCWSTR  filename,
unsigned char *  data,
int  width,
int  height,
int  bitPerSample,
int  samplePerPixel,
int  RGBSequence 
)

Save Image data to to a file in TIF format.

Widestring version of IoWriteTiffEx

See also:
IoWriteTiffEx
Parameters:
filename name of the target file to store the data
data pointer to a memory buffer e.g. retrieved by a call to IOReadTif
width image dimension at the memory buffer, in this case the width in pixel
height image dimension at the memory buffer, in this case the height in pixel
bitPerSample no. of bits for a sample
samplePerPixel no. of samples per pixel
RGBSequence allows to swap the RGB data a the image data (in case of color formats). Note that the buffer data will be modified in this case
Returns:
0 in case of success, otherwise various error codes
dlldir int IoWriteTiffW ( const LPCWSTR  filename,
unsigned char *  data,
int  width,
int  height,
int  bitPerSample,
int  samplePerPixel 
)

Save Image data to to a file in TIF format.

Widestring version of IoWriteTiff

See also:
IoWriteTiff
Parameters:
filename name of the target file to store the data
data pointer to a memory buffer e.g. retrieved by a call to IOReadTif
width image dimension at the memory buffer, in this case the width in pixel
height image dimension at the memory buffer, in this case the height in pixel
bitPerSample no. of bits for a sample
samplePerPixel no. of samples per pixel
Returns:
0 in case of success, otherwise various error codes