Ocean
SynthesisPyramidF1.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_SYNTHESIS_SYNTHESIS_PYRAMID_F_1_H
9 #define META_OCEAN_CV_SYNTHESIS_SYNTHESIS_PYRAMID_F_1_H
10 
14 
16 
17 namespace Ocean
18 {
19 
20 namespace CV
21 {
22 
23 namespace Synthesis
24 {
25 
26 /**
27  * This class implements the main pixel synthesis object holding several synthesis pyramid layers.
28  * @ingroup cvsynthesis
29  */
30 class OCEAN_CV_SYNTHESIS_EXPORT SynthesisPyramidF1 : public SynthesisPyramid
31 {
32  public:
33 
34  // We want to use all implementations in this class.
36 
37  public:
38 
39  /**
40  * Creates a new synthesis pyramid object.
41  * Each synthesis pyramid must be arranged before an inpainting strategy can be invoked.
42  * @see arrange().
43  */
44  inline SynthesisPyramidF1();
45 
46  /**
47  * Returns the finest synthesis layer of this pyramid object.
48  * Beware: Ensure that this pyramid holds at least one layer before calling this function!
49  * @return The pyramid's finest synthesis layer
50  */
51  inline const LayerF1& finestLayer() const;
52 
53  /**
54  * Returns the finest synthesis layer of this pyramid object.
55  * Beware: Ensure that this pyramid holds at least one layer before calling this function!
56  * @return The pyramid's finest synthesis layer
57  */
58  inline LayerF1& finestLayer();
59 
60  /**
61  * Returns the number of layers of this pyramid.
62  * @return The pyramid's number of layers, with range [0, infinity)
63  */
64  inline size_t layers() const;
65 
66  /**
67  * Applies the inpainting on an initialized synthesis pyramid while a specific initialization technique is used on the coarsest pyramid layer.
68  * @see SynthesisPyramid::applyInpainting().
69  */
70  bool applyInpainting(const InitializationTechnique initializationTechnique, RandomGenerator& randomGenerator, const unsigned int weightFactor = 5u, const unsigned int borderFactor = 26u, const unsigned int maxSpatialCost = (unsigned int)(-1), const unsigned int optimizationIterations = 2u, const unsigned int forced1ChannelLayers = 0u, const unsigned int skippingLayers = 0u, Worker* worker = nullptr) override;
71 
72  /**
73  * Creates the final inpainting result for the finest pyramid layer.
74  * @see SynthesisPyramid::createInpaintingResult().
75  */
76  bool createInpaintingResult(Frame& frame, Worker* worker = nullptr) const override;
77 
78  /**
79  * Returns whether this pyramid object holds at least one layer.
80  * @return True, if so
81  */
82  explicit inline operator bool() const;
83 
84  private:
85 
86  /// The individual synthesis layers for individual frame resolutions with reversed layer order.
88 };
89 
92 {
93  // nothing to do here
94 }
95 
97 {
98  ocean_assert(!layersReversedOrder_.empty());
99  return layersReversedOrder_.back();
100 }
101 
103 {
104  ocean_assert(!layersReversedOrder_.empty());
105  return layersReversedOrder_.back();
106 }
107 
108 inline size_t SynthesisPyramidF1::layers() const
109 {
110  return layersReversedOrder_.size();
111 }
112 
113 inline SynthesisPyramidF1::operator bool() const
114 {
115  return !layersReversedOrder_.empty();
116 }
117 
118 }
119 
120 }
121 
122 }
123 
124 #endif // META_OCEAN_CV_SYNTHESIS_SYNTHESIS_PYRAMID_F_1_H
This class implements a single layer for pixel synthesis within one frame and sub-pixel accuracy.
Definition: LayerF1.h:44
This class implements the main pixel synthesis object holding several synthesis pyramid layers.
Definition: SynthesisPyramidF1.h:31
bool applyInpainting(const InitializationTechnique initializationTechnique, RandomGenerator &randomGenerator, const unsigned int weightFactor=5u, const unsigned int borderFactor=26u, const unsigned int maxSpatialCost=(unsigned int)(-1), const unsigned int optimizationIterations=2u, const unsigned int forced1ChannelLayers=0u, const unsigned int skippingLayers=0u, Worker *worker=nullptr) override
Applies the inpainting on an initialized synthesis pyramid while a specific initialization technique ...
size_t layers() const
Returns the number of layers of this pyramid.
Definition: SynthesisPyramidF1.h:108
bool createInpaintingResult(Frame &frame, Worker *worker=nullptr) const override
Creates the final inpainting result for the finest pyramid layer.
const LayerF1 & finestLayer() const
Returns the finest synthesis layer of this pyramid object.
Definition: SynthesisPyramidF1.h:96
LayersF1 layersReversedOrder_
The individual synthesis layers for individual frame resolutions with reversed layer order.
Definition: SynthesisPyramidF1.h:87
SynthesisPyramidF1()
Creates a new synthesis pyramid object.
Definition: SynthesisPyramidF1.h:90
This class implements the base class for all synthesis pyramids.
Definition: SynthesisPyramid.h:33
virtual bool applyInpainting(const SynthesisQuality synthesisQuality, RandomGenerator &randomGenerator, const unsigned int weightFactor=5u, const unsigned int borderFactor=25u, const unsigned int maxSpatialCost=(unsigned int)(-1), Worker *worker=nullptr)
Applies the inpainting on an initialized synthesis pyramid satisfying a specific quality.
InitializationTechnique
Definition of individual initialization techniques.
Definition: SynthesisPyramid.h:55
This class implements Ocean's image class.
Definition: Frame.h:1792
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
std::vector< LayerF1 > LayersF1
Definition of a vector holding one-frame sub-pixel layer objects.
Definition: LayerF1.h:30
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15