Go to the documentation of this file.00001
00009 #ifndef UTILS_H
00010 #define UTILS_H
00011
00012 #include <cxcore.h>
00013
00014 #include <stdio.h>
00015 #include <dirent.h>
00016
00017
00018
00019 #ifndef ABS
00020 #define ABS(x) ( ( x < 0 )? -x : x )
00021 #endif
00022
00023
00024
00025
00034 static inline int pixval8( IplImage* img, int r, int c )
00035 {
00036 return (int)( ( (uchar*)(img->imageData + img->widthStep*r) )[c] );
00037 }
00038
00039
00048 static inline void setpix8( IplImage* img, int r, int c, uchar val)
00049 {
00050 ( (uchar*)(img->imageData + img->widthStep*r) )[c] = val;
00051 }
00052
00053
00062 static inline float pixval32f( IplImage* img, int r, int c )
00063 {
00064 return ( (float*)(img->imageData + img->widthStep*r) )[c];
00065 }
00066
00067
00076 static inline void setpix32f( IplImage* img, int r, int c, float val )
00077 {
00078 ( (float*)(img->imageData + img->widthStep*r) )[c] = val;
00079 }
00080
00081
00090 static inline double pixval64f( IplImage* img, int r, int c )
00091 {
00092 return (double)( ( (double*)(img->imageData + img->widthStep*r) )[c] );
00093 }
00094
00095
00104 static inline void setpix64f( IplImage* img, int r, int c, double val )
00105 {
00106 ( (double*)(img->imageData + img->widthStep*r) )[c] = val;
00107 }
00108
00109
00110
00111
00112
00120 extern void fatal_error( char* format, ... );
00121
00122
00133 extern int array_double( void** array, int n, int size );
00134
00135
00142
00143
00144 #endif