KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
i_mt_convo.h
Go to the documentation of this file.
1 
6 /*
7  * $Id: i_mt_convo.h 17393 2014-08-23 20:19:14Z predoehl $
8  */
9 
10 #ifndef I_CPP_I_MT_CONVO_H_INCLUDED_IVILAB
11 #define I_CPP_I_MT_CONVO_H_INCLUDED_IVILAB
12 
13 #include <m_cpp/m_convolve.h>
14 #include <i_cpp/i_image.h>
15 
16 namespace kjb
17 {
18 
19 
55 {
56  Fftw_convolution_2d m_convo;
57 
58 public:
61  int img_num_rows,
62  int img_num_cols,
63  int mask_max_rows,
64  int mask_max_cols,
65  int fft_alg_type = FFTW_MEASURE // Macro defined in m_convolve.h
66  )
67  : m_convo(img_num_rows, img_num_cols,
68  mask_max_rows, mask_max_cols, fft_alg_type)
69  {}
70 
71 
73  void set_mask(const Matrix& m)
74  {
75  m_convo.set_mask(m); // simple forwarding function
76  }
77 
79  void set_gaussian_mask(double sigma)
80  {
81  m_convo.set_gaussian_mask(sigma); // simple forwarding function
82  }
83 
85  {
86  return m_convo.allocate_work_buffer(); // simple forwarding function
87  }
88 
89 
90 /* ABOVE THE LINE: NOT THREAD SAFE
91  * -----------------------------------------------------------------
92  * BELOW THE LINE: THREAD SAFE
93  */
94 
97  {
98  return m_convo.get_sizes();
99  }
100 
102  bool is_mask_set() const
103  {
104  return m_convo.is_mask_set();
105  }
106 
108  const Image&,
109  Image&,
111  ) const;
112 
113  void convolve(
114  const Image&,
115  Image&,
117  ) const;
118 };
119 
120 
121 }
122 
123 #endif /* I_CPP_I_MT_CONVO_H_INCLUDED_IVILAB */
const int FFTW_MEASURE
Definition: m_convolve.h:50
void set_gaussian_mask(double sigma)
set mask to a circular gaussian kernel of given sigma (pixels)
Definition: i_mt_convo.h:79
void set_mask(const Matrix &m)
set mask, which must fit with mask size maxima given to ctor
Definition: i_mt_convo.h:73
A class for performing 2d convolution using the FFTW library.
Definition: m_convolve.h:402
declaration of C++ helper class for FFT-based convolution using FFTW
void set_mask(const Matrix &)
set mask, which must fit with mask size maxima given to ctor
Definition: m_convolve.cpp:661
Work_buffer allocate_work_buffer() const
get a handle to a work buffer needed for threadsafe convolution.
Definition: m_convolve.cpp:703
Fftw_convolution_2d::Work_buffer allocate_work_buffer() const
Definition: i_mt_convo.h:84
bool is_mask_set() const
read access of the flag indicating whether the mask has been set
Definition: m_convolve.h:476
void set_gaussian_mask(double sigma)
set mask to a circular gaussian kernel of given sigma (pixels)
Definition: m_convolve.cpp:662
utility aggregate stores all sizes – rarely used by caller
Definition: m_convolve.h:409
this is a simple adaptation of Fftw_convolution_2d to Image input.
Definition: i_mt_convo.h:54
const Sizes & get_sizes() const
read access to the sizes specified at ctor time
Definition: m_convolve.h:470
void convolve(const Image &, Image &, Fftw_convolution_2d::Work_buffer) const
reentrant convolution based on reflecting the input at borders
Definition: i_mt_convo.cpp:92
Fftw_image_convolution(int img_num_rows, int img_num_cols, int mask_max_rows, int mask_max_cols, int fft_alg_type=FFTW_MEASURE)
please see ctor of class Fftw_convolution_2d
Definition: i_mt_convo.h:60
void reflect_and_convolve(const Image &, Image &, Fftw_convolution_2d::Work_buffer) const
reentrant convolution based on reflecting the input at borders
Definition: i_mt_convo.cpp:120
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Code for a wrapper class around the C struct KJB_Image.
for m
Definition: APPgetLargeConnectedEdges.m:64
Wrapped version of the C struct KJB_image.
Definition: i_image.h:76
const Fftw_convolution_2d::Sizes & get_sizes() const
read access to the sizes specified at ctor time
Definition: i_mt_convo.h:96
bool is_mask_set() const
read access of the flag indicating whether the mask has been set
Definition: i_mt_convo.h:102
std::pair< boost::shared_ptr< FFTW_real_vector >, boost::shared_ptr< FFTW_complex_vector > > Work_buffer
Definition: m_convolve.h:406