00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __TLIMAGE_H__
00018 #define __TLIMAGE_H__
00019
00020
00021 #include "tlVision.h"
00022 #include "tlPixelArray.h"
00023
00024
00025 class tlImage : public tlPixelArray
00026 {
00027 public:
00028
00029
00030 tlImage ();
00031 tlImage (tl_format format, int width, int height);
00032 tlImage (tlImage *image);
00033 virtual ~tlImage ();
00034
00035
00036 int writeToFile (char *filename);
00037 int writeToPPM (char *filename);
00038 int writeToBMP (char *filename);
00039 int writeToJPG (char *filename, int quality = 80);
00040 int readFromFile (char *filename);
00041 int readFromPPM (char *filename);
00042 int readFromBMP (char *filename);
00043 int readFromJPG (char *filename);
00044
00045
00046 int drawPoint (int x, int y, unsigned char r, unsigned char g, unsigned char b);
00047 int drawPoint (int x, int y, unsigned char v);
00048 int drawPoint (tlPoint *point, unsigned char r, unsigned char g, unsigned char b);
00049 int drawPoint (tlPoint *point, unsigned char v);
00050 int drawLine (int x1, int y1, int x2, int y2, unsigned char r, unsigned char g, unsigned char b);
00051 int drawLine (int x1, int y1, int x2, int y2, unsigned char v);
00052 int drawLine (tlPoint *p1, tlPoint *p2, unsigned char r, unsigned char g, unsigned char b);
00053 int drawLine (tlPoint *p1, tlPoint *p2, unsigned char v);
00054 int drawLine (tlLine *line, unsigned char r, unsigned char g, unsigned char b);
00055 int drawLine (tlLine *line, unsigned char v);
00056 int drawRect (tlRect *rect, unsigned char r, unsigned char g, unsigned char b);
00057 int drawRect (tlRect *rect, unsigned char v);
00058 int drawCross (int x, int y, int size, unsigned char r, unsigned char g, unsigned char b);
00059 int drawCross (int x, int y, int size, unsigned char v);
00060 int drawCross (tlPoint *point, int size, unsigned char r, unsigned char g, unsigned char b);
00061 int drawCross (tlPoint *point, int size, unsigned char v);
00062 int drawCross (tlRect *rect, unsigned char r, unsigned char g, unsigned char b);
00063 int drawCross (tlRect *rect, unsigned char v);
00064 int drawCross (tlChain *chain, int size, unsigned char r, unsigned char g, unsigned char b);
00065 int drawCross (tlChain *chain, int size, unsigned char v);
00066 int drawMask (tlMask *mask, unsigned char r, unsigned char g, unsigned char b);
00067 int drawMask (tlMask *mask, unsigned char v);
00068 int drawMask (tlMask *mask, int x, int y, unsigned char r, unsigned char g, unsigned char b);
00069 int drawMask (tlMask *mask, int x, int y, unsigned char v);
00070 int drawChain (tlChain *chain, unsigned char r, unsigned char g, unsigned char b);
00071 int drawChain (tlChain *chain, unsigned char v);
00072 int drawObject (tlObject *object);
00073 int drawObject (tlObject *object, int x, int y);
00074 int drawImage (tlImage *image, int x, int y);
00075 int drawImage (tlImage *image, tlLocation *location);
00076 int fillRect (tlRect *rect, unsigned char r, unsigned char g, unsigned char b);
00077 int fillRect (tlRect *rect, unsigned char v);
00078 int fillObject (tlObject *object, unsigned char r, unsigned char g, unsigned char b);
00079 int fillObject (tlObject *object, unsigned char v);
00080 int fillObject (tlObject *object, int x, int y, unsigned char r, unsigned char g, unsigned char b);
00081 int fillObject (tlObject *object, int x, int y, unsigned char v);
00082 int drawText (char *text, int x, int y, unsigned char r, unsigned char g, unsigned char b, bool blackbg = false);
00083 int drawText (char *text, int x, int y, unsigned char v, bool blackbg = false);
00084 int drawText (char *text, tlPoint *p, unsigned char r, unsigned char g, unsigned char b, bool blackbg = false);
00085 int drawText (char *text, tlPoint *p, unsigned char v, bool blackbg = false);
00086
00087
00088 int normalize ();
00089 int normalize (tlRect *rect);
00090 int normalize (tlMask *mask);
00091 int normalize (tlMask *mask, tlRect *rect);
00092 int normalize (tlImage *dest);
00093 int normalize (tlRect *rect, tlImage *dest);
00094 int normalize (tlMask *mask, tlImage *dest);
00095 int normalize (tlMask *mask, tlRect *rect, tlImage *dest);
00096
00097
00098 int edges (int method=TL_EDGES_SOBEL);
00099 int edges (tlRect *rect, int method=TL_EDGES_SOBEL);
00100 int edgesVert (int method=TL_EDGES_SOBEL);
00101 int edgesVert (tlRect *rect, int method=TL_EDGES_SOBEL);
00102 int edgesHor (int method=TL_EDGES_SOBEL);
00103 int edgesHor (tlRect *rect, int method=TL_EDGES_SOBEL);
00104
00105
00106 int edges (tlImage *dest, int method=TL_EDGES_MORPH);
00107 int edges (tlRect *rect, tlImage *dest, int method=TL_EDGES_MORPH);
00108 int edgesVert (tlImage *dest, int method=TL_EDGES_SOBEL);
00109 int edgesVert (tlRect *rect, tlImage *dest, int method=TL_EDGES_SOBEL);
00110 int edgesHor (tlImage *dest, int method=TL_EDGES_SOBEL);
00111 int edgesHor (tlRect *rect, tlImage *dest, int method=TL_EDGES_SOBEL);
00112
00113
00114 int borderBlack (int b);
00115 int borderBlack (int bx, int by);
00116 int borderMirror (int b);
00117 int borderMirror (int bx, int by);
00118
00119
00120 int crop (tlRect *rect);
00121 int crop (int x, int y, int width, int height);
00122 int crop (tlRect *rect, tlImage *dest);
00123 int crop (int x, int y, int width, int height, tlImage *dest);
00124 int borderBlack (int b, tlImage *dest);
00125 int borderBlack (int bx, int by, tlImage *dest);
00126 int borderMirror (int b, tlImage *dest);
00127 int borderMirror (int bx, int by, tlImage *dest);
00128
00129
00130 int mirror ();
00131 int mirror (tlImage *dest);
00132
00133
00134 int invert ();
00135 int invert (tlImage *dest);
00136
00137
00138 int rotateRight ();
00139 int rotateLeft ();
00140 int rotateRight (tlImage *dest);
00141 int rotateLeft (tlImage *dest);
00142 };
00143
00144
00145 #endif
00146