core/vil/algo/vil_sobel_1x3.h
Go to the documentation of this file.
00001 #ifndef vil_sobel_1x3_h_
00002 #define vil_sobel_1x3_h_
00003 //:
00004 // \file
00005 // \brief Apply 1x3 sobel operator to image data
00006 // \author Tim Cootes
00007 
00008 #include <vil/vil_image_view.h>
00009 
00010 //: Compute gradients of an image using 1x3 Sobel filters
00011 //  Computes both i and j gradients of an ni x nj plane of data
00012 //  1 pixel border around grad images is set to zero
00013 // \relatesalso vil_image_view
00014 template<class srcT, class destT>
00015 void vil_sobel_1x3(const vil_image_view<srcT>& src,
00016                    vil_image_view<destT>& grad_i,
00017                    vil_image_view<destT>& grad_j);
00018 
00019 //: Compute gradients of an image using 1x3 Sobel filters
00020 //  Computes both i and j gradients of an nx x ny plane of data
00021 //  grad_ij has twice as many planes as src, with dest plane (2i) being the i-gradient
00022 //  of source plane i and dest plane (2i+1) being the j-gradient.
00023 //  1 pixel border around grad images is set to zero
00024 // \relatesalso vil_image_view
00025 template<class srcT, class destT>
00026 void vil_sobel_1x3(const vil_image_view<srcT>& src,
00027                    vil_image_view<destT>& grad_ij);
00028 
00029 //: Compute gradients of single plane of 2D data using 1x3 Sobel filters
00030 //  Computes both i and j gradients of an ni x nj plane of data
00031 //  1 pixel border around grad images is set to zero
00032 
00033 template<class srcT, class destT>    
00034 void vil_sobel_1x3_1plane(const srcT* src,
00035                           vcl_ptrdiff_t s_istep, vcl_ptrdiff_t s_jstep,
00036                           destT* gi, vcl_ptrdiff_t gi_istep, vcl_ptrdiff_t gi_jstep,
00037                           destT* gj, vcl_ptrdiff_t gj_istep, vcl_ptrdiff_t gj_jstep,
00038                           unsigned ni, unsigned nj);
00039 
00040 
00041 //: Compute gradients of single plane of 2D data using 1x3 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_1x3_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 1x3 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_1x3_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 1x3 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_1x3_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 1x3 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_1x3_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_1x3_h_