core/vil/algo/vil_sobel_3x3.h
Go to the documentation of this file.
00001 // This is core/vil/algo/vil_sobel_3x3.h
00002 #ifndef vil_sobel_3x3_h_
00003 #define vil_sobel_3x3_h_
00004 //:
00005 // \file
00006 // \brief Apply 3x3 sobel operator to image data
00007 // \author Tim Cootes
00008 
00009 #include <vil/vil_image_view.h>
00010 
00011 //: Compute gradients of an image using 3x3 Sobel filters
00012 //  Computes both i and j gradients of an ni x nj plane of data
00013 //  1 pixel border around grad images is set to zero
00014 // \relatesalso vil_image_view
00015 template<class srcT, class destT>
00016 void vil_sobel_3x3(const vil_image_view<srcT>& src,
00017                    vil_image_view<destT>& grad_i,
00018                    vil_image_view<destT>& grad_j);
00019 
00020 //: Compute gradients of an image using 3x3 Sobel filters
00021 //  Computes both i and j gradients of an nx x ny plane of data
00022 //  grad_ij has twice as many planes as src, with dest plane (2i) being the i-gradient
00023 //  of source plane i and dest plane (2i+1) being the j-gradient.
00024 //  1 pixel border around grad images is set to zero
00025 // \relatesalso vil_image_view
00026 template<class srcT, class destT>
00027 void vil_sobel_3x3(const vil_image_view<srcT>& src,
00028                    vil_image_view<destT>& grad_ij);
00029 
00030 
00031 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
00032 //  Computes both i and j gradients of an ni x nj plane of data
00033 //  1 pixel border around grad images is set to zero
00034 template<class srcT, class destT>
00035 void vil_sobel_3x3_1plane(const srcT* src,
00036                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00037                           destT* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00038                           destT* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00039                           unsigned ni, unsigned nj);
00040 
00041 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
00042 //  Computes both i and j gradients of an ni x nj plane of data
00043 //  1 pixel border around grad images is set to zero
00044 VCL_DEFINE_SPECIALIZATION
00045 void vil_sobel_3x3_1plane(const unsigned char* src,
00046                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00047                           float* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00048                           float* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00049                           unsigned ni, unsigned nj);
00050 
00051 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
00052 //  Computes both i and j gradients of an ni x nj plane of data
00053 //  1 pixel border around grad images is set to zero
00054 VCL_DEFINE_SPECIALIZATION
00055 void vil_sobel_3x3_1plane(const unsigned char* src,
00056                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00057                           double* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00058                           double* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00059                           unsigned ni, unsigned nj);
00060 
00061 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
00062 //  Computes both i and j gradients of an ni x nj plane of data.
00063 //  1 pixel border around grad images is set to zero
00064 VCL_DEFINE_SPECIALIZATION
00065 void vil_sobel_3x3_1plane(const float* src,
00066                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00067                           float* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00068                           float* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00069                           unsigned ni, unsigned nj);
00070 
00071 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
00072 //  Computes both i and j gradients of an ni x nj plane of data.
00073 //  1 pixel border around grad images is set to zero
00074 VCL_DEFINE_SPECIALIZATION
00075 void vil_sobel_3x3_1plane(const double* src,
00076                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00077                           double* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00078                           double* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00079                           unsigned ni, unsigned nj);
00080 
00081 #endif // vil_sobel_3x3_h_