Ocean
FrameFilterPatch.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_PATCH_H
9 #define META_OCEAN_CV_FRAME_FILTER_PATCH_H
10 
11 #include "ocean/cv/CV.h"
12 #include "ocean/cv/FrameFilter.h"
13 #include "ocean/cv/PixelPosition.h"
14 
15 #include "ocean/base/Frame.h"
16 #include "ocean/base/Worker.h"
17 
18 namespace Ocean
19 {
20 
21 namespace CV
22 {
23 
24 /**
25  * This class implements a patch frame filter.
26  * @ingroup cv
27  */
28 class OCEAN_CV_EXPORT FrameFilterPatch : public FrameFilter
29 {
30  public:
31 
32  /**
33  * Filters a given 1 channel 8 bit grayscale frame.
34  * @param source The source frame to be filtered, must be valid
35  * @param target The target frame receiving the filtering result, must be valid
36  * @param width The width of the frame in pixel, with range [1, infinity)
37  * @param height The height of the frame in pixel, with range [1, infinity)
38  * @param patchSize Size of the patches to be used, with range [1, infinity)
39  * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
40  * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
41  * @param worker Optional worker object to distribute the computation
42  */
43  static void filter1Channel8Bit(const uint8_t* source, uint8_t* target, const unsigned int width, const unsigned int height, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker* worker = nullptr);
44 
45  private:
46 
47  /**
48  * Filters a subset of a given 1 channel 8 bit grayscale frame.
49  * This functions used the integral image of the original frame to speed up the computation.<br>
50  * The given integral image is expected have have an extra border with size identical to the specified patch size.
51  * @param borderedIntegral Bordered integral image to be used for filtering, must be valid
52  * @param target The target frame receiving the filtering result, must be valid
53  * @param width The width of the original image in pixel, with range [1, infinity)
54  * @param height The height of the original image in pixel, with range [1, infinity)
55  * @param patchSize Size of the patches to be used, with range [1, infinity)
56  * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
57  * @param firstRow First row to be filtered, with range [0, height - 1]
58  * @param numberRows Number of rows to be filtered, with range [1, height - firstRow]
59  * @see IntegralImage
60  */
61  static void filter1Channel8BitSubset(const uint32_t* borderedIntegral, uint8_t* target, const unsigned int width, const unsigned int height, const unsigned int patchSize, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows);
62 };
63 
64 }
65 
66 }
67 
68 #endif // META_OCEAN_CV_FRAME_FILTER_PATCH_H
This class implements the base class for all filter.
Definition: FrameFilter.h:29
This class implements a patch frame filter.
Definition: FrameFilterPatch.h:29
static void filter1Channel8BitSubset(const uint32_t *borderedIntegral, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int patchSize, const unsigned int targetPaddingElements, const unsigned int firstRow, const unsigned int numberRows)
Filters a subset of a given 1 channel 8 bit grayscale frame.
static void filter1Channel8Bit(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, Worker *worker=nullptr)
Filters a given 1 channel 8 bit grayscale frame.
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15