Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
matchpoint/APImage.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Zoran Mesec * 00003 * zoran.mesec@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 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 /* private slots: 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 /*IplImage* img; 00116 IplImage* imgBW;*/ 00117 00118 }; 00119 00120 00121 #endif // IMAGE_H_INCLUDED
1.3.9.1