00001 #ifndef JPEG_H 00002 #define JPEG_H 00003 /* Simple JPEG load/save interface, 00004 * based on examplecode in IJG's JPEG-library 00005 * 00006 * Author Fredrik Orderud, 2005 00007 */ 00008 00009 #ifndef UCHAR 00010 #define UCHAR 00011 typedef unsigned char uchar; 00012 #endif 00013 00014 //! struct for handling images 00015 typedef struct 00016 { 00017 uchar* data; //pixel data in RGB format. sizeof(data) == 3 * width * height; 00018 int width, height; 00019 } imageRGB; 00020 00021 namespace HAIR 00022 { 00023 00024 /******************** JPEG (DE)COMPRESSION INTERFACE *******************/ 00025 00026 //! Compress image into JPEG, and save it to disk quality must be in range 0-100 00027 /*! 00028 *\param filename JPEG file name. 00029 *\param quality Quality of JPEG. 00030 *\param img Image in format RGB. 00031 */ 00032 //void write_JPEG_file (char * filename, int quality, imageRGB img); 00033 bool write_JPEG_file (char * filename, int quality, imageRGB img); 00034 00035 //! Load and decompress JPEG image from disk */ 00036 /*! 00037 *\param filename JPEG file name. 00038 */ 00039 imageRGB read_JPEG_file (char * filename); 00040 00041 } 00042 #endif