8 #ifndef META_OCEAN_CV_SYNTHESIS_CREATOR_INFORMATION_SPATIAL_COST_I_1_H
9 #define META_OCEAN_CV_SYNTHESIS_CREATOR_INFORMATION_SPATIAL_COST_I_1_H
34 template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
56 void createSubset(
const unsigned int firstColumn,
const unsigned int numberColumns,
const unsigned int firstRow,
const unsigned int numberRows)
const override;
67 template <
unsigned int tChannels>
68 void createSubsetChannels(
const unsigned int firstColumn,
const unsigned int numberColumns,
const unsigned int firstRow,
const unsigned int numberRows)
const;
71 template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
82 template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
85 ocean_assert(target_.numberPlanes() == 1u);
87 switch (target_.channels())
90 createSubsetChannels<1u>(firstColumn, numberColumns, firstRow, numberRows);
94 ocean_assert(
false &&
"Invalid frame type.");
98 template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
99 template <
unsigned int tChannels>
102 static_assert(tNeighborhood >= 1u && tNeighborhood <= 4u,
"Invalid number of neighbors!");
103 static_assert(tChannels == 1u,
"Invalid channel number!");
105 ocean_assert(target_.isValid());
107 const unsigned int layerWidth = layerI_.width();
108 const unsigned int layerHeight = layerI_.height();
110 const MappingI& layerMapping = layerI_.mapping();
112 const Frame& layerMask = layerI_.mask();
114 const unsigned int maskStrideElements = layerMask.
strideElements();
116 for (
unsigned int y = firstRow; y < firstRow + numberRows; ++y)
118 uint8_t* targetRow = target_.row<uint8_t>(y) + firstColumn;
119 const uint8_t* maskPixel = layerI_.mask().template constrow<uint8_t>(y) + firstColumn;
121 for (
unsigned int x = firstColumn; x < firstColumn + numberColumns; ++x)
123 if (*maskPixel != 0xFFu)
125 unsigned int counter = 0u;
128 ocean_assert(position);
131 if (y > 0u && *(maskPixel - maskStrideElements) != 0xFFu)
138 else if (!tOnlyCenterPixels)
144 if (x > 0u && *(maskPixel - 1) != 0xFFu)
146 if (layerMapping.
position(x - 1u, y) == position.
west())
151 else if (!tOnlyCenterPixels)
157 if (y < layerHeight - 1u && *(maskPixel + maskStrideElements) != 0xFFu)
164 else if (!tOnlyCenterPixels)
170 if (x < layerWidth - 1u && *(maskPixel + 1) != 0xFFu)
172 if (layerMapping.
position(x + 1u, y) == position.
east())
177 else if (!tOnlyCenterPixels)
182 if (counter >= tNeighborhood)
PixelPositionT< T > west() const
Returns the pixel position west to this position.
Definition: PixelPosition.h:561
PixelPositionT< T > north() const
Returns the pixel position north to this position.
Definition: PixelPosition.h:549
PixelPositionT< T > east() const
Returns the pixel position east to this position.
Definition: PixelPosition.h:585
PixelPositionT< T > south() const
Returns the pixel position south to this position.
Definition: PixelPosition.h:573
This class implements the base class for all creators that support mappings for one frame.
Definition: Creator1.h:28
This class implements the base class for all creator objects that create a resulting frame as output.
Definition: CreatorFrame.h:28
This class implements the base class for all creators.
Definition: Creator.h:29
This class is the base class for all creators that support mappings with integer accuracy.
Definition: CreatorI.h:29
This class implements a creator that can be distributed to subsets of the synthesis layer.
Definition: CreatorSubset.h:28
This class implements a single layer for pixel synthesis within one frame and pixel accuracy.
Definition: LayerI1.h:41
This class implements a mapping with integer accuracy.
Definition: MappingI.h:30
const PixelPosition & position(const unsigned int x, const unsigned int y) const
Returns the mapping for a given position.
Definition: MappingI.h:215
This class implements Ocean's image class.
Definition: Frame.h:1792
unsigned int strideElements(const unsigned int planeIndex=0u) const
Returns the number of elements within one row, including optional padding at the end of a row for a s...
Definition: Frame.h:4058
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15