/* Image Processing and Recognition Module for the IUPGLCAP application. */ /* It should not contain interface code, neither OpenGL nor IUP. */ #ifdef WIN32 #include /* necessary because of the Microsoft OpenGL headers dependency */ #endif #include #include #include //#include #include "ARProcess.h" #include "find_edges.h" #include "Algorithms.h" #include #include #include #include #include #include unsigned char* rgbImage[5]; unsigned char* lumImage[5]; int width, height; int xs[4]; int ys[4]; void arInit(int w, int h) { int i; width = w; height = h; for(i=1; i<5; i++) rgbImage[i] = (unsigned char*)malloc(3*w*h*sizeof(unsigned char)); for(i=0; i<5; i++) lumImage[i] = (unsigned char*)malloc(w*h*sizeof(unsigned char)); veInit(); } __inline void drawPixel(unsigned char* img, int width, int height, int x, int y, unsigned char color) { int index = 3*(y*width + x); img[index ] = color; img[index+1] = 0; img[index+2] = 0; } __inline void drawPoint(unsigned char* img, int width, int height, int x, int y, unsigned char color) { drawPixel(img, width, height, x, y, color); if(x>0) drawPixel(img, width, height, x-1, y, color); if(x0) drawPixel(img, width, height, x, y-1, color); if(y0)&&(y>0)) drawPixel(img, width, height, x-1, y-1, color); if(x0) drawPixel(img, width, height, x+1, y-1, color); if(ygl_data); // glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, app_data->image->data[0]); void arRepaintRightCanvas(void) { glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, rgbImage[2]); // glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, lumImage[2]); } void arRepaintLeftCanvas(void) { glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, rgbImage[0]); } void arEnd(void) { int i; for(i=1; i<5; i++) free(rgbImage[i]); for(i=0; i<5; i++) free(lumImage[i]); veFinish(); }