PARP Research Group University of Murcia, Spain


examples/OpenCV/siftDetector/hess/utils.h

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 /* absolute value */
00019 #ifndef ABS
00020 #define ABS(x) ( ( x < 0 )? -x : x )
00021 #endif
00022 
00023 /***************************** Inline Functions ******************************/
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 /**************************** Function Prototypes ****************************/
00111 
00112 
00120 extern void fatal_error( char* format, ... );
00121 
00122 
00136 extern char* replace_extension( const char* file, const char* extn );
00137 
00138 
00148 extern char* prepend_path( const char* path, const char* file );
00149 
00150 
00159 extern char* basename( const char* pathname );
00160 
00161 
00170 extern void progress( int done );
00171 
00172 
00179 extern void erase_from_stream( FILE* stream, int n );
00180 
00181 
00192 extern int array_double( void** array, int n, int size );
00193 
00194 
00201 extern double dist_sq_2D( CvPoint2D64f p1, CvPoint2D64f p2 );
00202 
00203 
00213 extern void draw_x( IplImage* img, CvPoint pt, int r, int w, CvScalar color );
00214 
00215 
00224 extern IplImage* stack_imgs( IplImage* img1, IplImage* img2 );
00225 
00226 
00235 extern void display_big_img( IplImage* img, char* title );
00236 
00237 
00257 extern void vid_view( IplImage** imgs, int n, char* win_name );
00258 
00259 
00267 extern int win_closed( char* name );
00268 
00269 #endif



QVision framework. PARP research group, copyright 2007, 2008.