Ocean
Loading...
Searching...
No Matches
AdvancedFrameConverter.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_ADVANCED_ADVANCED_FRAME_CONVERTER_H
9#define META_OCEAN_CV_ADVANCED_ADVANCED_FRAME_CONVERTER_H
10
12
13#include "ocean/base/Frame.h"
14#include "ocean/base/Worker.h"
15
16namespace Ocean
17{
18
19namespace CV
20{
21
22namespace Advanced
23{
24
25/**
26 * This class implements a frame converter creating advanced and artificial pixel formats.
27 * @ingroup cvadvanced
28 */
29class OCEAN_CV_ADVANCED_EXPORT AdvancedFrameConverter
30{
31 public:
32
33 /**
34 * Converts a 3 channel 24 bit color frame to a 2 channel 16 bit color (with YU component) and 1 channel 8 bit texture frame.
35 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
36 * @param source The source frame to convert
37 * @param target The target frame receiving the converted frame
38 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
39 * @param worker Optional worker object to distribute the computation
40 * @return True, if succeeded
41 */
42 static bool convertToYUT24ScharrMagnitude(const Frame& source, Frame& target, const unsigned int window = 11u, Worker* worker = nullptr);
43
44 /**
45 * Converts a 4 channel 32 bit color frame to a 3 channel 24 bit color (with YUV component) and 1 channel 8 bit texture frame.
46 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
47 * @param source The source frame to convert
48 * @param target The target frame receiving the converted frame
49 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
50 * @param worker Optional worker object to distribute the computation
51 * @return True, if succeeded
52 */
53 static bool convertToYUVT32ScharrMagnitude(const Frame& source, Frame& target, const unsigned int window = 11u, Worker* worker = nullptr);
54
55 /**
56 * Converts a 4 channel 32 bit color frame to a 3 channel 24 bit color (with RGB component) and 1 channel 8 bit texture frame.
57 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
58 * @param source The source frame to convert
59 * @param target The target frame receiving the converted frame
60 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
61 * @param worker Optional worker object to distribute the computation
62 * @return True, if succeeded
63 */
64 static bool convertToRGBT32ScharrMagnitude(const Frame& source, Frame& target, const unsigned int window = 11u, Worker* worker = nullptr);
65
66 /**
67 * Converts a given frame into a RGB frame with additional (fourth) texture channel.
68 * The texture is determined by the absolute magnitude of the horizontal and vertical Scharr filter response.
69 * @param source The source frame to be converted
70 * @param target The target frame receiving the converted frame
71 * @param worker Optional worker object to distribute the computation
72 * @return True, if succeeded
73 */
74 static bool convertToRGBT32ScharrMagnitude(const Frame& source, Frame& target, Worker* worker = nullptr);
75
76 /**
77 * Converts a given frame into a mean filtered YUV frame with extended Laplace (magnitude) channels.
78 * First, the frame is converted in a YUV frame. Second, for each channel the magnitude Laplace filter response is determined and added as additional channel.<br>
79 * Finally, each channel is filtered by a mean filter with specified filter size.
80 * @param source The source frame which will be converted
81 * @param target The resulting target frame with 6 data channels
82 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
83 * @param worker Optional worker object to distribute the computation
84 * @return True, if succeeded
85 */
86 static bool convertToYUVLLL48LaplaceMagnitude(const Frame& source, Frame& target, const unsigned int window = 11u, Worker* worker = nullptr);
87
88 /**
89 * Changes a 3 channel 24 bit color frame to a 2 channel 16 bit color (with YU component) and 1 channel 8 bit texture frame.
90 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
91 * @param frame The frame to convert
92 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
93 * @param worker Optional worker object to distribute the computation
94 * @return True, if succeeded
95 */
96 static bool changeToYUT24ScharrMagnitude(Frame& frame, const unsigned int window = 11u, Worker* worker = nullptr);
97
98 /**
99 * Changes a 4 channel 32 bit color frame to a 3 channel 24 bit color (with YUV component) and 1 channel 8 bit texture frame.
100 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
101 * @param frame The frame to convert
102 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
103 * @param worker Optional worker object to distribute the computation
104 * @return True, if succeeded
105 */
106 static bool changeToYUVT32ScharrMagnitude(Frame& frame, const unsigned int window = 11u, Worker* worker = nullptr);
107
108 /**
109 * Changes a 4 channel 32 bit color frame to a 3 channel 24 bit color (with RGB component) and 1 channel 8 bit texture frame.
110 * The 8 bit texture component is created by averaging the Scharr 3x3 filter response over a window area.
111 * @param frame The frame to convert
112 * @param window Size of the window in pixel used for filter response averaging, with range [1, infinity), must be odd
113 * @param worker Optional worker object to distribute the computation
114 * @return True, if succeeded
115 */
116 static bool changeToRGBT32ScharrMagnitude(Frame& frame, const unsigned int window = 11u, Worker* worker = nullptr);
117
118 private:
119
120 /**
121 * Creates a bordered integral frame holding the maximal absolute Scharr filter response values of 4 directories.
122 * @param frame The frame to create the integral frame from, must be valid
123 * @param window Size of the integral border in pixel, with range [1, infinity), must be odd
124 * @param integralFrame Resulting integral frame with size (frame.width() + 2 * window + 1)x(frame.height() + 2 * window + 1)
125 * @param worker Optional worker object to create the integral frame from
126 * @return True, if succeeded
127 */
128 static bool createScharrMagnitudeIntegral(const Frame& frame, const unsigned int window, Frame& integralFrame, Worker* worker = nullptr);
129};
130
131}
132
133}
134
135}
136
137#endif // META_OCEAN_CV_ADVANCED_ADVANCED_FRAME_CONVERTER_H
This class implements a frame converter creating advanced and artificial pixel formats.
Definition AdvancedFrameConverter.h:30
static bool convertToRGBT32ScharrMagnitude(const Frame &source, Frame &target, Worker *worker=nullptr)
Converts a given frame into a RGB frame with additional (fourth) texture channel.
static bool convertToRGBT32ScharrMagnitude(const Frame &source, Frame &target, const unsigned int window=11u, Worker *worker=nullptr)
Converts a 4 channel 32 bit color frame to a 3 channel 24 bit color (with RGB component) and 1 channe...
static bool changeToRGBT32ScharrMagnitude(Frame &frame, const unsigned int window=11u, Worker *worker=nullptr)
Changes a 4 channel 32 bit color frame to a 3 channel 24 bit color (with RGB component) and 1 channel...
static bool convertToYUT24ScharrMagnitude(const Frame &source, Frame &target, const unsigned int window=11u, Worker *worker=nullptr)
Converts a 3 channel 24 bit color frame to a 2 channel 16 bit color (with YU component) and 1 channel...
static bool changeToYUVT32ScharrMagnitude(Frame &frame, const unsigned int window=11u, Worker *worker=nullptr)
Changes a 4 channel 32 bit color frame to a 3 channel 24 bit color (with YUV component) and 1 channel...
static bool convertToYUVT32ScharrMagnitude(const Frame &source, Frame &target, const unsigned int window=11u, Worker *worker=nullptr)
Converts a 4 channel 32 bit color frame to a 3 channel 24 bit color (with YUV component) and 1 channe...
static bool convertToYUVLLL48LaplaceMagnitude(const Frame &source, Frame &target, const unsigned int window=11u, Worker *worker=nullptr)
Converts a given frame into a mean filtered YUV frame with extended Laplace (magnitude) channels.
static bool createScharrMagnitudeIntegral(const Frame &frame, const unsigned int window, Frame &integralFrame, Worker *worker=nullptr)
Creates a bordered integral frame holding the maximal absolute Scharr filter response values of 4 dir...
static bool changeToYUT24ScharrMagnitude(Frame &frame, const unsigned int window=11u, Worker *worker=nullptr)
Changes a 3 channel 24 bit color frame to a 2 channel 16 bit color (with YU component) and 1 channel ...
This class implements Ocean's image class.
Definition Frame.h:1808
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