00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef IMAGE_H_INCLUDED
00021 #define IMAGE_H_INCLUDED
00022 #define USE_VIGRA
00023
00024 #include <string>
00025 #include <stdio.h>
00026 #include <iostream>
00027 #include <stdlib.h>
00028 #include <vector>
00029
00030 #ifdef USE_OPENCV
00031 #include "cv.h"
00032 #endif
00033
00034 #ifdef USE_VIGRA
00035 #include "vigra/stdimage.hxx"
00036 #include "vigra/imageinfo.hxx"
00037 #include "vigra/impex.hxx"
00038 #include "vigra/stdimagefunctions.hxx"
00039 #include "edgedetection.hxx"
00040 #include "vigra/utilities.hxx"
00041 #include "vigra/numerictraits.hxx"
00042
00043 #include "vigra/recursiveconvolution.hxx"
00044 #include "vigra/separableconvolution.hxx"
00045 #include "vigra/labelimage.hxx"
00046 #include "vigra/mathutil.hxx"
00047 #include "vigra/pixelneighborhood.hxx"
00048 #include "vigra/linear_solve.hxx"
00049 #endif
00050
00051
00052 using namespace std;
00053 using namespace vigra;
00054
00055 class APImage
00056 {
00057
00058 public:
00059 APImage(string p);
00060 void convolute(int* kernel,int dim1, int dim2,double scale);
00061 string getPath();
00062 int getWidth();
00063 int getWidthBW();
00064 int getHeight();
00065 int getHeightBW();
00066 int getPixel(int x, int y);
00067 int getIntegralPixel(int x,int y);
00068 void scale(double factor);
00069 APImage* getCopy();
00070 void drawCircle(int x,int y, int radius);
00071 void drawLine(int x1,int y1, int x2,int y2);
00072 void drawRectangle(int x,int y, int radius);
00073 void smooth();
00074 void integrate();
00075 int getRegionSum(int x1, int y1, int x2, int y2);
00076
00077 bool open();
00078 void show();
00079 void test();
00080
00081 template <class SrcIterator, class SrcAccessor, class BackInsertable>
00082 void _cannyEdgelList1(vigra::triple<SrcIterator, SrcIterator, SrcAccessor> src,
00083 BackInsertable & edgels, double scale, vector<int>* p);
00084
00085
00086 #ifdef USE_VIGRA
00087 vigra::BImage* imgBW;
00088 #endif
00089
00090
00091
00092
00093 private:
00097 vector<vector<int> > convolution;
00101 vector<vector<int> > integral;
00102 string path;
00103 int _getValue4Integral(int x, int y);
00104
00105 template <class SrcIterator, class SrcAccessor, class BackInsertable>
00106 inline void _cannyEdgelList(SrcIterator ul, SrcIterator lr, SrcAccessor src,
00107 BackInsertable & edgels, double scale, vector<int>* point);
00108
00109 template <class Image1, class Image2, class BackInsertable>
00110 void _internalCannyFindEdgels(Image1 const & gx,
00111 Image1 const & gy,
00112 Image2 const & magnitude,
00113 BackInsertable & edgels, vector<int>* p);
00114
00115
00116
00117
00118 };
00119
00120
00121 #endif // IMAGE_H_INCLUDED