8 #ifndef META_OCEAN_CV_FRAME_OPERATIONS_H
9 #define META_OCEAN_CV_FRAME_OPERATIONS_H
69 template <
typename TSource0,
typename TSource1,
typename TTarget,
typename TIntermediate,
unsigned int tChannels>
70 static void subtract(
const TSource0* source0,
const TSource1* source1, TTarget* target,
const unsigned int width,
const unsigned int height,
const unsigned int source0PaddingElements,
const unsigned int source1PaddingElements,
const unsigned int targetPaddingElements,
const FrameChannels::ConversionFlag conversionFlag =
FrameChannels::CONVERT_NORMAL,
Worker* worker =
nullptr);
78 template <
unsigned int tChannels>
94 template <
typename TSource0,
typename TSource1,
typename TTarget>
95 static inline void subtractPixel(
const TSource0* source0,
const TSource1* source1, TTarget* target);
99 template <
typename TSource0,
typename TSource1,
typename TTarget,
typename TIntermediate,
unsigned int tChannels>
100 void FrameOperations::subtract(
const TSource0* source0,
const TSource1* source1, TTarget* target,
const unsigned int width,
const unsigned int height,
const unsigned int source0PaddingElements,
const unsigned int source1PaddingElements,
const unsigned int targetPaddingElements,
const FrameChannels::ConversionFlag conversionFlag,
Worker* worker)
102 static_assert(tChannels > 0u,
"Number of channels must be larger then zero.");
104 ocean_assert(source0 && source1 && target);
105 ocean_assert(width > 0u && height > 0u);
107 FrameChannels::applyBivariateOperator<TSource0, TSource1, TTarget, TIntermediate, tChannels, tChannels, Operations<tChannels>::template subtractPixel<TSource0, TSource1, TTarget>>(source0, source1, target, width, height, source0PaddingElements, source1PaddingElements, targetPaddingElements, conversionFlag, worker);
110 template <
unsigned int tChannels>
111 template <
typename TSource0,
typename TSource1,
typename TTarget>
114 static_assert(tChannels > 0u,
"Number of channels must be larger then zero.");
116 ocean_assert(source0 && source1 && target);
118 for (
unsigned int channel = 0u; channel < tChannels; ++channel)
120 target[channel] =
static_cast<TTarget
>(source0[channel] - source1[channel]);
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
@ CONVERT_NORMAL
Normal conversion, neither flips nor mirrors the image.
Definition: FrameConverter.h:49
Class for commonly used (arithmetic) operators on and between frames.
Definition: FrameOperations.h:28
static bool subtract(const Frame &source0, const Frame &source1, Frame &target, Worker *worker=nullptr)
Computes the difference between two frames and stores the difference.
This class implements Ocean's image class.
Definition: Frame.h:1792
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
Collections of pixel operations.
Definition: FrameOperations.h:80
static void subtractPixel(const TSource0 *source0, const TSource1 *source1, TTarget *target)
Subtraction of frames.
Definition: FrameOperations.h:112