Ocean
Loading...
Searching...
No Matches
FrameFilterTemplate.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_CV_FRAME_FILTER_TEMPLATE_H
9#define META_OCEAN_CV_FRAME_FILTER_TEMPLATE_H
10
11#include "ocean/cv/CV.h"
12
13#include "ocean/base/Frame.h"
14#include "ocean/base/Worker.h"
15
16#include "ocean/math/Numeric.h"
17
18namespace Ocean
19{
20
21namespace CV
22{
23
24/**
25 * This class implements a 3x3 filter with arbitrary filter pattern.
26 * The filter layout is specified by nine filter factor and one normalization parameter as follows:
27 * <pre>
28 * | tFactor00 tFactor01 tFactor02 |
29 * | tFactor10 tFactor11 tFactor12 |
30 * | tFactor20 tFactor21 tFactor22 |
31 * </pre>
32 * The filter layout is defined for the default pixel direction PixelDirection::PD_NORTH.<br>
33 * The pixel direction PixelDirection::PD_WEST applies the filter layout with a counter clockwise rotation of 90 degrees.<br>
34 * The pixel direction PixelDirection::PD_EAST applies the filter layout with a clockwise rotation of 90 degrees, and so on.
35 * @tparam TFactor Data type of the filter factors
36 * @tparam tFactor00 Filter factor (0, 0)
37 * @tparam tFactor10 Filter factor (1, 0)
38 * @tparam tFactor20 Filter factor (2, 0)
39 * @tparam tFactor01 Filter factor (0, 1)
40 * @tparam tFactor11 Filter factor (1, 1)
41 * @tparam tFactor21 Filter factor (2, 1)
42 * @tparam tFactor02 Filter factor (0, 2)
43 * @tparam tFactor12 Filter factor (1, 2)
44 * @tparam tFactor22 Filter factor (2, 2)
45 * @ingroup cv
46 */
47template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
49{
50 public:
51
52 /**
53 * Definition of the filter factor data type.
54 */
55 typedef TFactor Type;
56
57 public:
58
59 /**
60 * Applies the filter at one pixel position in a frame with zipped data channels (for one of the channels).
61 * This function returns zero for frame border pixels.
62 * @param frame The frame in that the filter will be applied
63 * @param width The width of the frame in pixel, with range [3, infinity)
64 * @param height The height of the frame in pixel, with range [3, infinity)
65 * @param x Horizontal center pixel position of the filter, with range [0, width)
66 * @param y Vertical center pixel position of the filter, width range [0, height)
67 * @return Resulting filter response
68 * @tparam TData Data type of the given frame
69 * @tparam TResponse Data type of the resulting filter response
70 * @tparam TNormalization Data type of the normalization factor (the denominator value)
71 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
72 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
73 * @tparam tChannel The index of the channel for which the filter response is determined, with range [0, tChannels)
74 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
75 * @tparam tDirection Filter direction that is applied
76 */
77 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannel, unsigned int tChannels, PixelDirection tDirection>
78 static TResponse filterPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y);
79
80 /**
81 * Applies the filter at one center pixel position in a frame with zipped data channels (for one of the channels).
82 * This function must not be applied at the frame border.
83 * @param frame Center pixel position in the frame that will be filtered, this pointer must not point to a border pixel of the frame
84 * @param width The width of the frame in pixel, with range [3, infinity)
85 * @return Resulting filter response
86 * @tparam TData Data type of the given frame
87 * @tparam TResponse Data type of the resulting filter response
88 * @tparam TNormalization Data type of the normalization factor (the denominator value)
89 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
90 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
91 * @tparam tChannel The index of the channel for which the filter response is determined, with range [0, tChannels)
92 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
93 * @tparam tDirection Filter direction that is applied
94 */
95 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannel, unsigned int tChannels, PixelDirection tDirection>
96 static TResponse filterPixelCore(const TData* frame, const unsigned int width);
97
98 /**
99 * Applies the filter at one pixel position in a frame with zipped data channels.
100 * This function returns zero for frame border pixels.
101 * @param frame The frame in that the filter will be applied
102 * @param width The width of the frame in pixel, with range [3, infinity)
103 * @param height The height of the frame in pixel, with range [3, infinity)
104 * @param x Horizontal center pixel position of the filter, with range [0, width)
105 * @param y Vertical center pixel position of the filter, width range [0, height)
106 * @param response Resulting filter responses, one for each channel
107 * @tparam TData Data type of the given frame
108 * @tparam TResponse Data type of the resulting filter response
109 * @tparam TNormalization Data type of the normalization factor (the denominator value)
110 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
111 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
112 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
113 * @tparam tDirection Filter direction that is applied
114 */
115 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
116 static void filterPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y, TResponse* response);
117
118 /**
119 * Applies the filter at one center pixel position in a frame with zipped data channels.
120 * This function must not be applied at the frame border.
121 * @param frame Center pixel position in the frame that will be filtered, this pointer must not point to a border pixel of the frame
122 * @param width The width of the frame in pixel, with range [3, infinity)
123 * @param response Resulting filter responses, one for each channel
124 * @tparam TData Data type of the given frame
125 * @tparam TResponse Data type of the resulting filter response
126 * @tparam TNormalization Data type of the normalization factor (the denominator value)
127 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
128 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
129 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
130 * @tparam tDirection Filter direction that is applied
131 */
132 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
133 static void filterPixelCore(const TData* frame, const unsigned int width, TResponse* response);
134
135 /**
136 * Applies the filter at one pixel position in a frame with zipped data channels.
137 * The resulting filter response is the maximal absolute response of all given channels, thus for each pixel one filter response is provided only.<br>
138 * This function returns zero for frame border pixels.
139 * @param frame The frame in that the filter will be applied
140 * @param width The width of the frame in pixel, with range [3, infinity)
141 * @param height The height of the frame in pixel, with range [3, infinity)
142 * @param x Horizontal center pixel position of the filter, with range [0, width)
143 * @param y Vertical center pixel position of the filter, with range [0, height)
144 * @return Resulting filter response
145 * @tparam TData Data type of the given frame
146 * @tparam TResponse Data type of the resulting filter response, should be unsigned as e.g., signed integer values can have no corresponding abs signed integer (like -128, -32768)
147 * @tparam TNormalization Data type of the normalization factor (the denominator value)
148 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
149 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
150 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
151 * @tparam tDirection Filter direction that is applied
152 */
153 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
154 static TResponse filterAbsoluteAs1ChannelPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y);
155
156 /**
157 * Applies the filter at one center pixel position in a frame with zipped data channels.
158 * The resulting filter response is the maximal absolute response of all given channels, thus for each pixel one filter response is provided only.<br>
159 * This function must not be applied at the frame border.
160 * @param frame Center pixel position in the frame that will be filtered, this pointer must not point to a border pixel of the frame
161 * @param width The width of the frame in pixel, with range [3, infinity)
162 * @return Resulting filter response
163 * @tparam TData Data type of the given frame
164 * @tparam TResponse Data type of the resulting filter response, should be unsigned as e.g., signed integer values can have no corresponding abs signed integer (like -128, -32768)
165 * @tparam TNormalization Data type of the normalization factor (the denominator value)
166 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
167 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
168 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
169 * @tparam tDirection Filter direction that is applied
170 */
171 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
172 static TResponse filterAbsoluteAs1ChannelPixelCore(const TData* frame, const unsigned int width);
173
174 /**
175 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a denominator defined as template parameter.
176 * @param frame The frame that will be filtered
177 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
178 * @param width The width of the frame in pixel, with range [3, infinity)
179 * @param height The height of the frame in pixel, with range [3, infinity)
180 * @param channels The number of data channels of the frame, with range [1, 4]
181 * @param direction Filter direction that is applied
182 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
183 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
184 * @param worker Optional worker object to distribute the computation
185 * @tparam TData Data type of the given frame
186 * @tparam TResponse Data type of the resulting filter response
187 * @tparam TNormalization Data type of the normalization factor (the denominator value)
188 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
189 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
190 */
191 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias>
192 static void filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
193
194 /**
195 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a denominator defined as template parameter.
196 * @param frame The frame that will be filtered
197 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
198 * @param width The width of the frame in pixel, with range [3, infinity)
199 * @param height The height of the frame in pixel, with range [3, infinity)
200 * @param direction Filter direction that is applied
201 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
202 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
203 * @param worker Optional worker object to distribute the computation
204 * @tparam TData Data type of the given frame
205 * @tparam TResponse Data type of the resulting filter response
206 * @tparam TNormalization Data type of the normalization factor (the denominator value)
207 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
208 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
209 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
210 */
211 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels>
212 static void filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
213
214 /**
215 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a denominator defined as template parameter.
216 * @param frame The frame that will be filtered
217 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
218 * @param width The width of the frame in pixel, with range [3, infinity)
219 * @param height The height of the frame in pixel, with range [3, infinity)
220 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
221 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
222 * @param worker Optional worker object to distribute the computation
223 * @tparam TData Data type of the given frame
224 * @tparam TResponse Data type of the resulting filter response
225 * @tparam TNormalization Data type of the normalization factor (the denominator value)
226 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
227 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
228 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
229 * @tparam tDirection Filter direction that is applied
230 */
231 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
232 static inline void filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
233
234 /**
235 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a multiplication factor (not a denominator but a nominator) defined as function parameter.
236 * @param frame The frame that will be filtered
237 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
238 * @param width The width of the frame in pixel, with range [3, infinity)
239 * @param height The height of the frame in pixel, with range [3, infinity)
240 * @param factor The normalization factor which will be multiplied with the filter response (it's not a denominator but a nominator)
241 * @param channels The number of data channels of the frame, with range [1, 4]
242 * @param direction Filter direction that is applied
243 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
244 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
245 * @param worker Optional worker object to distribute the computation
246 * @tparam TData Data type of the given frame
247 * @tparam TResponse Data type of the resulting filter response
248 * @tparam TNormalizationFactor Data type of the normalization factor (the nominator value)
249 */
250 template <typename TData, typename TResponse, typename TNormalizationFactor>
251 static void filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
252
253 /**
254 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a multiplication factor (not a denominator but a nominator) defined as function parameter.
255 * @param frame The frame that will be filtered
256 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
257 * @param width The width of the frame in pixel, with range [3, infinity)
258 * @param height The height of the frame in pixel, with range [3, infinity)
259 * @param factor The normalization factor which will be multiplied with the filter response (it's not a denominator but a nominator)
260 * @param direction Filter direction that is applied
261 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
262 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
263 * @param worker Optional worker object to distribute the computation
264 * @tparam TData Data type of the given frame
265 * @tparam TResponse Data type of the resulting filter response
266 * @tparam TNormalizationFactor Data type of the normalization factor (the nominator value)
267 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
268 */
269 template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels>
270 static void filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
271
272 /**
273 * Applies the filter for a given frame with several zipped data channels and normalizes the filter response by a multiplication factor (not a denominator but a nominator) defined as function parameter.
274 * @param frame The frame that will be filtered
275 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
276 * @param width The width of the frame in pixel, with range [3, infinity)
277 * @param height The height of the frame in pixel, with range [3, infinity)
278 * @param factor The normalization factor which will be multiplied with the filter response (it's not a denominator but a nominator)
279 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
280 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
281 * @param worker Optional worker object to distribute the computation
282 * @tparam TData Data type of the given frame
283 * @tparam TResponse Data type of the resulting filter response
284 * @tparam TNormalizationFactor Data type of the normalization factor (the nominator value)
285 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
286 * @tparam tDirection Filter direction that is applied
287 */
288 template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels, PixelDirection tDirection>
289 static inline void filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
290
291 /**
292 * This functions fills an array with the filter factors of this template class.
293 * @param filterFactors The resulting filter factors, with order tFactor00, tFactor10, tFactor20, tFactor01, and so on
294 */
295 static void copyFilterFactors(TFactor filterFactors[9]);
296
297 protected:
298
299 /**
300 * Applies the filter in a subset of a given frame with several zipped data channels and normalizes the filter response by a denominator defined as template parameter.
301 * @param frame The frame that will be filtered
302 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
303 * @param width The width of the frame in pixel, with range [3, infinity)
304 * @param height The height of the frame in pixel, with range [3, infinity)
305 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
306 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
307 * @param firstRow First row to be handled, with range [0, height)
308 * @param numberRows Number of rows to be handled, with range [1, height - firstRow]
309 * @tparam TData Data type of the given frame
310 * @tparam TResponse Data type of the resulting filter response
311 * @tparam TNormalization Data type of the normalization factor (the denominator value)
312 * @tparam tNormalization Denominator value that normalizes the filter response by division, the filter response will be divided by tNormalization, with range (-infinity, infinity) \ {0}
313 * @tparam tNormalizationBias An explicit bias value which will be added to the filter response before the normalization is applied (this bias allows to improve the integer rounding value), 0 to avoid any round optimization, e.g., use tNormalizationBias=2 for tNormlization=4 or use tNormalizationBias=8 for tNormlization=16
314 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
315 * @tparam tDirection Filter direction that is applied
316 */
317 template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tNormalizationBias, unsigned int tChannels, PixelDirection tDirection>
318 static void filterSubset(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows);
319
320 /**
321 * Applies the filter in a subset of a given frame with several zipped data channels and normalizes the filter response by a multiplication factor (not a denominator but a nominator) defined as function parameter.
322 * @param frame The frame that will be filtered
323 * @param target The target buffer receiving the filter responses, one response for each channel and pixel
324 * @param width The width of the frame in pixel, with range [3, infinity)
325 * @param height The height of the frame in pixel, with range [3, infinity)
326 * @param factor The normalization factor which will be multiplied with the filter response (it's not a denominator but a nominator)
327 * @param framePaddingElements Optional padding at the end of each frame row in elements, with range [0, infinity)
328 * @param targetPaddingElements Optional padding at the end of each target row in elements, with range [0, infinity)
329 * @param firstRow First row to be handled, with range [0, height)
330 * @param numberRows Number of rows to be handled, with range [1, height - firstRow]
331 * @tparam TData Data type of the given frame
332 * @tparam TResponse Data type of the resulting filter response
333 * @tparam TNormalizationFactor Data type of the normalization factor (the nominator value)
334 * @tparam tChannels Number of data channels of the frame, with range [1, infinity)
335 * @tparam tDirection Filter direction that is applied
336 */
337 template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels, PixelDirection tDirection>
338 static void filterWithFactorSubset(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows);
339
340 /**
341 * Returns the filter factor of filter element (0, 0).
342 * @return Resulting filter factor depending on the filter direction
343 * @tparam tDirection Filter direction for that the filter factor is requested
344 */
345 template <PixelDirection tDirection>
346 static inline TFactor factor00();
347
348 /**
349 * Returns the filter factor of filter element (1, 0).
350 * @return Resulting filter factor depending on the filter direction
351 * @tparam tDirection Filter direction for that the filter factor is requested
352 */
353 template <PixelDirection tDirection>
354 static inline TFactor factor10();
355
356 /**
357 * Returns the filter factor of filter element (2, 0).
358 * @return Resulting filter factor depending on the filter direction
359 * @tparam tDirection Filter direction for that the filter factor is requested
360 */
361 template <PixelDirection tDirection>
362 static inline TFactor factor20();
363
364 /**
365 * Returns the filter factor of filter element (0, 1).
366 * @return Resulting filter factor depending on the filter direction
367 * @tparam tDirection Filter direction for that the filter factor is requested
368 */
369 template <PixelDirection tDirection>
370 static inline TFactor factor01();
371
372 /**
373 * Returns the filter factor of filter element (1, 1).
374 * @return Resulting filter factor depending on the filter direction
375 * @tparam tDirection Filter direction for that the filter factor is requested
376 */
377 template <PixelDirection tDirection>
378 static inline TFactor factor11();
379
380 /**
381 * Returns the filter factor of filter element (2, 1).
382 * @return Resulting filter factor depending on the filter direction
383 * @tparam tDirection Filter direction for that the filter factor is requested
384 */
385 template <PixelDirection tDirection>
386 static inline TFactor factor21();
387
388 /**
389 * Returns the filter factor of filter element (0, 2).
390 * @return Resulting filter factor depending on the filter direction
391 * @tparam tDirection Filter direction for that the filter factor is requested
392 */
393 template <PixelDirection tDirection>
394 static inline TFactor factor02();
395
396 /**
397 * Returns the filter factor of filter element (1, 2).
398 * @return Resulting filter factor depending on the filter direction
399 * @tparam tDirection Filter direction for that the filter factor is requested
400 */
401 template <PixelDirection tDirection>
402 static inline TFactor factor12();
403
404 /**
405 * Returns the filter factor of filter element (2, 2).
406 * @return Resulting filter factor depending on the filter direction
407 * @tparam tDirection Filter direction for that the filter factor is requested
408 */
409 template <PixelDirection tDirection>
410 static inline TFactor factor22();
411};
412
413/**
414 * This class implements a helper class providing template filter factors.
415 * @tparam tDirection Direction of the filter
416 * @ingroup cv
417 */
418template <PixelDirection tDirection>
420{
421 public:
422
423 /**
424 * Returns the filter factor of the filter element (0, 0)
425 * @tparam TFactor Data type of the filter factors
426 * @tparam tFactor00 Filter factor (0, 0)
427 * @tparam tFactor10 Filter factor (1, 0)
428 * @tparam tFactor20 Filter factor (2, 0)
429 * @tparam tFactor01 Filter factor (0, 1)
430 * @tparam tFactor11 Filter factor (1, 1)
431 * @tparam tFactor21 Filter factor (2, 1)
432 * @tparam tFactor02 Filter factor (0, 2)
433 * @tparam tFactor12 Filter factor (1, 2)
434 * @tparam tFactor22 Filter factor (2, 2)
435 * @return Resulting filter factor depending on the filter direction
436 */
437 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
438 static inline TFactor factor00();
439
440 /**
441 * Returns the filter factor of the filter element (1, 0)
442 * @tparam TFactor Data type of the filter factors
443 * @tparam tFactor00 Filter factor (0, 0)
444 * @tparam tFactor10 Filter factor (1, 0)
445 * @tparam tFactor20 Filter factor (2, 0)
446 * @tparam tFactor01 Filter factor (0, 1)
447 * @tparam tFactor11 Filter factor (1, 1)
448 * @tparam tFactor21 Filter factor (2, 1)
449 * @tparam tFactor02 Filter factor (0, 2)
450 * @tparam tFactor12 Filter factor (1, 2)
451 * @tparam tFactor22 Filter factor (2, 2)
452 * @return Resulting filter factor depending on the filter direction
453 */
454 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
455 static inline TFactor factor10();
456
457 /**
458 * Returns the filter factor of the filter element (2, 0)
459 * @tparam TFactor Data type of the filter factors
460 * @tparam tFactor00 Filter factor (0, 0)
461 * @tparam tFactor10 Filter factor (1, 0)
462 * @tparam tFactor20 Filter factor (2, 0)
463 * @tparam tFactor01 Filter factor (0, 1)
464 * @tparam tFactor11 Filter factor (1, 1)
465 * @tparam tFactor21 Filter factor (2, 1)
466 * @tparam tFactor02 Filter factor (0, 2)
467 * @tparam tFactor12 Filter factor (1, 2)
468 * @tparam tFactor22 Filter factor (2, 2)
469 * @return Resulting filter factor depending on the filter direction
470 */
471 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
472 static inline TFactor factor20();
473
474 /**
475 * Returns the filter factor of the filter element (0, 1)
476 * @tparam TFactor Data type of the filter factors
477 * @tparam tFactor00 Filter factor (0, 0)
478 * @tparam tFactor10 Filter factor (1, 0)
479 * @tparam tFactor20 Filter factor (2, 0)
480 * @tparam tFactor01 Filter factor (0, 1)
481 * @tparam tFactor11 Filter factor (1, 1)
482 * @tparam tFactor21 Filter factor (2, 1)
483 * @tparam tFactor02 Filter factor (0, 2)
484 * @tparam tFactor12 Filter factor (1, 2)
485 * @tparam tFactor22 Filter factor (2, 2)
486 * @return Resulting filter factor depending on the filter direction
487 */
488 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
489 static inline TFactor factor01();
490
491 /**
492 * Returns the filter factor of the filter element (1, 1)
493 * @tparam TFactor Data type of the filter factors
494 * @tparam tFactor00 Filter factor (0, 0)
495 * @tparam tFactor10 Filter factor (1, 0)
496 * @tparam tFactor20 Filter factor (2, 0)
497 * @tparam tFactor01 Filter factor (0, 1)
498 * @tparam tFactor11 Filter factor (1, 1)
499 * @tparam tFactor21 Filter factor (2, 1)
500 * @tparam tFactor02 Filter factor (0, 2)
501 * @tparam tFactor12 Filter factor (1, 2)
502 * @tparam tFactor22 Filter factor (2, 2)
503 * @return Resulting filter factor depending on the filter direction
504 */
505 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
506 static inline TFactor factor11();
507
508 /**
509 * Returns the filter factor of the filter element (2, 1)
510 * @tparam TFactor Data type of the filter factors
511 * @tparam tFactor00 Filter factor (0, 0)
512 * @tparam tFactor10 Filter factor (1, 0)
513 * @tparam tFactor20 Filter factor (2, 0)
514 * @tparam tFactor01 Filter factor (0, 1)
515 * @tparam tFactor11 Filter factor (1, 1)
516 * @tparam tFactor21 Filter factor (2, 1)
517 * @tparam tFactor02 Filter factor (0, 2)
518 * @tparam tFactor12 Filter factor (1, 2)
519 * @tparam tFactor22 Filter factor (2, 2)
520 * @return Resulting filter factor depending on the filter direction
521 */
522 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
523 static inline TFactor factor21();
524
525 /**
526 * Returns the filter factor of the filter element (0, 2)
527 * @tparam TFactor Data type of the filter factors
528 * @tparam tFactor00 Filter factor (0, 0)
529 * @tparam tFactor10 Filter factor (1, 0)
530 * @tparam tFactor20 Filter factor (2, 0)
531 * @tparam tFactor01 Filter factor (0, 1)
532 * @tparam tFactor11 Filter factor (1, 1)
533 * @tparam tFactor21 Filter factor (2, 1)
534 * @tparam tFactor02 Filter factor (0, 2)
535 * @tparam tFactor12 Filter factor (1, 2)
536 * @tparam tFactor22 Filter factor (2, 2)
537 * @return Resulting filter factor depending on the filter direction
538 */
539 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
540 static inline TFactor factor02();
541
542 /**
543 * Returns the filter factor of the filter element (1, 2)
544 * @tparam TFactor Data type of the filter factors
545 * @tparam tFactor00 Filter factor (0, 0)
546 * @tparam tFactor10 Filter factor (1, 0)
547 * @tparam tFactor20 Filter factor (2, 0)
548 * @tparam tFactor01 Filter factor (0, 1)
549 * @tparam tFactor11 Filter factor (1, 1)
550 * @tparam tFactor21 Filter factor (2, 1)
551 * @tparam tFactor02 Filter factor (0, 2)
552 * @tparam tFactor12 Filter factor (1, 2)
553 * @tparam tFactor22 Filter factor (2, 2)
554 * @return Resulting filter factor depending on the filter direction
555 */
556 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
557 static inline TFactor factor12();
558
559 /**
560 * Returns the filter factor of the filter element (2, 2)
561 * @tparam TFactor Data type of the filter factors
562 * @tparam tFactor00 Filter factor (0, 0)
563 * @tparam tFactor10 Filter factor (1, 0)
564 * @tparam tFactor20 Filter factor (2, 0)
565 * @tparam tFactor01 Filter factor (0, 1)
566 * @tparam tFactor11 Filter factor (1, 1)
567 * @tparam tFactor21 Filter factor (2, 1)
568 * @tparam tFactor02 Filter factor (0, 2)
569 * @tparam tFactor12 Filter factor (1, 2)
570 * @tparam tFactor22 Filter factor (2, 2)
571 * @return Resulting filter factor depending on the filter direction
572 */
573 template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
574 static inline TFactor factor22();
575};
576
577template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
578template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannel, unsigned int tChannels, PixelDirection tDirection>
579TResponse FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y)
580{
581 static_assert(tNormalization != 0, "Invalid normalization parameter!");
582 static_assert(tChannel < tChannels, "Invalid channel index!");
583 static_assert(tChannels >= 1u, "Invalid channel number!");
584
585 ocean_assert(frame);
586 ocean_assert(width >= 3u);
587 ocean_assert(height >= 3u);
588
589 ocean_assert((x - 1u < width - 2u) == (x >= 1u && x + 1u < width));
590 ocean_assert((y - 1u < height - 2u) == (y >= 1u && y + 1u < height));
591
592 if (x - 1u < width - 2u && y - 1u < height - 2u)
593 {
594 return filterPixelCore<TData, TResponse, TNormalization, tNormalization, tBias, tChannel, tChannels, tDirection>(frame + (y * width + x) * tChannels, width);
595 }
596 else
597 {
598 return TResponse(0);
599 }
600}
601
602template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
603template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannel, unsigned int tChannels, PixelDirection tDirection>
605{
606 static_assert(tNormalization != 0, "Invalid normalization parameter!");
607 static_assert(tChannel < tChannels, "Invalid channel index!");
608 static_assert(tChannels >= 1u, "Invalid channel number!");
609
610 ocean_assert(frame);
611 ocean_assert(width >= 3u);
612
613 const unsigned int cWidth = width * tChannels;
614
615 return TResponse((TNormalization(*(frame - cWidth - tChannels + tChannel) * factor00<tDirection>() + *(frame - cWidth + tChannel) * factor01<tDirection>() + *(frame - cWidth + tChannels + tChannel) * factor02<tDirection>()
616 + *(frame - tChannels + tChannel) * factor10<tDirection>() + *(frame + tChannel) * factor11<tDirection>() + *(frame + tChannels + tChannel) * factor12<tDirection>()
617 + *(frame + cWidth - tChannels + tChannel) * factor20<tDirection>() + *(frame + cWidth + tChannel) * factor21<tDirection>() + *(frame + cWidth + tChannels + tChannel) * factor22<tDirection>()) + tBias) / tNormalization);
618}
619
620template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
621template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
622void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y, TResponse* response)
623{
624 static_assert(tNormalization != 0, "Invalid normalization parameter!");
625 static_assert(tChannels >= 1u, "Invalid channel number!");
626
627 ocean_assert(frame);
628 ocean_assert(width >= 3u);
629 ocean_assert(height >= 3u);
630
631 ocean_assert((x - 1u < width - 2u) == (x >= 1u && x + 1u < width));
632 ocean_assert((y - 1u < height - 2u) == (y >= 1u && y + 1u < height));
633
634 if (x - 1u < width - 2u && y - 1u < height - 2u)
635 {
636 return filterPixelCore<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, tDirection>(frame + (y * width + x) * tChannels, width, response);
637 }
638 else
639 {
640 for (unsigned int n = 0u; n < tChannels; ++n)
641 {
642 response[n] = TResponse(0);
643 }
644 }
645}
646
647template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
648template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
650{
651 static_assert(tNormalization != 0, "Invalid normalization parameter!");
652 static_assert(tChannels >= 1u, "Invalid channel number!");
653
654 ocean_assert(frame);
655 ocean_assert(width >= 3u);
656
657 const unsigned int cWidth = width * tChannels;
658
659 for (unsigned int n = 0u; n < tChannels; ++n)
660 {
661 response[n] = TResponse((TNormalization(*(frame - cWidth - tChannels + n) * factor00<tDirection>() + *(frame - cWidth + n) * factor01<tDirection>() + *(frame - cWidth + tChannels + n) * factor02<tDirection>()
662 + *(frame - tChannels + n) * factor10<tDirection>() + *(frame + n) * factor11<tDirection>() + *(frame + tChannels + n) * factor12<tDirection>()
663 + *(frame + cWidth - tChannels + n) * factor20<tDirection>() + *(frame + cWidth + n) * factor21<tDirection>() + *(frame + cWidth + tChannels + n) * factor22<tDirection>()) + tBias) / tNormalization);
664 }
665}
666
667template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
668template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
669TResponse FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterAbsoluteAs1ChannelPixel(const TData* frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y)
670{
671 static_assert(tNormalization != 0, "Invalid normalization parameter!");
672 static_assert(tChannels >= 1u, "Invalid channel number!");
673
674 ocean_assert(frame);
675 ocean_assert(width >= 3u);
676 ocean_assert(height >= 3u);
677
678 ocean_assert((x - 1u < width - 2u) == (x >= 1u && x + 1u < width));
679 ocean_assert((y - 1u < height - 2u) == (y >= 1u && y + 1u < height));
680
681 if (x - 1u < width - 2u && y - 1u < height - 2u)
682 {
683 return filterAbsoluteAs1ChannelPixelCore<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, tDirection>(frame + (y * width + x) * tChannels, width);
684 }
685 else
686 {
687 return TResponse(0);
688 }
689}
690
691template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
692template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
694{
695 static_assert(tNormalization != 0, "Invalid normalization parameter!");
696 static_assert(tChannels >= 1u, "Invalid channel number!");
697
698 ocean_assert(frame);
699 ocean_assert(width >= 3u);
700
701 const unsigned int cWidth = width * tChannels;
702
703 TResponse value = TResponse(NumericT<TNormalization>::secureAbs((TNormalization(*(frame - cWidth - tChannels) * factor00<tDirection>() + *(frame - cWidth) * factor01<tDirection>() + *(frame - cWidth + tChannels) * factor02<tDirection>()
704 + *(frame - tChannels) * factor10<tDirection>() + *(frame) * factor11<tDirection>() + *(frame + tChannels) * factor12<tDirection>()
705 + *(frame + cWidth - tChannels) * factor20<tDirection>() + *(frame + cWidth) * factor21<tDirection>() + *(frame + cWidth + tChannels) * factor22<tDirection>()) + tBias) / tNormalization));
706
707 for (unsigned int n = 1u; n < tChannels; ++n)
708 {
709 TResponse newValue = TResponse(NumericT<TNormalization>::secureAbs((TNormalization(*(frame - cWidth - tChannels + n) * factor00<tDirection>() + *(frame - cWidth + n) * factor01<tDirection>() + *(frame - cWidth + tChannels + n) * factor02<tDirection>()
710 + *(frame - tChannels + n) * factor10<tDirection>() + *(frame + n) * factor11<tDirection>() + *(frame + tChannels + n) * factor12<tDirection>()
711 + *(frame + cWidth - tChannels + n) * factor20<tDirection>() + *(frame + cWidth + n) * factor21<tDirection>() + *(frame + cWidth + tChannels + n) * factor22<tDirection>()) + tBias) / tNormalization));
712
713 if (newValue > value)
714 {
715 value = newValue;
716 }
717 }
718
719 return value;
720}
721
722template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
723template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias>
724void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
725{
726 switch (channels)
727 {
728 case 1u:
729 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, 1u>(frame, target, width, height, direction, framePaddingElements, targetPaddingElements, worker);
730 break;
731
732 case 2u:
733 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, 2u>(frame, target, width, height, direction, framePaddingElements, targetPaddingElements, worker);
734 break;
735
736 case 3u:
737 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, 3u>(frame, target, width, height, direction, framePaddingElements, targetPaddingElements, worker);
738 break;
739
740 case 4u:
741 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, 4u>(frame, target, width, height, direction, framePaddingElements, targetPaddingElements, worker);
742 break;
743
744 default:
745 ocean_assert(false && "Invalid channel number!");
746 }
747}
748
749template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
750template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels>
751void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
752{
753 static_assert(tChannels >= 1u, "Invaild channel number!");
754
755 switch (direction)
756 {
757 case PD_NORTH:
758 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_NORTH>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
759 break;
760
761 case PD_NORTH_WEST:
762 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_NORTH_WEST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
763 break;
764
765 case PD_WEST:
766 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_WEST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
767 break;
768
769 case PD_SOUTH_WEST:
770 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_SOUTH_WEST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
771 break;
772
773 case PD_SOUTH:
774 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_SOUTH>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
775 break;
776
777 case PD_SOUTH_EAST:
778 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_SOUTH_EAST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
779 break;
780
781 case PD_EAST:
782 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_EAST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
783 break;
784
785 case PD_NORTH_EAST:
786 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filter<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, PD_NORTH_EAST>(frame, target, width, height, framePaddingElements, targetPaddingElements, worker);
787 break;
788
789 default:
790 ocean_assert(false && "Invalid orientation!");
791 }
792}
793
794template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
795template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
796inline void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filter(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
797{
798 static_assert(tChannels >= 1u, "Invaild channel number!");
799
800 if (worker)
801 {
802 worker->executeFunction(Worker::Function::createStatic(&filterSubset<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, tDirection>, frame, target, width, height, framePaddingElements, targetPaddingElements, 0u, 0u), 0u, height, 6u, 7u, 20u);
803 }
804 else
805 {
806 filterSubset<TData, TResponse, TNormalization, tNormalization, tBias, tChannels, tDirection>(frame, target, width, height, framePaddingElements, targetPaddingElements, 0u, height);
807 }
808}
809
810template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
811template <typename TData, typename TResponse, typename TNormalizationFactor>
812void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
813{
814 switch (channels)
815 {
816 case 1u:
817 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, 1u>(frame, target, width, height, factor, direction, framePaddingElements, targetPaddingElements, worker);
818 break;
819
820 case 2u:
821 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, 2u>(frame, target, width, height, factor, direction, framePaddingElements, targetPaddingElements, worker);
822 break;
823
824 case 3u:
825 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, 3u>(frame, target, width, height, factor, direction, framePaddingElements, targetPaddingElements, worker);
826 break;
827
828 case 4u:
829 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, 4u>(frame, target, width, height, factor, direction, framePaddingElements, targetPaddingElements, worker);
830 break;
831
832 default:
833 ocean_assert(false && "Invalid channel number!");
834 }
835}
836
837template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
838template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels>
839void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
840{
841 static_assert(tChannels >= 1u, "Invaild channel number!");
842
843 switch (direction)
844 {
845 case PD_NORTH:
846 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_NORTH>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
847 break;
848
849 case PD_NORTH_WEST:
850 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_NORTH_WEST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
851 break;
852
853 case PD_WEST:
854 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_WEST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
855 break;
856
857 case PD_SOUTH_WEST:
858 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_SOUTH_WEST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
859 break;
860
861 case PD_SOUTH:
862 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_SOUTH>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
863 break;
864
865 case PD_SOUTH_EAST:
866 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_SOUTH_EAST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
867 break;
868
869 case PD_EAST:
870 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_EAST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
871 break;
872
873 case PD_NORTH_EAST:
874 CV::FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::template filterWithFactor<TData, TResponse, TNormalizationFactor, tChannels, PD_NORTH_EAST>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, worker);
875 break;
876
877 default:
878 ocean_assert(false && "Invalid orientation!");
879 }
880}
881
882template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
883template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels, PixelDirection tDirection>
884inline void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterWithFactor(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker* worker)
885{
886 static_assert(tChannels >= 1u, "Invaild channel number!");
887
888 if (worker)
889 {
890 worker->executeFunction(Worker::Function::createStatic(&filterWithFactorSubset<TData, TResponse, TNormalizationFactor, tChannels, tDirection>, frame, target, width, height, factor, framePaddingElements, targetPaddingElements, 0u, 0u), 0u, height, 7u, 8u, 20u);
891 }
892 else
893 {
894 filterWithFactorSubset<TData, TResponse, TNormalizationFactor, tChannels, tDirection>(frame, target, width, height, factor, framePaddingElements, targetPaddingElements, 0u, height);
895 }
896}
897
898template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
900{
901 filterFactors[0] = tFactor00;
902 filterFactors[1] = tFactor10;
903 filterFactors[2] = tFactor20;
904
905 filterFactors[3] = tFactor01;
906 filterFactors[4] = tFactor11;
907 filterFactors[5] = tFactor21;
908
909 filterFactors[6] = tFactor02;
910 filterFactors[7] = tFactor12;
911 filterFactors[8] = tFactor22;
912}
913
914template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
915template <typename TData, typename TResponse, typename TNormalization, TNormalization tNormalization, TNormalization tBias, unsigned int tChannels, PixelDirection tDirection>
916void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterSubset(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
917{
918 static_assert(tChannels >= 1u, "Invaild channel number!");
919
920 ocean_assert(frame && target);
921 ocean_assert(width >= 3u);
922 ocean_assert(firstRow + numberRows <= height);
923
924 const unsigned int frameStrideElements = width * tChannels + framePaddingElements;
925 const unsigned int targetStrideElements = width * tChannels + targetPaddingElements;
926
927 // check whether the first row has set to zero
928 if (firstRow == 0u)
929 {
930 for (unsigned int n = 0u; n < width * tChannels; ++n)
931 {
932 target[n] = TResponse(0);
933 }
934 }
935
936 const unsigned int beginFilterRow = max(0, int(firstRow) - 1) + 1; // inclusive filter position
937 const unsigned int endFilterRow = min(firstRow + numberRows + 1, height) - 1; // exclusive filter position
938
939 frame += beginFilterRow * frameStrideElements;
940 target += beginFilterRow * targetStrideElements;
941
942 const TData* const frameEnd = frame + (endFilterRow - beginFilterRow) * frameStrideElements;
943
944 while (frame != frameEnd)
945 {
946 ocean_assert(frame < frameEnd);
947
948 // set first row pixel to zero
949 for (unsigned int n = 0u; n < tChannels; ++n)
950 {
951 target[n] = 0;
952 }
953
954 frame += tChannels;
955 target += tChannels;
956
957 const TData* const frameRowEnd = frame + (width - 2u) * tChannels;
958
959 while (frame != frameRowEnd)
960 {
961 ocean_assert(frame < frameEnd);
962 ocean_assert(frame < frameRowEnd);
963
964 const TData* const topRow = frame - frameStrideElements;
965 const TData* const bottomRow = frame + frameStrideElements;
966
967 for (unsigned int n = 0u; n < tChannels; ++n)
968 {
969 target[n] = TResponse((TNormalization(
970 *(topRow - tChannels + n) * factor00<tDirection>()
971 + *(topRow + n) * factor01<tDirection>()
972 + *(topRow + tChannels + n) * factor02<tDirection>()
973 + *(frame - tChannels + n) * factor10<tDirection>()
974 + *(frame + n) * factor11<tDirection>()
975 + *(frame + tChannels + n) * factor12<tDirection>()
976 + *(bottomRow - tChannels + n) * factor20<tDirection>()
977 + *(bottomRow + n) * factor21<tDirection>()
978 + *(bottomRow + tChannels + n) * factor22<tDirection>()) + tBias) / tNormalization);
979 }
980
981 target += tChannels;
982 frame += tChannels;
983 }
984
985 // set last row pixel to zero
986 for (unsigned int n = 0u; n < tChannels; ++n)
987 {
988 target[n] = 0;
989 }
990
991 frame += tChannels;
992 target += tChannels;
993
994 frame += framePaddingElements;
995 target += targetPaddingElements;
996 }
997
998 // check whether the last row has to to zero
999 if (firstRow + numberRows == height)
1000 {
1001 for (unsigned int n = 0u; n < width * tChannels; ++n)
1002 {
1003 target[n] = TResponse(0);
1004 }
1005 }
1006}
1007
1008template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1009template <typename TData, typename TResponse, typename TNormalizationFactor, unsigned int tChannels, PixelDirection tDirection>
1010void FrameFilterTemplate<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>::filterWithFactorSubset(const TData* frame, TResponse* target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
1011{
1012 static_assert(tChannels >= 1u, "Invaild channel number!");
1013
1014 ocean_assert(frame && target);
1015 ocean_assert(width >= 3u);
1016 ocean_assert(firstRow + numberRows <= height);
1017
1018 const unsigned int frameStrideElements = width * tChannels + framePaddingElements;
1019 const unsigned int targetStrideElements = width * tChannels + targetPaddingElements;
1020
1021 // check whether the first row has set to zero
1022 if (firstRow == 0u)
1023 {
1024 for (unsigned int n = 0u; n < width * tChannels; ++n)
1025 {
1026 target[n] = TResponse(0);
1027 }
1028 }
1029
1030 const unsigned int beginFilterRow = max(0, int(firstRow) - 1) + 1; // inclusive filter position
1031 const unsigned int endFilterRow = min(firstRow + numberRows + 1, height) - 1; // exclusive filter position
1032
1033 frame += beginFilterRow * frameStrideElements;
1034 target += beginFilterRow * targetStrideElements;
1035
1036 const TData* const frameEnd = frame + (endFilterRow - beginFilterRow) * frameStrideElements;
1037
1038 while (frame != frameEnd)
1039 {
1040 ocean_assert(frame < frameEnd);
1041
1042 // set first row pixel to zero
1043 for (unsigned int n = 0u; n < tChannels; ++n)
1044 {
1045 target[n] = 0;
1046 }
1047
1048 frame += tChannels;
1049 target += tChannels;
1050
1051 const TData* const frameRowEnd = frame + (width - 2u) * tChannels;
1052
1053 while (frame != frameRowEnd)
1054 {
1055 ocean_assert(frame < frameEnd);
1056 ocean_assert(frame < frameRowEnd);
1057
1058 const TData* const topRow = frame - frameStrideElements;
1059 const TData* const bottomRow = frame + frameStrideElements;
1060
1061 for (unsigned int n = 0u; n < tChannels; ++n)
1062 {
1063 target[n] = TResponse(TNormalizationFactor(
1064 *(topRow - tChannels + n) * factor00<tDirection>()
1065 + *(topRow + n) * factor01<tDirection>()
1066 + *(topRow + tChannels + n) * factor02<tDirection>()
1067 + *(frame - tChannels + n) * factor10<tDirection>()
1068 + *(frame + n) * factor11<tDirection>()
1069 + *(frame + tChannels + n) * factor12<tDirection>()
1070 + *(bottomRow - tChannels + n) * factor20<tDirection>()
1071 + *(bottomRow + n) * factor21<tDirection>()
1072 + *(bottomRow + tChannels + n) * factor22<tDirection>()) * factor);
1073 }
1074
1075 target += tChannels;
1076 frame += tChannels;
1077 }
1078
1079 // set last row pixel to zero
1080 for (unsigned int n = 0u; n < tChannels; ++n)
1081 {
1082 target[n] = 0;
1083 }
1084
1085 frame += tChannels;
1086 target += tChannels;
1087
1088 frame += framePaddingElements;
1089 target += targetPaddingElements;
1090 }
1091
1092 // check whether the last row has to to zero
1093 if (firstRow + numberRows == height)
1094 {
1095 for (unsigned int n = 0u; n < width * tChannels; ++n)
1096 {
1097 target[n] = TResponse(0);
1098 }
1099 }
1100}
1101
1102template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1103template <PixelDirection tDirection>
1105{
1106 return FrameFilterFactorProvider<tDirection>::template factor00<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1107}
1108
1109template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1110template <PixelDirection tDirection>
1112{
1113 return FrameFilterFactorProvider<tDirection>::template factor10<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1114}
1115
1116template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1117template <PixelDirection tDirection>
1119{
1120 return FrameFilterFactorProvider<tDirection>::template factor20<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1121}
1122
1123template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1124template <PixelDirection tDirection>
1126{
1127 return FrameFilterFactorProvider<tDirection>::template factor01<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1128}
1129
1130template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1131template <PixelDirection tDirection>
1133{
1134 return FrameFilterFactorProvider<tDirection>::template factor11<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1135}
1136
1137template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1138template <PixelDirection tDirection>
1140{
1141 return FrameFilterFactorProvider<tDirection>::template factor21<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1142}
1143
1144template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1145template <PixelDirection tDirection>
1147{
1148 return FrameFilterFactorProvider<tDirection>::template factor02<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1149}
1150
1151template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1152template <PixelDirection tDirection>
1154{
1155 return FrameFilterFactorProvider<tDirection>::template factor12<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1156}
1157
1158template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1159template <PixelDirection tDirection>
1161{
1162 return FrameFilterFactorProvider<tDirection>::template factor22<TFactor, tFactor00, tFactor10, tFactor20, tFactor01, tFactor11, tFactor21, tFactor02, tFactor12, tFactor22>();
1163}
1164
1165template <PixelDirection tDirection>
1166template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1168{
1169 return tFactor00;
1170}
1171
1172template <>
1173template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1175{
1176 return tFactor01;
1177}
1178
1179template <>
1180template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1182{
1183 return tFactor02;
1184}
1185
1186template <>
1187template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1189{
1190 return tFactor12;
1191}
1192
1193template <>
1194template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1196{
1197 return tFactor22;
1198}
1199
1200template <>
1201template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1203{
1204 return tFactor21;
1205}
1206
1207template <>
1208template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1210{
1211 return tFactor20;
1212}
1213
1214template <>
1215template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1217{
1218 return tFactor10;
1219}
1220
1221template <PixelDirection tDirection>
1222template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1224{
1225 return tFactor10;
1226}
1227
1228template <>
1229template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1231{
1232 return tFactor00;
1233}
1234
1235template <>
1236template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1238{
1239 return tFactor01;
1240}
1241
1242template <>
1243template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1245{
1246 return tFactor02;
1247}
1248
1249template <>
1250template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1252{
1253 return tFactor12;
1254}
1255
1256template <>
1257template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1259{
1260 return tFactor22;
1261}
1262
1263template <>
1264template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1266{
1267 return tFactor21;
1268}
1269
1270template <>
1271template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1273{
1274 return tFactor20;
1275}
1276
1277template <PixelDirection tDirection>
1278template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1280{
1281 return tFactor20;
1282}
1283
1284template <>
1285template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1287{
1288 return tFactor10;
1289}
1290
1291template <>
1292template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1294{
1295 return tFactor00;
1296}
1297
1298template <>
1299template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1301{
1302 return tFactor01;
1303}
1304
1305template <>
1306template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1308{
1309 return tFactor02;
1310}
1311
1312template <>
1313template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1315{
1316 return tFactor12;
1317}
1318
1319template <>
1320template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1322{
1323 return tFactor22;
1324}
1325
1326template <>
1327template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1329{
1330 return tFactor21;
1331}
1332
1333template <PixelDirection tDirection>
1334template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1336{
1337 return tFactor01;
1338}
1339
1340template <>
1341template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1343{
1344 return tFactor02;
1345}
1346
1347template <>
1348template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1350{
1351 return tFactor12;
1352}
1353
1354template <>
1355template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1357{
1358 return tFactor22;
1359}
1360
1361template <>
1362template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1364{
1365 return tFactor21;
1366}
1367
1368template <>
1369template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1371{
1372 return tFactor20;
1373}
1374
1375template <>
1376template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1378{
1379 return tFactor10;
1380}
1381
1382template <>
1383template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1385{
1386 return tFactor00;
1387}
1388
1389template <PixelDirection tDirection>
1390template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1392{
1393 return tFactor11;
1394}
1395
1396template <PixelDirection tDirection>
1397template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1399{
1400 return tFactor21;
1401}
1402
1403template <>
1404template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1406{
1407 return tFactor20;
1408}
1409
1410template <>
1411template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1413{
1414 return tFactor10;
1415}
1416
1417template <>
1418template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1420{
1421 return tFactor00;
1422}
1423
1424template <>
1425template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1427{
1428 return tFactor01;
1429}
1430
1431template <>
1432template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1434{
1435 return tFactor02;
1436}
1437
1438template <>
1439template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1441{
1442 return tFactor12;
1443}
1444
1445template <>
1446template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1448{
1449 return tFactor22;
1450}
1451
1452template <PixelDirection tDirection>
1453template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1455{
1456 return tFactor02;
1457}
1458
1459template <>
1460template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1462{
1463 return tFactor12;
1464}
1465
1466template <>
1467template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1469{
1470 return tFactor22;
1471}
1472
1473template <>
1474template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1476{
1477 return tFactor21;
1478}
1479
1480template <>
1481template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1483{
1484 return tFactor20;
1485}
1486
1487template <>
1488template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1490{
1491 return tFactor10;
1492}
1493
1494template <>
1495template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1497{
1498 return tFactor00;
1499}
1500
1501template <>
1502template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1504{
1505 return tFactor01;
1506}
1507
1508template <PixelDirection tDirection>
1509template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1511{
1512 return tFactor12;
1513}
1514
1515template <>
1516template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1518{
1519 return tFactor22;
1520}
1521
1522template <>
1523template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1525{
1526 return tFactor21;
1527}
1528
1529template <>
1530template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1532{
1533 return tFactor20;
1534}
1535
1536template <>
1537template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1539{
1540 return tFactor10;
1541}
1542
1543template <>
1544template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1546{
1547 return tFactor00;
1548}
1549
1550template <>
1551template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1553{
1554 return tFactor01;
1555}
1556
1557template <>
1558template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1560{
1561 return tFactor02;
1562}
1563
1564template <PixelDirection tDirection>
1565template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1567{
1568 return tFactor22;
1569}
1570
1571template <>
1572template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1574{
1575 return tFactor21;
1576}
1577
1578template <>
1579template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1581{
1582 return tFactor20;
1583}
1584
1585template <>
1586template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1588{
1589 return tFactor10;
1590}
1591
1592template <>
1593template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1595{
1596 return tFactor00;
1597}
1598
1599template <>
1600template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1602{
1603 return tFactor01;
1604}
1605
1606template <>
1607template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1609{
1610 return tFactor02;
1611}
1612
1613template <>
1614template <typename TFactor, TFactor tFactor00, TFactor tFactor10, TFactor tFactor20, TFactor tFactor01, TFactor tFactor11, TFactor tFactor21, TFactor tFactor02, TFactor tFactor12, TFactor tFactor22>
1616{
1617 return tFactor12;
1618}
1619
1620}
1621
1622}
1623
1624#endif // META_OCEAN_CV_FRAME_FILTER_TEMPLATE_H
This class implements a helper class providing template filter factors.
Definition FrameFilterTemplate.h:420
static TFactor factor02()
Returns the filter factor of the filter element (0, 2)
Definition FrameFilterTemplate.h:1454
static TFactor factor12()
Returns the filter factor of the filter element (1, 2)
Definition FrameFilterTemplate.h:1510
static TFactor factor20()
Returns the filter factor of the filter element (2, 0)
Definition FrameFilterTemplate.h:1279
static TFactor factor22()
Returns the filter factor of the filter element (2, 2)
Definition FrameFilterTemplate.h:1566
static TFactor factor10()
Returns the filter factor of the filter element (1, 0)
Definition FrameFilterTemplate.h:1223
static TFactor factor21()
Returns the filter factor of the filter element (2, 1)
Definition FrameFilterTemplate.h:1398
static TFactor factor11()
Returns the filter factor of the filter element (1, 1)
Definition FrameFilterTemplate.h:1391
static TFactor factor00()
Returns the filter factor of the filter element (0, 0)
Definition FrameFilterTemplate.h:1167
static TFactor factor01()
Returns the filter factor of the filter element (0, 1)
Definition FrameFilterTemplate.h:1335
This class implements a 3x3 filter with arbitrary filter pattern.
Definition FrameFilterTemplate.h:49
static TFactor factor21()
Returns the filter factor of filter element (2, 1).
Definition FrameFilterTemplate.h:1139
static void filter(const TData *frame, TResponse *target, const unsigned int width, const unsigned int height, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Applies the filter for a given frame with several zipped data channels and normalizes the filter resp...
Definition FrameFilterTemplate.h:724
static TFactor factor01()
Returns the filter factor of filter element (0, 1).
Definition FrameFilterTemplate.h:1125
static TFactor factor00()
Returns the filter factor of filter element (0, 0).
Definition FrameFilterTemplate.h:1104
static TResponse filterPixelCore(const TData *frame, const unsigned int width)
Applies the filter at one center pixel position in a frame with zipped data channels (for one of the ...
Definition FrameFilterTemplate.h:604
TFactor Type
Definition of the filter factor data type.
Definition FrameFilterTemplate.h:55
static TFactor factor12()
Returns the filter factor of filter element (1, 2).
Definition FrameFilterTemplate.h:1153
static void copyFilterFactors(TFactor filterFactors[9])
This functions fills an array with the filter factors of this template class.
Definition FrameFilterTemplate.h:899
static void filterWithFactor(const TData *frame, TResponse *target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int channels, const PixelDirection direction, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Applies the filter for a given frame with several zipped data channels and normalizes the filter resp...
Definition FrameFilterTemplate.h:812
static TResponse filterAbsoluteAs1ChannelPixelCore(const TData *frame, const unsigned int width)
Applies the filter at one center pixel position in a frame with zipped data channels.
Definition FrameFilterTemplate.h:693
static TResponse filterPixel(const TData *frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y)
Applies the filter at one pixel position in a frame with zipped data channels (for one of the channel...
Definition FrameFilterTemplate.h:579
static void filterWithFactorSubset(const TData *frame, TResponse *target, const unsigned int width, const unsigned int height, const TNormalizationFactor factor, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
Applies the filter in a subset of a given frame with several zipped data channels and normalizes the ...
Definition FrameFilterTemplate.h:1010
static TResponse filterAbsoluteAs1ChannelPixel(const TData *frame, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y)
Applies the filter at one pixel position in a frame with zipped data channels.
Definition FrameFilterTemplate.h:669
static TFactor factor10()
Returns the filter factor of filter element (1, 0).
Definition FrameFilterTemplate.h:1111
static TFactor factor22()
Returns the filter factor of filter element (2, 2).
Definition FrameFilterTemplate.h:1160
static TFactor factor20()
Returns the filter factor of filter element (2, 0).
Definition FrameFilterTemplate.h:1118
static TFactor factor11()
Returns the filter factor of filter element (1, 1).
Definition FrameFilterTemplate.h:1132
static TFactor factor02()
Returns the filter factor of filter element (0, 2).
Definition FrameFilterTemplate.h:1146
static void filterSubset(const TData *frame, TResponse *target, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
Applies the filter in a subset of a given frame with several zipped data channels and normalizes the ...
Definition FrameFilterTemplate.h:916
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition Caller.h:2876
This class provides basic numeric functionalities.
Definition Numeric.h:57
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
PixelDirection
Definition of individual directions with pixel accuracy.
Definition CV.h:85
@ PD_WEST
Definition CV.h:93
@ PD_NORTH_EAST
Definition CV.h:103
@ PD_NORTH_WEST
Definition CV.h:91
@ PD_EAST
Definition CV.h:101
@ PD_SOUTH_WEST
Definition CV.h:95
@ PD_SOUTH
Definition CV.h:97
@ PD_SOUTH_EAST
Definition CV.h:99
@ PD_NORTH
Definition CV.h:89
The namespace covering the entire Ocean framework.
Definition Accessor.h:15