Ocean
Optimizer4NeighborhoodHighPerformanceF1.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_OPTIMIZER_4_NEIGHBORHOOD_HIGH_PERFORMANCE_F_1_H
9 #define META_OCEAN_CV_SYNTHESIS_OPTIMIZER_4_NEIGHBORHOOD_HIGH_PERFORMANCE_F_1_H
10 
16 
17 namespace Ocean
18 {
19 
20 namespace CV
21 {
22 
23 namespace Synthesis
24 {
25 
26 /**
27  * This class implements a high performance mapping optimizer for float mappings that use one single frame.
28  * @tparam tWeightFactor Spatial weight impact, with range [0, infinity)
29  * @tparam tBorderFactor Weight factor of border pixels, with range [1, infinity)
30  * @tparam tUpdateFrame True, to update the frame pixel whenever a new mapping has been found
31  * @ingroup cvsynthesis
32  */
33 template <unsigned int tWeightFactor, unsigned int tBorderFactor, bool tUpdateFrame>
35  virtual public OptimizerF,
36  virtual public OptimizerSubset,
37  virtual public Optimizer1
38 {
39  public:
40 
41  /**
42  * Creates a new optimizer object.
43  * @param layer Synthesis layer that will be optimized
44  * @param randomGenerator Random number generator
45  */
46  inline Optimizer4NeighborhoodHighPerformanceF1(LayerF1& layer, RandomGenerator& randomGenerator);
47 
48  private:
49 
50  /**
51  * Optimizes a subset of the synthesis frame.
52  * @see Optimizer1::optimizeSubset().
53  * @see optimizerSubsetChannels().
54  */
55  void optimizeSubset(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const override;
56 
57  /**
58  * Specialization of the default subset optimization function.
59  * The template parameters specified the number of channels the synthesis frame has.<br>
60  * @param radii Number of improvement radii during one optimization iteration for each mapping position
61  * @param maxSpatialCost Maximal spatial cost
62  * @param boundingBoxTop First row of the entire synthesis area
63  * @param boundingBoxHeight Number of rows of the entire synthesis area
64  * @param downIsMain True, if the downwards direction is the main optimization direction (for all subsets with even thread indices)
65  * @param firstColumn First column to be handled in the subset
66  * @param numberColumns Number of columns to be handled in the subset
67  * @param rowOffset Offset within the entire synthesis area (boundingBoxHeight), the subset may be moved by this offset
68  * @param firstRow First row to be handled in the subset
69  * @param numberRows Number of rows to be handled in the subset
70  * @param threadIndex Index of the thread that executes the subset optimization function
71  * @tparam tChannels Number of data channels of the frame
72  * @see optimizerSubset().
73  */
74  template <unsigned int tChannels>
75  void optimizeSubsetChannels(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const;
76 
77  protected:
78 
79  /// Specialized layer reference.
81 };
82 
83 template <unsigned int tWeightFactor, unsigned int tBorderFactor, bool tUpdateFrame>
85  Optimizer(layer),
86  OptimizerF(layer),
87  OptimizerSubset(layer, randomGenerator),
88  Optimizer1(layer),
89  layerF1_(layer)
90 {
91  // nothing to do here
92 }
93 
94 template <unsigned int tWeightFactor, unsigned int tBorderFactor, bool tUpdateFrame>
95 void Optimizer4NeighborhoodHighPerformanceF1<tWeightFactor, tBorderFactor, tUpdateFrame>::optimizeSubset(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const
96 {
97  ocean_assert(layerF1_.frame().numberPlanes() == 1u);
98 
99  switch (layerF1_.frame().channels())
100  {
101  case 1u:
102  optimizeSubsetChannels<1u>(radii, maxSpatialCost, boundingBoxTop, boundingBoxHeight, downIsMain, firstColumn, numberColumns, rowOffset, firstRow, numberRows, threadIndex);
103  break;
104 
105  case 2u:
106  optimizeSubsetChannels<2u>(radii, maxSpatialCost, boundingBoxTop, boundingBoxHeight, downIsMain, firstColumn, numberColumns, rowOffset, firstRow, numberRows, threadIndex);
107  break;
108 
109  case 3u:
110  optimizeSubsetChannels<3u>(radii, maxSpatialCost, boundingBoxTop, boundingBoxHeight, downIsMain, firstColumn, numberColumns, rowOffset, firstRow, numberRows, threadIndex);
111  break;
112 
113  case 4u:
114  optimizeSubsetChannels<4u>(radii, maxSpatialCost, boundingBoxTop, boundingBoxHeight, downIsMain, firstColumn, numberColumns, rowOffset, firstRow, numberRows, threadIndex);
115  break;
116 
117  default:
118  ocean_assert(false && "Invalid frame type.");
119  }
120 }
121 
122 template <unsigned int tWeightFactor, unsigned int tBorderFactor, bool tUpdateFrame>
123 template <unsigned int tChannels>
124 void Optimizer4NeighborhoodHighPerformanceF1<tWeightFactor, tBorderFactor, tUpdateFrame>::optimizeSubsetChannels(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const
125 {
126  const unsigned int layerWidth = layerF1_.width();
127  const unsigned int layerHeight = layerF1_.height();
128 
129  ocean_assert(layerWidth != 0u && layerHeight != 0u);
130 
131  const std::vector<Scalar> searchRadii(calculateSearchRadii(radii, layerWidth, layerHeight));
132 
133  Frame& layerFrame = layerF1_.frame();
134  const Frame& layerMask = layerF1_.mask();
135  MappingF1& layerMapping = layerF1_.mapping();
136 
137  ocean_assert(FrameType::formatIsGeneric(layerFrame.pixelFormat(), FrameType::DT_UNSIGNED_INTEGER_8, tChannels));
138  ocean_assert(layerFrame.pixelOrigin() == layerMask.pixelOrigin());
139 
140  ocean_assert(firstColumn + numberColumns <= layerFrame.width());
141  ocean_assert(firstRow + numberRows <= layerFrame.height());
142 
143  RandomGenerator generator(randomGenerator_);
144 
145  uint8_t* const layerFrameData = layerFrame.data<uint8_t>();
146  const uint8_t* const layerMaskData = layerMask.constdata<uint8_t>();
147 
148  const unsigned int layerFramePaddingElements = layerFrame.paddingElements();
149  const unsigned int layerFrameStrideElements = layerFrame.strideElements();
150 
151  const unsigned int layerMaskPaddingElements = layerMask.paddingElements();
152  const unsigned int layerMaskStrideElements = layerMask.strideElements();
153 
154 #ifdef OCEAN_DEBUG
155  const PixelBoundingBox& debugLayerBoundingBox = layerF1_.boundingBox();
156  ocean_assert(!debugLayerBoundingBox || firstRow >= debugLayerBoundingBox.top());
157  ocean_assert(!debugLayerBoundingBox || firstRow + numberRows <= debugLayerBoundingBox.bottomEnd());
158 #endif // OCEAN_DEBUG
159 
160  const bool down = (downIsMain && (threadIndex % 2u) == 0u) || (!downIsMain && (threadIndex % 2u) == 1u);
161 
162  const unsigned int xStart = firstColumn;
163  const unsigned int yStart = firstRow;
164  const unsigned int xEnd = firstColumn + numberColumns;
165  const unsigned int yEnd = firstRow + numberRows;
166 
167  ocean_assert(xEnd - xStart <= layerWidth);
168  ocean_assert(yEnd - yStart <= layerHeight);
169 
170  if (down)
171  {
172  // find better positions for each mask pixel (top left to bottom right)
173  for (unsigned int yy = yStart; yy < yEnd; ++yy)
174  {
175  const unsigned int y = modulo(int(yy + rowOffset - boundingBoxTop), int(boundingBoxHeight)) + boundingBoxTop;
176 
177  const uint8_t* maskRow = layerMask.constrow<uint8_t>(y) + xStart;
178  Vector2* positionRow = layerMapping.row(y) + xStart;
179 
180  for (unsigned int x = xStart; x < xEnd; ++x)
181  {
182  bool foundBetter = false;
183 
184  ocean_assert(maskRow == layerMask.constpixel<uint8_t>(x, y));
185  if (*maskRow != 0xFF)
186  {
187  Scalar newPositionX = positionRow->x();
188  Scalar newPositionY = positionRow->y();
189 
190  const Scalar oldSpatialCost = layerMapping.spatialCost4Neighborhood<tChannels>(x, y, newPositionX, newPositionY, layerMaskData, layerMaskPaddingElements, Scalar(maxSpatialCost));
191  const unsigned int oldColorCost = layerMapping.appearanceCost5x5<tChannels>(x, y, newPositionX, newPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
192  Scalar newCost = Scalar(tWeightFactor) * oldSpatialCost + Scalar(oldColorCost);
193 
194  Scalar testPositionX, testPositionY;
195 
196  // first propagation from left to right
197  ocean_assert(maskRow - 1 == layerMask.constpixel<uint8_t>(x - 1u, y));
198  if (x > 0 && *(maskRow - 1) != 0xFF)
199  {
200  ocean_assert(layerMapping.position(x - 1, y).x() > 0);
201  ocean_assert(*(positionRow - 1) == layerMapping.position(x - 1, y));
202 
203  // take the position to the left (of the current position)
204  testPositionX = (positionRow - 1)->x() + 1;
205  testPositionY = (positionRow - 1)->y();
206 
207  if (testPositionX < Scalar(layerWidth - 3u) && layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] == 0xFF)
208  {
209  // the structure cost is 0 due to the neighbor condition
210  const unsigned int testCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
211 
212  if (Scalar(testCost) < newCost)
213  {
214  newPositionX = testPositionX;
215  newPositionY = testPositionY;
216  newCost = Scalar(testCost);
217  foundBetter = true;
218  }
219  }
220  }
221 
222  // second propagation from top to bottom
223  ocean_assert(maskRow - layerMaskStrideElements == layerMask.constpixel<uint8_t>(x, y - 1u));
224  if (y > 0 && *(maskRow - layerMaskStrideElements) != 0xFF)
225  {
226  ocean_assert(layerMapping.position(x, y - 1).x() > 0);
227  ocean_assert(*(positionRow - layerWidth) == layerMapping.position(x, y - 1));
228 
229  // take the next position to the top (of the current position)
230  testPositionX = (positionRow - layerWidth)->x();
231  testPositionY = (positionRow - layerWidth)->y() + 1;
232 
233  if (testPositionY < Scalar(layerHeight - 3u) && layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] == 0xFF)
234  {
235  // the structure cost is 0 due to the neighbor condition
236  const unsigned int testCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
237 
238  if (Scalar(testCost) < newCost)
239  {
240  newPositionX = testPositionX;
241  newPositionY = testPositionY;
242  newCost = Scalar(testCost);
243  foundBetter = true;
244  }
245  }
246  }
247 
248  // find a better position of the current mask pixel
249  for (unsigned int n = 0; n < radii; ++n)
250  {
251  ocean_assert(newPositionX != -1 && newPositionY != -1);
252 
253  testPositionX = newPositionX + Random::scalar(generator, -searchRadii[n], searchRadii[n]);
254  testPositionY = newPositionY + Random::scalar(generator, -searchRadii[n], searchRadii[n]);
255 
256  // the test position must lie inside the
257  if ((testPositionX == newPositionX && testPositionY == newPositionY) || testPositionX < Scalar(2) || testPositionX >= Scalar(layerWidth - 3u)
258  || testPositionY < Scalar(2) || testPositionY >= Scalar(layerHeight - 3u)
259  || layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] != 0xFF)
260  continue;
261 
262  const Scalar testSpatialCost = layerMapping.spatialCost4Neighborhood<tChannels>(x, y, testPositionX, testPositionY, layerMaskData, layerMaskPaddingElements, Scalar(maxSpatialCost));
263  const unsigned int testColorCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
264  const Scalar testCost = Scalar(tWeightFactor) * testSpatialCost + Scalar(testColorCost);
265 
266  if (testCost < newCost)
267  {
268  newPositionX = testPositionX;
269  newPositionY = testPositionY;
270  newCost = Scalar(testCost);
271  foundBetter = true;
272  }
273  }
274 
275  if (tUpdateFrame && foundBetter)
276  {
277  ocean_assert(layerMask.constpixel<uint8_t>(x, y)[0] != 0xFF);
278  ocean_assert(layerMask.constpixel<uint8_t>(Numeric::round32(newPositionX), Numeric::round32(newPositionY))[0] == 0xFF);
279 
280  *positionRow = Vector2(newPositionX, newPositionY);
281 
282  CV::FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, CV::PC_TOP_LEFT>(layerFrameData, layerWidth, layerHeight, layerFramePaddingElements, Vector2(newPositionX, newPositionY), layerFrameData + y * layerFrameStrideElements + x * tChannels);
283  }
284  }
285 
286  ++maskRow;
287  ++positionRow;
288  }
289  }
290  }
291  else // up
292  {
293  // find better positions for each mask pixel (bottom right to top left)
294  for (unsigned int yy = yEnd - 1u; yy != yStart - 1u; --yy)
295  {
296  const unsigned int y = modulo(int(yy + rowOffset - boundingBoxTop), int(boundingBoxHeight)) + boundingBoxTop;
297 
298  const uint8_t* maskRow = layerMask.constrow<uint8_t>(y) + xEnd - 1u;
299  Vector2* positionRow = layerMapping.row(y) + xEnd - 1u;
300 
301  for (unsigned int x = xEnd - 1u; x != xStart - 1u ; --x)
302  {
303  bool foundBetter = false;
304 
305  ocean_assert(maskRow == layerMask.constpixel<uint8_t>(x, y));
306  if (*maskRow != 0xFF)
307  {
308  Scalar newPositionX = positionRow->x();
309  Scalar newPositionY = positionRow->y();
310 
311  const Scalar oldSpatialCost = layerMapping.spatialCost4Neighborhood<tChannels>(x, y, newPositionX, newPositionY, layerMaskData, layerMaskPaddingElements, Scalar(maxSpatialCost));
312  const unsigned int oldColorCost = layerMapping.appearanceCost5x5<tChannels>(x, y, newPositionX, newPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
313  Scalar newCost = Scalar(tWeightFactor) * oldSpatialCost + Scalar(oldColorCost);
314 
315  Scalar testPositionX, testPositionY;
316 
317  // first propagation from right to left
318  ocean_assert(maskRow + 1 == layerMask.constpixel<uint8_t>(x + 1u, y));
319  if (x < layerWidth - 1 && *(maskRow + 1) != 0xFF)
320  {
321  ocean_assert(layerMapping.position(x + 1, y).x() > 0);
322  ocean_assert(*(positionRow + 1) == layerMapping.position(x + 1, y));
323 
324  // take the position to the right (of the current position)
325  testPositionX = (positionRow + 1)->x() - 1;
326  testPositionY = (positionRow + 1)->y();
327 
328  if (testPositionX >= Scalar(2) && layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] == 0xFF)
329  {
330  // the structure cost is 0 due to the neighbor condition
331  const unsigned int testCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
332 
333  if (Scalar(testCost) < newCost)
334  {
335  newPositionX = testPositionX;
336  newPositionY = testPositionY;
337  newCost = Scalar(testCost);
338  foundBetter = true;
339  }
340  }
341  }
342 
343  // second propagation from bottom to top
344  ocean_assert(maskRow + layerMaskStrideElements == layerMask.constpixel<uint8_t>(x, y + 1u));
345  if (y < layerHeight - 1 && *(maskRow + layerMaskStrideElements) != 0xFF)
346  {
347  ocean_assert(layerMapping.position(x, y + 1).x() > 0);
348  ocean_assert(*(positionRow + layerWidth) == layerMapping.position(x, y + 1));
349 
350  // take the next position towards the bottom (of the current position)
351  testPositionX = (positionRow + layerWidth)->x();
352  testPositionY = (positionRow + layerWidth)->y() - 1;
353 
354  if (testPositionY >= Scalar(2) && layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] == 0xFF)
355  {
356  // the structure cost is 0 due to the neighbor condition
357  const unsigned int testCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
358 
359  if (Scalar(testCost) < newCost)
360  {
361  newPositionX = testPositionX;
362  newPositionY = testPositionY;
363  newCost = Scalar(testCost);
364  foundBetter = true;
365  }
366  }
367  }
368 
369  // find a better position of the current mask pixel
370  for (unsigned int n = 0; n < radii; ++n)
371  {
372  ocean_assert(newPositionX != -1 && newPositionY != -1);
373 
374  testPositionX = newPositionX + Random::scalar(generator, -searchRadii[n], searchRadii[n]);
375  testPositionY = newPositionY + Random::scalar(generator, -searchRadii[n], searchRadii[n]);
376 
377  if ((testPositionX == newPositionX && testPositionY == newPositionY) || testPositionX < Scalar(2) || testPositionX >= Scalar(layerWidth - 3u)
378  || testPositionY < Scalar(2) || testPositionY >= Scalar(layerHeight - 3u)
379  || layerMaskData[Numeric::round32(testPositionY) * layerMaskStrideElements + Numeric::round32(testPositionX)] != 0xFF)
380  continue;
381 
382  const Scalar testSpatialCost = layerMapping.spatialCost4Neighborhood<tChannels>(x, y, testPositionX, testPositionY, layerMaskData, layerMaskPaddingElements, Scalar(maxSpatialCost));
383  const unsigned int testColorCost = layerMapping.appearanceCost5x5<tChannels>(x, y, testPositionX, testPositionY, layerFrameData, layerMaskData, layerFramePaddingElements, layerMaskPaddingElements, tBorderFactor);
384  const Scalar testCost = Scalar(tWeightFactor) * testSpatialCost + Scalar(testColorCost);
385 
386  if (testCost < newCost)
387  {
388  newPositionX = testPositionX;
389  newPositionY = testPositionY;
390  newCost = Scalar(testCost);
391  foundBetter = true;
392  }
393  }
394 
395  if (tUpdateFrame && foundBetter)
396  {
397  ocean_assert(layerMask.constpixel<uint8_t>(x, y)[0] != 0xFF);
398  ocean_assert(layerMask.constpixel<uint8_t>(Numeric::round32(newPositionX), Numeric::round32(newPositionY))[0] == 0xFF);
399 
400  *positionRow = Vector2(newPositionX, newPositionY);
401 
402  CV::FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, CV::PC_TOP_LEFT>(layerFrameData, layerWidth, layerHeight, layerFramePaddingElements, Vector2(newPositionX, newPositionY), layerFrameData + y * layerFrameStrideElements + x * tChannels);
403  }
404  }
405 
406  --maskRow;
407  --positionRow;
408  }
409  }
410  }
411 }
412 
413 }
414 
415 }
416 
417 }
418 
419 #endif // META_OCEAN_CV_SYNTHESIS_OPTIMIZER_4_NEIGHBORHOOD_HIGH_PERFORMANCE_F_1_H
T bottomEnd() const
Returns the bottom (excluding) pixel position of this bounding box.
Definition: PixelBoundingBox.h:451
T top() const
Returns the top (including) pixel position of this bounding box.
Definition: PixelBoundingBox.h:423
This class implements a single layer for pixel synthesis within one frame and sub-pixel accuracy.
Definition: LayerF1.h:44
Cost function:
Definition: MappingF1.h:52
unsigned int appearanceCost5x5(const unsigned int xTarget, const unsigned int yTarget, const Scalar xSource, const Scalar ySource, const uint8_t *frame, const uint8_t *mask, const unsigned int framePaddingElements, const unsigned int maskPaddingElements, const unsigned int borderFactor) const
Calculates the appearance cost for a given point in a given frame.
Definition: MappingF1.h:265
Scalar spatialCost4Neighborhood(const unsigned int xTarget, const unsigned int yTarget, const Scalar xSource, const Scalar ySource, const uint8_t *targetMask, const unsigned int targetMaskPaddingElements, const Scalar maxCost) const
Calculates the smallest/cheapest spatial cost for a given point in a four-neighborhood and normalizes...
Definition: MappingF1.h:259
const Vector2 * row(const unsigned int y) const
Returns the pointer to a mapping row.
Definition: MappingF.h:210
const Vector2 & position(const unsigned int x, const unsigned int y) const
Returns the mapping for a given position.
Definition: MappingF.h:189
This class implements the base class for all synthesis optimizers that use one single frame.
Definition: Optimizer1.h:28
This class implements a high performance mapping optimizer for float mappings that use one single fra...
Definition: Optimizer4NeighborhoodHighPerformanceF1.h:38
LayerF1 & layerF1_
Specialized layer reference.
Definition: Optimizer4NeighborhoodHighPerformanceF1.h:80
void optimizeSubset(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const override
Optimizes a subset of the synthesis frame.
Definition: Optimizer4NeighborhoodHighPerformanceF1.h:95
void optimizeSubsetChannels(const unsigned int radii, const unsigned int maxSpatialCost, const unsigned int boundingBoxTop, const unsigned int boundingBoxHeight, const bool downIsMain, const unsigned int firstColumn, const unsigned int numberColumns, const unsigned int rowOffset, const unsigned int firstRow, const unsigned int numberRows, const unsigned int threadIndex) const
Specialization of the default subset optimization function.
Definition: Optimizer4NeighborhoodHighPerformanceF1.h:124
Optimizer4NeighborhoodHighPerformanceF1(LayerF1 &layer, RandomGenerator &randomGenerator)
Creates a new optimizer object.
Definition: Optimizer4NeighborhoodHighPerformanceF1.h:84
This class is the base class for all optimizers that use a mapping with float accuracy.
Definition: OptimizerF.h:29
This class is the base class for all synthesis optimizers.
Definition: Optimizer.h:30
This class is the base class for all optimizers that are able to optimize seperate subsets of the syn...
Definition: OptimizerSubset.h:30
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
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
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
unsigned int width() const
Returns the width of the frame format in pixel.
Definition: Frame.h:3143
PixelOrigin pixelOrigin() const
Returns the pixel origin of the frame.
Definition: Frame.h:3188
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition: Frame.h:3153
@ DT_UNSIGNED_INTEGER_8
Unsigned 8 bit integer data type (uint8_t).
Definition: Frame.h:41
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3148
static bool formatIsGeneric(const PixelFormat pixelFormat, const DataType dataType, const uint32_t channels, const uint32_t planes=1u, const uint32_t widthMultiple=1u, const uint32_t heightMultiple=1u)
Checks whether a given pixel format is a specific layout regarding data channels and data type.
Definition: Frame.h:3406
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 T scalar(const T lower, const T upper)
Returns a random number between two borders.
Definition: Random.h:388
const T & x() const noexcept
Returns the x value.
Definition: Vector2.h:698
T modulo(const T &value, const T &ring)
Returns the modulo value of a given parameter within a ring allowing positive and negative parameters...
Definition: base/Utilities.h:924
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