vil_sobel_1x3.h
Go to the documentation of this file.
1 #ifndef vil_sobel_1x3_h_
2 #define vil_sobel_1x3_h_
3 //:
4 // \file
5 // \brief Apply 1x3 sobel operator to image data
6 // \author Tim Cootes
7 
8 #include <vil/vil_image_view.h>
9 
10 //: Compute gradients of an image using 1x3 Sobel filters
11 // Computes both i and j gradients of an ni x nj plane of data
12 // 1 pixel border around grad images is set to zero
13 // \relatesalso vil_image_view
14 template<class srcT, class destT>
15 void vil_sobel_1x3(const vil_image_view<srcT>& src,
16  vil_image_view<destT>& grad_i,
17  vil_image_view<destT>& grad_j);
18 
19 //: Compute gradients of an image using 1x3 Sobel filters
20 // Computes both i and j gradients of an nx x ny plane of data
21 // grad_ij has twice as many planes as src, with dest plane (2i) being the i-gradient
22 // of source plane i and dest plane (2i+1) being the j-gradient.
23 // 1 pixel border around grad images is set to zero
24 // \relatesalso vil_image_view
25 template<class srcT, class destT>
26 void vil_sobel_1x3(const vil_image_view<srcT>& src,
27  vil_image_view<destT>& grad_ij);
28 
29 //: Compute gradients of single plane of 2D data using 1x3 Sobel filters
30 // Computes both i and j gradients of an ni x nj plane of data
31 // 1 pixel border around grad images is set to zero
32 
33 template<class srcT, class destT>
34 void vil_sobel_1x3_1plane(const srcT* src,
35  std::ptrdiff_t s_istep, std::ptrdiff_t s_jstep,
36  destT* gi, std::ptrdiff_t gi_istep, std::ptrdiff_t gi_jstep,
37  destT* gj, std::ptrdiff_t gj_istep, std::ptrdiff_t gj_jstep,
38  unsigned ni, unsigned nj);
39 
40 
41 //: Compute gradients of single plane of 2D data using 1x3 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_1x3_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 1x3 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_1x3_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 1x3 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_1x3_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 1x3 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_1x3_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_1x3_h_
void vil_sobel_1x3(const vil_image_view< srcT > &src, vil_image_view< destT > &grad_i, vil_image_view< destT > &grad_j)
Compute gradients of an image using 1x3 Sobel filters.
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
void vil_sobel_1x3_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 1x3 Sobel filters.
A base class reference-counting view of some image data.