8 #ifndef META_OCEAN_CV_SYNTHESIS_INITIALIZER_SHRINKING_PATCH_MATCHING_I_1_H
9 #define META_OCEAN_CV_SYNTHESIS_INITIALIZER_SHRINKING_PATCH_MATCHING_I_1_H
59 template <
unsigned int tChannels>
60 static inline unsigned int determine5x5(
const uint8_t* frame,
const uint8_t* mask,
const unsigned int width,
const unsigned int height,
const unsigned int framePaddingElements,
const unsigned int maskPaddingElements,
const CV::PixelPosition& inPosition,
const CV::PixelPosition& outPosition);
74 template <
unsigned int tChannels>
75 static inline unsigned int determine5x5(
const uint8_t* frame,
const uint8_t* mask,
const unsigned int width,
const unsigned int height,
const unsigned int framePaddingElements,
const unsigned int maskPaddingElements,
const CV::PixelPosition& inPosition,
const CV::PixelPosition& outPosition);
97 inline const VectorI2& borderDirection()
const;
103 inline const VectorI2& imageOrientation()
const;
109 inline unsigned int priority()
const;
115 inline void setBorderDirection(
const VectorI2& direction);
121 inline void setImageOrientation(
const VectorI2& orientation);
146 template <
unsigned int tChannels>
147 static VectorI2 determineImageOrientation5x5(
const int16_t* sobelResponse,
const uint8_t* mask,
const unsigned int width,
const unsigned int height,
const unsigned int sobelStrideElements,
const unsigned int maskPaddingElements,
const CV::PixelPosition& position);
172 unsigned int priority_ = 0u;
204 template <
unsigned int tChannels>
216 template<
unsigned int tChannels,
typename SSD>
217 bool patchInitializationIteration5x5(
Frame& sobelResponse,
const Frame& staticMask,
RandomGenerator& randomGenerator)
const;
233 imageOrientation_(imageOrientation),
234 borderDirection_(borderDirection),
235 priority_(abs(imageOrientation.perpendicular() * borderDirection))
242 return borderDirection_;
247 return imageOrientation_;
257 borderDirection_ = direction;
258 priority_ = abs(imageOrientation_.perpendicular() * borderDirection_);
263 imageOrientation_ = orientation;
264 priority_ = abs(imageOrientation_.perpendicular() * borderDirection_);
267 template <
unsigned int tChannels>
270 static_assert(tChannels >= 1u,
"Invalid channel number!");
272 ocean_assert(sobelResponse !=
nullptr && mask !=
nullptr);
274 ocean_assert(sobelStrideElements >= width * 2u);
275 ocean_assert(position.
x() < width && position.
y() < height);
281 for (
unsigned int y = max(1,
int(position.
y()) - 2); y < min(position.
y() + 3u, height - 1u); ++y)
283 for (
unsigned int x = max(1,
int(position.
x()) - 2); x < min(position.
x() + 3u, width - 1u); ++x)
285 constexpr uint8_t nonMaskPixelValue = 0xFFu;
287 if (!Segmentation::MaskAnalyzer::hasMaskNeighbor9<false>(mask, width, height, maskPaddingElements,
PixelPosition(x, y), nonMaskPixelValue))
289 const int16_t*
const sobelPixel = sobelResponse + y * sobelStrideElements + x * tChannels * 2u;
291 for (
unsigned int n = 0u; n < tChannels; ++n)
293 const int16_t responseX = sobelPixel[n * 2u + 0u];
294 const int16_t responseY = sobelPixel[n * 2u + 1u];
298 orientation +=
VectorI2(responseX, responseY);
302 orientation -=
VectorI2(responseX, responseY);
322 return index(1000) < right.
index(1000);
345 template <
unsigned int tChannels>
348 constexpr uint8_t maskValue = 0x00u;
350 return Advanced::AdvancedSumSquareDifferences::patchWithRejectingMask8BitPerChannel<tChannels>(frame, frame, mask, mask, 5u, width, height, width, height, inPosition.
x(), inPosition.
y(), outPosition.
x(), outPosition.
y(), framePaddingElements, framePaddingElements, maskPaddingElements, maskPaddingElements, maskValue).first;
353 template <
unsigned int tChannels>
356 return SumSquareDifferences::patchAtBorder8BitPerChannel<tChannels, 5u>(frame, frame, width, height, width, height, inPosition.
x(), inPosition.
y(), outPosition.
x(), outPosition.
y(), framePaddingElements, framePaddingElements).first;
359 template<
unsigned int tChannels,
typename SSD>
362 static_assert(tChannels >= 1u,
"Invalid number of frame channels!");
377 for (
unsigned int y = 0; y < height; ++y)
379 for (
unsigned int x = 0; x < width; ++x)
383 ocean_assert(!position.
isValid() || (position.
x() < width && position.
y() < height));
390 uint8_t*
const frameData = frame.
data<uint8_t>();
394 const uint8_t*
const staticMaskData = staticMask.
constdata<uint8_t>();
395 const unsigned int staticMaskStrideElements = staticMask.
strideElements();
397 uint8_t*
const dynamicMaskData = dynamicMask.
data<uint8_t>();
398 const unsigned int dynamicMaskPaddingElements = dynamicMask.
paddingElements();
399 const unsigned int dynamicMaskStrideElements = dynamicMask.
strideElements();
401 int16_t*
const sobelResponseData = sobelResponse.
data<int16_t>();
402 const unsigned int sobelResponseStrideElements = sobelResponse.
strideElements();
405 borderPixels.reserve(1024);
413 const VectorI2 imageOrientation(InpaintingPixel::determineImageOrientation5x5<tChannels>(sobelResponseData, dynamicMaskData, width, height, sobelResponseStrideElements, dynamicMaskPaddingElements, borderPixel));
415 inpaintingPixels.emplace_back(borderPixel, borderDirection, imageOrientation);
418 inpaintingPixels.sort();
420 while (!inpaintingPixels.empty())
423 ocean_assert(dynamicMask.
constpixel<uint8_t>(position.
x(), position.
y())[0] != 0xFF);
425 inpaintingPixels.pop_back();
427 unsigned int ssdBest = (
unsigned int)(-1);
429 unsigned int xBest = (
unsigned int)(-1);
430 unsigned int yBest = (
unsigned int)(-1);
439 for (
unsigned int y = max(0,
int(center.
y()) - 3); y < min(center.
y() + 4u, height); ++y)
441 for (
unsigned int x = max(0,
int(center.
x()) - 3); x < min(center.
x() + 4u, width); ++x)
443 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
445 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
463 for (
unsigned int y = max(0,
int(east.
y()) - 3); y < min(east.
y() + 4u, height); ++y)
465 for (
unsigned int x = max(0,
int(east.
x()) - 3); x < min(east.
x() + 4u, width); ++x)
467 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
469 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
487 for (
unsigned int y = max(0,
int(southEast.
y()) - 3); y < min(southEast.
y() + 4u, height); ++y)
489 for (
unsigned int x = max(0,
int(southEast.
x()) - 3); x < min(southEast.
x() + 4u, width); ++x)
491 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
493 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
511 for (
unsigned int y = max(0,
int(south.
y()) - 3); y < min(south.
y() + 4u, height); ++y)
513 for (
unsigned int x = max(0,
int(south.
x()) - 3); x < min(south.
x() + 4u, width); ++x)
515 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
517 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
535 for (
unsigned int y = max(0,
int(southWest.
y()) - 3); y < min(southWest.
y() + 4u, height); ++y)
537 for (
unsigned int x = max(0,
int(southWest.
x()) - 3); x < min(southWest.
x() + 4u, width); ++x)
539 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
541 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
559 for (
unsigned int y = max(0,
int(west.
y()) - 3); y < min(west.
y() + 4u, height); ++y)
561 for (
unsigned int x = max(0,
int(west.
x()) - 3); x < min(west.
x() + 4u, width); ++x)
563 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
565 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
583 for (
unsigned int y = max(0,
int(northWest.
y()) - 3); y < min(northWest.
y() + 4u, height); ++y)
585 for (
unsigned int x = max(0,
int(northWest.
x()) - 3); x < min(northWest.
x() + 4u, width); ++x)
587 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
589 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
607 for (
unsigned int y = max(0,
int(north.
y()) - 3); y < min(north.
y() + 4u, height); ++y)
609 for (
unsigned int x = max(0,
int(north.
x()) - 3); x < min(north.
x() + 4u, width); ++x)
611 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
613 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
631 for (
unsigned int y = max(0,
int(northEast.
y()) - 3); y < min(northEast.
y() + 4u, height); ++y)
633 for (
unsigned int x = max(0,
int(northEast.
x()) - 3); x < min(northEast.
x() + 4u, width); ++x)
635 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
637 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
PixelPosition(x, y));
655 for (
unsigned int n = 0u; n < 100u; ++n)
659 const Vector3 offset = rotation * normal * length;
662 if (first.
x() < width && first.
y() < height && staticMaskData[first.
y() * staticMaskStrideElements + first.
x()] == 0xFF)
664 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position, first);
676 if (second.
x() < width && second.
y() < height && staticMaskData[second.
y() * staticMaskStrideElements + second.
x()] == 0xFF)
678 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position, second);
691 if (ssdBest != (
unsigned int)(-1))
693 const unsigned int iterations = 200u;
694 for (
unsigned int n = 0u; n < iterations; ++n)
696 const int xRadius = max(1,
int(width - (width - 1u) * n / iterations) >> 1);
697 const int yRadius = max(1,
int(height - (height - 1u) * n / iterations) >> 1);
699 const int offsetX =
RandomI::random(randomGenerator, -xRadius, xRadius);
700 const int offsetY =
RandomI::random(randomGenerator, -yRadius, yRadius);
702 const unsigned int randomX = xBest + offsetX;
703 const unsigned int randomY = yBest + offsetY;
705 if (randomX < width && randomY < height && (randomY != position.
y() || randomX != position.
x()) && staticMaskData[randomY * staticMaskStrideElements + randomX] == 0xFF)
707 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
CV::PixelPosition(randomX, randomY));
721 if (ssdBest == (
unsigned int)(-1))
726 for (
unsigned int y = 0u; y < height; ++y)
728 const uint8_t*
const staticMaskRow = staticMask.
constrow<uint8_t>(y);
730 for (
unsigned int x = 0u; x < width; ++x)
732 if ((y != position.
y() || x != position.
x()) && staticMaskRow[x] == 0xFF)
734 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
CV::PixelPosition(x, y));
756 for (
unsigned int y = top; y < bottomEnd; ++y)
758 for (
unsigned int x = left; x < rightEnd; ++x)
760 if ((y != position.
y() || x != position.
x()) && staticMaskData[y * staticMaskStrideElements + x] == 0xFF)
762 const unsigned int ssd = SSD::template determine5x5<tChannels>(frameData, dynamicMaskData, width, height, framePaddingElements, dynamicMaskPaddingElements, position,
CV::PixelPosition(x, y));
777 if (ssdBest == (
unsigned int)(-1))
779 for (
unsigned int y = 0u; ssdBest == (
unsigned int)(-1) && y < height; ++y)
781 const uint8_t* dynamicMaskRow = dynamicMask.
constrow<uint8_t>(y);
783 for (
unsigned int x = 0u; x < width; ++x)
785 if (dynamicMaskRow[x] == 0xFFu)
787 ssdBest = (
unsigned int)(-2);
798 if (ssdBest == (
unsigned int)(-1))
803 ocean_assert(xBest < width && yBest < height);
806 CVUtilities::copyPixel<tChannels>(frameData + position.
y() * frameStrideElements + position.
x() * tChannels, frameData + yBest * frameStrideElements + xBest * tChannels);
808 for (
unsigned int y = max(0,
int(position.
y()) - 1); y < min(position.
y() + 2u, height); ++y)
810 for (
unsigned int x = max(0,
int(position.
x()) - 1); x < min(position.
x() + 2u, width); ++x)
812 CV::FrameFilterSobel::filterPixelHorizontalVertical8BitPerChannel<int16_t, tChannels>(frameData, width, height, x, y, sobelResponseData + y * sobelResponseStrideElements + x * tChannels * 2u, framePaddingElements);
818 newBorderPixels.reserve(4u);
820 constexpr uint8_t nonMaskPixelValue = 0xFF;
823 if (position.
x() - 1u < width - 2u)
826 if (position.
y() > 1u && !Segmentation::MaskAnalyzer::hasMaskNeighbor5<true>(dynamicMaskData, width, height, dynamicMaskPaddingElements, position.
north(), nonMaskPixelValue))
828 newBorderPixels.emplace_back(position.
north());
832 if (position.
y() + 2u < height && !Segmentation::MaskAnalyzer::hasMaskNeighbor5<true>(dynamicMaskData, width, height, dynamicMaskPaddingElements, position.
south(), nonMaskPixelValue))
834 newBorderPixels.emplace_back(position.
south());
838 if (position.
y() - 1u < height - 2u)
841 if (position.
x() > 1u && !Segmentation::MaskAnalyzer::hasMaskNeighbor5<true>(dynamicMaskData, width, height, dynamicMaskPaddingElements, position.
west(), nonMaskPixelValue))
843 newBorderPixels.emplace_back(position.
west());
847 if (position.
x() + 2u < width && !Segmentation::MaskAnalyzer::hasMaskNeighbor5<true>(dynamicMaskData, width, height, dynamicMaskPaddingElements, position.
east(), nonMaskPixelValue))
849 newBorderPixels.emplace_back(position.
east());
859 ocean_assert(newBorerPixel != inpaintingPixel);
866 ocean_assert(dynamicMask.
constpixel<uint8_t>(position.
x(), position.
y())[0] != 0xFFu);
867 ocean_assert(staticMask.
constpixel<uint8_t>(xBest, yBest)[0] == 0xFFu);
869 dynamicMaskData[position.
y() * dynamicMaskStrideElements + position.
x()] = 0xFFu;
876 for (InpaintingPixelList::iterator i = inpaintingPixels.begin(); i != inpaintingPixels.end(); )
878 ocean_assert(*i != position);
881 const int dx = abs(
int(i->x()) -
int(position.
x()));
882 const int dy = abs(
int(i->y()) -
int(position.
y()));
884 if (dx <= 3 && dy <= 3)
887 changedInpaintingPixels.emplace_back(*i,
InpaintingPixel::determineBorderDirection5x5(dynamicMaskData, width, height, dynamicMaskPaddingElements, *i), InpaintingPixel::determineImageOrientation5x5<tChannels>(sobelResponseData, dynamicMaskData, width, height, sobelResponseStrideElements, dynamicMaskPaddingElements, *i));
889 i = inpaintingPixels.erase(i);
900 changedInpaintingPixels.emplace_back(newBorderPixel,
InpaintingPixel::determineBorderDirection5x5(dynamicMaskData, width, height, dynamicMaskPaddingElements, newBorderPixel), InpaintingPixel::determineImageOrientation5x5<tChannels>(sobelResponseData, dynamicMaskData, width, height, sobelResponseStrideElements, dynamicMaskPaddingElements, newBorderPixel));
903 changedInpaintingPixels.sort();
904 inpaintingPixels.merge(changedInpaintingPixels);
909 ocean_assert(inpaintingPixel ==
InpaintingPixel(inpaintingPixel,
InpaintingPixel::determineBorderDirection5x5(dynamicMaskData, width, height, dynamicMaskPaddingElements, inpaintingPixel), InpaintingPixel::determineImageOrientation5x5<tChannels>(sobelResponseData, dynamicMaskData, width, height, sobelResponseStrideElements, dynamicMaskPaddingElements, inpaintingPixel)));
915 for (
unsigned int y = 0; y < height; ++y)
917 for (
unsigned int x = 0; x < width; ++x)
919 ocean_assert(dynamicMask.
constpixel<uint8_t>(x, y)[0] == 0xFFu);
922 if (staticMask.
constpixel<uint8_t>(x, y)[0] != 0xFFu)
924 ocean_assert(position.
isValid() && position.
x() < width && position.
y() < height);
928 ocean_assert(!position.
isValid());
PixelPositionT< T > west() const
Returns the pixel position west to this position.
Definition: PixelPosition.h:561
T index(const unsigned int width) const
Returns the index of this position inside a frame with given width.
Definition: PixelPosition.h:676
PixelPositionT< T > southWest() const
Returns the pixel position south west to this position.
Definition: PixelPosition.h:567
PixelPositionT< T > north() const
Returns the pixel position north to this position.
Definition: PixelPosition.h:549
bool isValid() const
Returns whether this pixel position object holds two valid parameters.
PixelPositionT< T > east() const
Returns the pixel position east to this position.
Definition: PixelPosition.h:585
T y() const
Returns the vertical coordinate position of this object.
Definition: PixelPosition.h:470
PixelPositionT< T > southEast() const
Returns the pixel position south east to this position.
Definition: PixelPosition.h:579
T x() const
Returns the horizontal coordinate position of this object.
Definition: PixelPosition.h:458
PixelPositionT< T > northWest() const
Returns the pixel position north west to this position.
Definition: PixelPosition.h:555
PixelPositionT< T > south() const
Returns the pixel position south to this position.
Definition: PixelPosition.h:573
PixelPositionT< T > northEast() const
Returns the pixel position north east to this position.
Definition: PixelPosition.h:591
static void findBorderPixels4(const uint8_t *mask, const unsigned int width, const unsigned int height, const unsigned int maskPaddingElements, PixelPositions &borderPixels, const PixelBoundingBox &boundingBox=PixelBoundingBox(), Worker *worker=nullptr, const uint8_t nonMaskValue=255u)
Determines all border pixels in an 8 bit mask frame for a 4-neighborhood.
This class is the base class for all initializers that are provided for a single frame only.
Definition: Initializer1.h:29
This class implements the base class for all synthesis initializers.
Definition: Initializer.h:34
Layer & layer_
Synthesis layer that has to be initialized.
Definition: Initializer.h:55
This class implements the base class for all initializer objects that are applied for mappings with i...
Definition: InitializerI.h:30
LayerI & layerI_
Specialized layer reference.
Definition: InitializerI.h:42
This class is the base class for all initializers that mainly initialize the synthesis mapping by a h...
Definition: InitializerRandomized.h:30
This class implements a single inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:82
InpaintingPixel(const PixelPosition &position, const VectorI2 &borderDirection, const VectorI2 &imageOrientation)
Creates a new inpainting pixel by a given border direction and image orientation.
Definition: InitializerShrinkingPatchMatchingI1.h:231
static VectorI2 determineImageOrientation5x5(const int16_t *sobelResponse, const uint8_t *mask, const unsigned int width, const unsigned int height, const unsigned int sobelStrideElements, const unsigned int maskPaddingElements, const CV::PixelPosition &position)
Determines the image orientation at a given position.
Definition: InitializerShrinkingPatchMatchingI1.h:268
void setImageOrientation(const VectorI2 &orientation)
Sets the image orientation of this inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:261
bool operator<(const InpaintingPixel &right) const
Returns whether this inpainting pixel has a lower priority than a second one.
Definition: InitializerShrinkingPatchMatchingI1.h:312
unsigned int priority_
Inpainting priority.
Definition: InitializerShrinkingPatchMatchingI1.h:172
void setBorderDirection(const VectorI2 &direction)
Sets the border direction of this inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:255
static VectorI2 determineBorderDirection5x5(const uint8_t *mask, const unsigned int width, const unsigned int height, const unsigned int maskPaddingElements, const PixelPosition &position)
Determines the border direction of a border pixel by a 5x5 area.
const VectorI2 & imageOrientation() const
Returns the image orientation of this inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:245
bool operator==(const InpaintingPixel &right) const
Returns whether two inpainting pixels are identical.
Definition: InitializerShrinkingPatchMatchingI1.h:328
const VectorI2 & borderDirection() const
Returns the border direction of this inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:240
VectorI2 imageOrientation_
Image orientation.
Definition: InitializerShrinkingPatchMatchingI1.h:166
VectorI2 borderDirection_
Border direction.
Definition: InitializerShrinkingPatchMatchingI1.h:169
unsigned int priority() const
Returns the priority of this inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:250
Definition of a wrapper class for ssd functions.
Definition: InitializerShrinkingPatchMatchingI1.h:67
static unsigned int determine5x5(const uint8_t *frame, const uint8_t *mask, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int maskPaddingElements, const CV::PixelPosition &inPosition, const CV::PixelPosition &outPosition)
Wrapper function for SumSquareDifferences::patchAtBorder8BitPerChannel.
Definition: InitializerShrinkingPatchMatchingI1.h:354
Definition of a wrapper class for ssd functions.
Definition: InitializerShrinkingPatchMatchingI1.h:52
static unsigned int determine5x5(const uint8_t *frame, const uint8_t *mask, const unsigned int width, const unsigned int height, const unsigned int framePaddingElements, const unsigned int maskPaddingElements, const CV::PixelPosition &inPosition, const CV::PixelPosition &outPosition)
Wrapper function for AdvancedSumSquareDifferences::patchWithRejectingMask8BitPerChannel().
Definition: InitializerShrinkingPatchMatchingI1.h:346
This class implements an initializer that shrinks the inpainting mask by the application of images pa...
Definition: InitializerShrinkingPatchMatchingI1.h:45
const unsigned int maximalBoundingBoxOffset_
Maximal search offset that is applied during the initialization for each inpainting pixel.
Definition: InitializerShrinkingPatchMatchingI1.h:228
std::list< InpaintingPixel > InpaintingPixelList
Definition of a list holding inpainting pixels.
Definition: InitializerShrinkingPatchMatchingI1.h:178
InitializerShrinkingPatchMatchingI1(LayerI1 &layer, RandomGenerator &randomGenerator, const unsigned int iterations=2u, const bool heuristic=false, const unsigned int maximalBoundingBoxOffset=0xFFFFFFFF)
Creates a new initializer object.
Definition: InitializerShrinkingPatchMatchingI1.h:333
bool invoke(Worker *worker=nullptr) const override
Invokes the initialization process.
const bool heuristic_
Heuristic execution statement of the initializer.
Definition: InitializerShrinkingPatchMatchingI1.h:225
bool invoke(Worker *worker) const
Invokes the initialization process.
bool patchInitializationIteration5x5(Frame &sobelResponse, const Frame &staticMask, RandomGenerator &randomGenerator) const
Applies the first iterations of the patch initialization for a frame using 5x5 areas.
Definition: InitializerShrinkingPatchMatchingI1.h:360
const unsigned int iterations_
Number of initialization iterations.
Definition: InitializerShrinkingPatchMatchingI1.h:222
unsigned int height() const
Returns the height of this layer.
Definition: Layer.h:169
unsigned int width() const
Returns the width of this layer.
Definition: Layer.h:164
const Frame & frame() const
Returns the frame of this layer.
Definition: Layer.h:174
const PixelBoundingBox & boundingBox() const
Returns the optional bounding box of this layer.
Definition: Layer.h:194
This class implements a single layer for pixel synthesis within one frame and pixel accuracy.
Definition: LayerI1.h:41
virtual const MappingI & mapping() const =0
Returns the mapping of this synthesis layer.
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
void setPosition(const unsigned int x, const unsigned int y, const PixelPosition &pixelPosition)
Sets a new mapping for a specified position.
Definition: MappingI.h:237
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
const T * constdata(const unsigned int planeIndex=0u) const
Returns a pointer to the read-only pixel data of a specific plane.
Definition: Frame.h:4168
T * data(const unsigned int planeIndex=0u)
Returns a pointer to the pixel data of a specific plane.
Definition: Frame.h:4159
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4448
const T * constpixel(const unsigned int x, const unsigned int y, const unsigned int planeIndex=0u) const
Returns the pointer to the constant data of a specific pixel.
Definition: Frame.h:4250
@ ACM_COPY_REMOVE_PADDING_LAYOUT
Same as CM_COPY_REMOVE_PADDING_LAYOUT.
Definition: Frame.h:1818
const T * constrow(const unsigned int y, const unsigned int planeIndex=0u) const
Returns the pointer to the constant data of a specific row.
Definition: Frame.h:4193
unsigned int paddingElements(const unsigned int planeIndex=0u) const
Returns the optional number of padding elements at the end of each row for a specific plane.
Definition: Frame.h:4042
static constexpr T deg2rad(const T deg)
Converts deg to rad.
Definition: Numeric.h:3232
static constexpr int32_t round32(const T value)
Returns the rounded 32 bit integer value of a given value.
Definition: Numeric.h:2064
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
static unsigned int random(const unsigned int maxValue)
Returns one random integer value with specified maximum value.
static T scalar(const T lower, const T upper)
Returns a random number between two borders.
Definition: Random.h:388
This class implements a axis-angle rotation using floating point values.
Definition: Rotation.h:79
const T & x() const noexcept
Returns the x value.
Definition: Vector2.h:698
const T & y() const noexcept
Returns the y value.
Definition: Vector2.h:710
const T & y() const noexcept
Returns the y value.
Definition: Vector3.h:812
bool normalize()
Normalizes this vector.
Definition: Vector3.h:647
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
std::vector< PixelPosition > PixelPositions
Definition of a vector holding pixel positions (with positive coordinate values).
Definition: PixelPosition.h:48
PixelPositionT< unsigned int > PixelPosition
Definition of the default PixelPosition object with a data type allowing only positive coordinate val...
Definition: PixelPosition.h:27
VectorT2< int > VectorI2
Definition of a 2D vector with integer values.
Definition: Vector2.h:49
float Scalar
Definition of a scalar type.
Definition: Math.h:128
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15