00001 #ifndef vipl_sobel_txx_
00002 #define vipl_sobel_txx_
00003
00004 #include "vipl_sobel.h"
00005
00006 template <class ImgIn,class ImgOut,class DataIn,class DataOut,class PixelItr>
00007 bool vipl_sobel <ImgIn,ImgOut,DataIn,DataOut,PixelItr> :: section_applyop()
00008 {
00009 const ImgIn &in = this->in_data(0);
00010 ImgOut &out = this->out_data();
00011
00012 int startx = vipl_filter<ImgIn,ImgOut,DataIn,DataOut,2,PixelItr>::start(this->X_Axis());
00013 int starty = vipl_filter<ImgIn,ImgOut,DataIn,DataOut,2,PixelItr>::start(this->Y_Axis());
00014 int stopx = vipl_filter<ImgIn,ImgOut,DataIn,DataOut,2,PixelItr>::stop(this->X_Axis());
00015 int stopy = vipl_filter<ImgIn,ImgOut,DataIn,DataOut,2,PixelItr>::stop(this->Y_Axis());
00016 for (int j = starty, ej = stopy; j < ej ; ++j)
00017 for (int i = startx, ei = stopx; i < ei ; ++i)
00018 fsetpixel(out, i, j, (DataOut)(
00019 4*fgetpixel(in, i, j, (DataIn)0)
00020 - getpixel(in, i+1, j+1, (DataIn)0)
00021 - getpixel(in, i-1, j+1, (DataIn)0)
00022 - getpixel(in, i+1, j-1, (DataIn)0)
00023 - getpixel(in, i-1, j-1, (DataIn)0)));
00024 return true;
00025 }
00026
00027 #endif // vipl_sobel_txx_