vil_sobel_3x3.h
Go to the documentation of this file.
1 // This is core/vil/algo/vil_sobel_3x3.h
2 #ifndef vil_sobel_3x3_h_
3 #define vil_sobel_3x3_h_
4 //:
5 // \file
6 // \brief Apply 3x3 sobel operator to image data
7 // \author Tim Cootes
8 
9 #include <vil/vil_image_view.h>
10 
11 //: Compute gradients of an image using 3x3 Sobel filters
12 // Computes both i and j gradients of an ni x nj plane of data
13 // 1 pixel border around grad images is set to zero
14 // \relatesalso vil_image_view
15 template<class srcT, class destT>
16 void vil_sobel_3x3(const vil_image_view<srcT>& src,
17  vil_image_view<destT>& grad_i,
18  vil_image_view<destT>& grad_j);
19 
20 //: Compute gradients of an image using 3x3 Sobel filters
21 // Computes both i and j gradients of an nx x ny plane of data
22 // grad_ij has twice as many planes as src, with dest plane (2i) being the i-gradient
23 // of source plane i and dest plane (2i+1) being the j-gradient.
24 // 1 pixel border around grad images is set to zero
25 // \relatesalso vil_image_view
26 template<class srcT, class destT>
27 void vil_sobel_3x3(const vil_image_view<srcT>& src,
28  vil_image_view<destT>& grad_ij);
29 
30 
31 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
32 // Computes both i and j gradients of an ni x nj plane of data
33 // 1 pixel border around grad images is set to zero
34 template<class srcT, class destT>
35 void vil_sobel_3x3_1plane(const srcT* src,
36  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
37  destT* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
38  destT* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
39  unsigned ni, unsigned nj);
40 
41 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
42 // Computes both i and j gradients of an ni x nj plane of data
43 // 1 pixel border around grad images is set to zero
44 template <>
45 void vil_sobel_3x3_1plane(const unsigned char* src,
46  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
47  float* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
48  float* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
49  unsigned ni, unsigned nj);
50 
51 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
52 // Computes both i and j gradients of an ni x nj plane of data
53 // 1 pixel border around grad images is set to zero
54 template <>
55 void vil_sobel_3x3_1plane(const unsigned char* src,
56  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
57  double* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
58  double* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
59  unsigned ni, unsigned nj);
60 
61 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
62 // Computes both i and j gradients of an ni x nj plane of data.
63 // 1 pixel border around grad images is set to zero
64 template <>
65 void vil_sobel_3x3_1plane(const float* src,
66  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
67  float* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
68  float* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
69  unsigned ni, unsigned nj);
70 
71 //: Compute gradients of single plane of 2D data using 3x3 Sobel filters
72 // Computes both i and j gradients of an ni x nj plane of data.
73 // 1 pixel border around grad images is set to zero
74 template <>
75 void vil_sobel_3x3_1plane(const double* src,
76  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
77  double* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
78  double* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
79  unsigned ni, unsigned nj);
80 
81 #endif // vil_sobel_3x3_h_
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
void vil_sobel_3x3_1plane(const srcT *src, std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep, destT *gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep, destT *gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep, unsigned ni, unsigned nj)
Compute gradients of single plane of 2D data using 3x3 Sobel filters.
A base class reference-counting view of some image data.
void vil_sobel_3x3(const vil_image_view< srcT > &src, vil_image_view< destT > &grad_i, vil_image_view< destT > &grad_j)
Compute gradients of an image using 3x3 Sobel filters.