TLIB documentation
 

tlFile.h File Reference


Detailed Description

Internal file I/O routines.

#include "tlVision.h"

Include dependency graph for tlFile.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int tl_write_bmp (tlPixel *src, int width, int height, tl_format format, char *filename)
int tl_write_jpg (tlPixel *src, int width, int height, int pixel_width, int quality, char *filename)
int tl_write_ppm (tlPixel *src, int width, int height, char *filename)
int tl_write_tlb (tlImage *image, char *filename)
tlPixeltl_read_bmp (char *filename, int *width, int *height, tl_format *format)
tlPixeltl_read_jpg (char *filename, int *width, int *height, tl_format *format)
tlPixeltl_read_ppm (char *filename, int *width, int *height, tl_format *format)
void * tl_read_tlb (char *filename, int *width, int *height, int *pixel_width, tl_format *format)


Function Documentation

tlPixel* tl_read_bmp ( char *  filename,
int *  width,
int *  height,
tl_format format 
)

Read an image from a BMP format.

Parameters:
filename file name
width [out] image width
height [out] image height
format [out] image format
Returns:
A pointer to the image pixel array read on success, NULL otherwise.
See error management for details.

References RGB, tl_create_array(), TL_ERRNO_MSG, TL_ERROR_ALLOCATION_FAILED, TL_ERROR_FILE_NOT_FOUND_OR_CORRUPT, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, tl_read_bmp(), and TL_RGB_WIDTH.

Referenced by tlImage::readFromBMP(), and tl_read_bmp().

tlPixel* tl_read_jpg ( char *  filename,
int *  width,
int *  height,
tl_format format 
)

Read an image from a JPEG format.

Parameters:
filename file name
width [out] image width
height [out] image height
format [out] image format
Returns:
A pointer to the image pixel array read on success, NULL otherwise.
See error management for details.

References GRAY, RGB, tl_create_array(), TL_ERRNO_MSG, TL_ERROR_ALLOCATION_FAILED, TL_ERROR_FILE_NOT_FOUND_OR_CORRUPT, TL_ERROR_NULL_POINTER, and tl_read_jpg().

Referenced by tlImage::readFromJPG(), and tl_read_jpg().

tlPixel* tl_read_ppm ( char *  filename,
int *  width,
int *  height,
tl_format format 
)

Read an image from a Portable Pixmap format (binary format).

Parameters:
filename file name
width [out] image width
height [out] image height
format [out] image format
Returns:
A pointer to the image pixel array read on success, NULL otherwise.
See error management for details.

References RGB, TL_ERRNO_MSG, TL_ERROR_ALLOCATION_FAILED, TL_ERROR_FILE_IO, TL_ERROR_FILE_NOT_FOUND_OR_CORRUPT, TL_ERROR_INVALID_FORMAT, tl_read_ppm(), TL_RGB_WIDTH, and tlVerbose.

Referenced by tlImage::readFromPPM(), and tl_read_ppm().

void* tl_read_tlb ( char *  filename,
int *  width,
int *  height,
int *  pixel_width,
tl_format format 
)

Read an image in TLIB format.

Parameters:
filename file name
width [out] image width
height [out] image height
pixel_width [out] pixel width
format [out] image format
Returns:
A pointer to the image pixel array read on success, NULL otherwise.
See error management for details.

References BIN, GRAY, HSI, NRG, RGB, STEREO, TL_ERRNO_MSG, TL_ERROR_ALLOCATION_FAILED, TL_ERROR_FILE_IO, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, tl_read_tlb(), and tlVerbose.

Referenced by tlImage::readFromFile(), and tl_read_tlb().

int tl_write_bmp ( tlPixel src,
int  width,
int  height,
tl_format  format,
char *  filename 
)

Write to Bitmap format.

Parameters:
src RGB pixel array to save
width image width
height image height
format image format
filename the file name. If NULL, write to stdout
Returns:
0 on success, -1 otherwise.
See error management for details.
Warning:
this code is NOT portable! Do not attempt to use this on anything other than 32-bit little-endian machines!

References GRAY, RGB, TL_ERRNO_MSG, TL_ERROR, TL_ERROR_NULL_POINTER, TL_RGB_WIDTH, tl_write_bmp(), and tlVerbose.

Referenced by tl_write_bmp(), and tlImage::writeToBMP().

int tl_write_jpg ( tlPixel src,
int  width,
int  height,
int  pixel_width,
int  quality,
char *  filename 
)

Write to JPEG format.

Parameters:
src RGB pixel array to save
width image width
height image height
filename the file name; if NULL, write to stdout
pixel_width the number of bytes in each pixel
quality the quality of the output jpg file [%]
Returns:
0 on success, -1 otherwise. See error management for details.

References TL_ERRNO_MSG, TL_ERROR, TL_ERROR_FILE_IO, TL_ERROR_NULL_POINTER, tl_write_jpg(), and tlVerbose.

Referenced by tl_write_jpg(), and tlImage::writeToJPG().

int tl_write_ppm ( tlPixel src,
int  width,
int  height,
char *  filename 
)

Write to Portable Pixmap format (binary format).

Parameters:
src RGB pixel array to save
width image width
height image height
filename the file name; if NULL, write to stdout
Returns:
0 on success, -1 otherwise.
See error management for details.

References TL_ERRNO_MSG, TL_ERROR, TL_ERROR_FILE_IO, TL_ERROR_NULL_POINTER, tl_write_ppm(), and tlVerbose.

Referenced by tl_write_ppm(), and tlImage::writeToPPM().

int tl_write_tlb ( tlImage image,
char *  filename 
)

Write to TLIB image format.

image image to save filename the file name. If NULL, write to stdout.

Returns:
0 on success, -1 otherwise.
See error management for details.

References BIN, tlPixelArray::format, GRAY, tlSize::height, tlPixelArray::hrpixel, HSI, NRG, tlPixelArray::pixel, tlPixelArray::pixelWidth, RGB, STEREO, TL_ERRNO_MSG, TL_ERROR, TL_ERROR_FILE_IO, TL_ERROR_NULL_POINTER, TL_MAX_PIXEL_VAL, tl_write_tlb(), tlVerbose, and tlSize::width.

Referenced by tl_write_tlb(), and tlImage::writeToFile().



TLIB documentation - generated on 12 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.