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
34template <
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;
71template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
82template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
85 ocean_assert(
target_.numberPlanes() == 1u);
94 ocean_assert(
false &&
"Invalid frame type.");
98template <
unsigned int tNeighborhood,
bool tOnlyCenterPixels>
99template <
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();
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:558
PixelPositionT< T > north() const
Returns the pixel position north to this position.
Definition PixelPosition.h:546
PixelPositionT< T > east() const
Returns the pixel position east to this position.
Definition PixelPosition.h:582
PixelPositionT< T > south() const
Returns the pixel position south to this position.
Definition PixelPosition.h:570
Creator1(const Layer &layer)
Creates a new creator object.
Definition Creator1.h:38
CreatorFrame(const Layer &layer, Frame &target)
Creates a new creator object.
Definition CreatorFrame.h:44
Frame & target_
Target frame of the creator.
Definition CreatorFrame.h:41
This class implements the base class for all creators.
Definition Creator.h:29
const LayerI & layerI_
Specialized layer reference.
Definition CreatorI.h:41
CreatorI(const LayerI &layer)
Creates a new creator object.
Definition CreatorI.h:44
CreatorSubset(const Layer &layer)
Creates a new creator object.
Definition CreatorSubset.h:55
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:33
const PixelPosition & position(const unsigned int x, const unsigned int y) const
Returns the mapping for a given position.
Definition MappingI.h:218
This class implements Ocean's image class.
Definition Frame.h:1969
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:4315
PixelPositionT< unsigned int > PixelPosition
Definition of the default PixelPosition object with a data type allowing only positive coordinate val...
Definition PixelPosition.h:32
Namespace of the CV Synthesis library.
Definition Constraint.h:25
Namespace of the CV library.
Definition Advanced.h:17
The namespace covering the entire Ocean framework.
Definition Accessor.h:15