8 #ifndef META_OCEAN_CV_ADVANCED_PANORAMA_FRAME_H
9 #define META_OCEAN_CV_ADVANCED_PANORAMA_FRAME_H
88 inline PanoramaFrame(
const unsigned int width,
const unsigned int height,
const uint8_t maskValue,
const UpdateMode updateMode);
119 inline uint8_t maskValue()
const;
132 inline const Frame& frame()
const;
138 inline const Frame& mask()
const;
150 inline unsigned int dimensionWidth()
const;
156 inline unsigned int dimensionHeight()
const;
259 inline bool isValid()
const;
265 explicit inline operator bool()
const;
315 static inline Vector2 angle2pixel(
const Vector2& angle,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight);
325 static inline Vector2 angle2pixelStrict(
const Vector2& angle,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight);
335 static inline Vector2 pixel2angle(
const Vector2& position,
const Scalar invPanoramaDimensionWidth,
const Scalar invPanoramaDimensionHeight);
345 static inline Vector2 pixel2angleStrict(
const Vector2& position,
const Scalar invPanoramaDimensionWidth,
const Scalar invPanoramaDimensionHeight);
406 static bool cameraFrame2cameraFrame(
const PinholeCamera& inputCamera,
const SquareMatrix3& inputOrientation,
const Frame& inputFrame,
const Frame& inputMask,
const PinholeCamera& outputCamera,
const SquareMatrix3& outputOrientation,
Frame& outputFrame,
Frame& outputMask,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker);
425 static bool panoramaFrame2cameraFrame(
const PinholeCamera& pinholeCamera,
const Frame& panoramaFrame,
const Frame& panoramaMask,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPosition& panoramaFrameTopLeft,
const SquareMatrix3& orientation,
Frame& cameraFrame,
Frame& cameraMask,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
443 static bool cameraFrame2panoramaFrame(
const PinholeCamera& pinholeCamera,
const Frame& cameraFrame,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft,
Frame& panoramaFrame,
Frame& panoramaMask,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
462 static bool cameraFrame2panoramaFrame(
const PinholeCamera& pinholeCamera,
const Frame& cameraFrame,
const Frame& cameraMask,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft,
Frame& panoramaFrame,
Frame& panoramaMask,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
483 template <
unsigned int tChannels>
484 static inline void cameraFrame2cameraFrame8BitPerChannel(
const PinholeCamera& inputCamera,
const SquareMatrix3& inputOrientation,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements,
const PinholeCamera& outputCamera,
const SquareMatrix3& outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker);
509 template <
unsigned int tChannels>
510 static inline void panoramaFrame2cameraFrame8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPosition& panoramaFrameTopLeft,
const SquareMatrix3& orientation, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
533 template <
unsigned int tChannels>
534 static inline void cameraFrame2panoramaFrame8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* cameraFrame,
const unsigned int cameraFramePaddingElements,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
559 template <
unsigned int tChannels>
560 static inline void cameraFrame2panoramaFrameMask8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue = 0xFFu,
const unsigned int approximationBinSize = 20u,
Worker* worker =
nullptr,
const LookupTable* fineAdjustment =
nullptr);
677 template <
unsigned int tChannels>
678 static inline void mergeSetAll8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker =
nullptr);
700 template <
unsigned int tChannels>
701 static inline void mergeSetNew8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker =
nullptr);
723 template <
unsigned int tChannels>
724 static inline void mergeAverageLocal8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker =
nullptr);
748 template <
unsigned int tChannels>
749 static inline void mergeAverageGlobal8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint32_t* panoramaNominatorFrame, uint32_t* panoramaDenominatorFrame, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker =
nullptr);
773 template <
unsigned int tChannels>
774 static void mergeSetAll8BitPerChannelSubset(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int panoramaSubFramePaddingElements,
const unsigned int panoramaSubMaskPaddingElements,
const unsigned int subTopLeftX,
const unsigned int subTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaTopLeftX,
const unsigned int panoramaTopLeftY,
const uint8_t maskValue,
const unsigned int firstSubRow,
const unsigned int numberSubRows);
798 template <
unsigned int tChannels>
799 static void mergeSetNew8BitPerChannelSubset(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int panoramaSubFramePaddingElements,
const unsigned int panoramaSubMaskPaddingElements,
const unsigned int subTopLeftX,
const unsigned int subTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaTopLeftX,
const unsigned int panoramaTopLeftY,
const uint8_t maskValue,
const unsigned int firstSubRow,
const unsigned int numberSubRows);
823 template <
unsigned int tChannels>
824 static void mergeAverageLocal8BitPerChannelSubset(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int panoramaSubFramePaddingElements,
const unsigned int panoramaSubMaskPaddingElements,
const unsigned int subTopLeftX,
const unsigned int subTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaTopLeftX,
const unsigned int panoramaTopLeftY,
const uint8_t maskValue,
const unsigned int firstSubRow,
const unsigned int numberSubRows);
850 template <
unsigned int tChannels>
851 static void mergeAverageGlobal8BitPerChannelSubset(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int panoramaSubFramePaddingElements,
const unsigned int panoramaSubMaskPaddingElements,
const unsigned int subTopLeftX,
const unsigned int subTopLeftY, uint32_t* panoramaNominatorFrame, uint32_t* panoramaDenominatorFrame, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaTopLeftX,
const unsigned int panoramaTopLeftY,
const uint8_t maskValue,
const unsigned int firstSubRow,
const unsigned int numberSubRows);
870 template <
unsigned int tChannels>
871 static void cameraFrame2cameraFrame8BitPerChannelSubset(
const PinholeCamera* inputCamera,
const SquareMatrix3* inputOrientation,
const uint8_t* inputFrame,
const unsigned int inputFramePaddingElements,
const PinholeCamera* outputCamera,
const SquareMatrix3* outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows);
890 template <
unsigned int tChannels>
891 static void cameraFrame2cameraFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* inputFrame,
const unsigned int inputWidth,
const unsigned int inputHeight,
const unsigned int inputFramePaddingElements, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows);
912 template <
unsigned int tChannels>
913 static void cameraFrame2cameraFrameMask8BitPerChannelSubset(
const PinholeCamera* inputCamera,
const SquareMatrix3* inputOrientation,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements,
const PinholeCamera* outputCamera,
const SquareMatrix3* outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows);
934 template <
unsigned int tChannels>
935 static void cameraFrame2cameraFrameMaskLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputWidth,
const unsigned int inputHeight,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows);
961 template <
unsigned int tChannels>
962 static void panoramaFrame2cameraFrame8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const unsigned int panoramaFrameTopLeftX,
const unsigned int panoramaFrameTopLeftY,
const SquareMatrix3* orientation, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstCameraRow,
const unsigned int numberCameraRows);
986 template <
unsigned int tChannels>
987 static void panoramaFrame2cameraFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const unsigned int panoramaFrameTopLeftX,
const unsigned int panoramaFrameTopLeftY,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstCameraRow,
const unsigned int numberCameraRows);
1011 template <
unsigned int tChannels>
1012 static void cameraFrame2panoramaFrame8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* cameraFrame,
const unsigned int cameraFramePaddingElements,
const SquareMatrix3* orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const int panoramaFrameTopLeftX,
const int panoramaFrameTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows);
1030 template <
unsigned int tChannels>
1031 static void cameraFrame2panoramaFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* cameraFrame,
const unsigned int cameraFrameWidth,
const unsigned int cameraFrameHeight,
const unsigned int cameraFramePaddingElements, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows);
1057 template <
unsigned int tChannels>
1058 static void cameraFrame2panoramaFrameMask8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const SquareMatrix3* orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const int panoramaFrameTopLeftX,
const int panoramaFrameTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows);
1078 template <
unsigned int tChannels>
1079 static void cameraFrame2panoramaFrameMaskLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFrameWidth,
const unsigned int cameraFrameHeight,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows);
1106 unsigned int dimensionWidth_ = 0u;
1109 unsigned int dimensionHeight_ = 0u;
1121 uint8_t maskValue_ = 0xFFu;
1128 dimensionWidth_(dimensionWidth),
1129 dimensionHeight_(dimensionHeight),
1130 invertedDimensionWidth_(dimensionWidth != 0u ?
Scalar(1) /
Scalar(dimensionWidth) : 0),
1131 invertedDimensionHeight_(dimensionHeight != 0u ?
Scalar(1) /
Scalar(dimensionHeight) : 0),
1132 frameTopLeft_((unsigned int)(-1), (unsigned int)(-1)),
1133 maskValue_(maskValue),
1134 updateMode_(updateMode)
1182 return panoramaFrame2cameraFrame(pinholeCamera,
frame_,
mask_,
dimensionWidth_,
dimensionHeight_,
frameTopLeft_, orientation,
frame,
mask,
maskValue_, approximationBinSize, worker, fineAdjustment);
1189 ocean_assert(cameraPixel.
x() >=
Scalar(0) && cameraPixel.
x() <
Scalar(pinholeCamera.
width()));
1190 ocean_assert(cameraPixel.
y() >=
Scalar(0) && cameraPixel.
y() <
Scalar(pinholeCamera.
height()));
1197 return panoramaPosition;
1204 ocean_assert(cameraPixel.
x() >=
Scalar(0) && cameraPixel.
x() <
Scalar(pinholeCamera.
width()));
1205 ocean_assert(cameraPixel.
y() >=
Scalar(0) && cameraPixel.
y() <
Scalar(pinholeCamera.
height()));
1212 return panoramaPosition;
1221 ocean_assert(ray.
z() < 0);
1224 ocean_assert(rayOnPlane.
z() < 0);
1228 return cameraPosition;
1236 inline PanoramaFrame::operator bool()
const
1273 ocean_assert(x >= 0 && x <
Scalar(panoramaDimensionWidth));
1274 ocean_assert(y >= 0 && y <
Scalar(panoramaDimensionHeight));
1281 ocean_assert(invPanoramaDimensionWidth > 0 && invPanoramaDimensionWidth <= 1);
1282 ocean_assert(invPanoramaDimensionHeight > 0 && invPanoramaDimensionHeight <= 1);
1287 return Vector2(latitude, longitude);
1292 ocean_assert(invPanoramaDimensionWidth > 0 && invPanoramaDimensionWidth <= 1);
1293 ocean_assert(invPanoramaDimensionHeight > 0 && invPanoramaDimensionHeight <= 1);
1295 ocean_assert(position.
x() >= 0 && position.
x() <=
Scalar(1) /
Scalar(invPanoramaDimensionWidth));
1296 ocean_assert(position.
y() >= 0 && position.
y() <=
Scalar(1) /
Scalar(invPanoramaDimensionHeight));
1304 return Vector2(latitude, longitude);
1322 longitude = longitudeMinus;
1326 longitude = longitudePlus;
1334 latitude = latitudeMinus;
1338 latitude = latitudePlus;
1341 return Vector2(longitude, latitude);
1358 return Vector2(longitude, latitude);
1385 template <
unsigned int tChannels>
1386 inline void PanoramaFrame::cameraFrame2cameraFrame8BitPerChannel(
const PinholeCamera& inputCamera,
const SquareMatrix3& inputOrientation,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements,
const PinholeCamera& outputCamera,
const SquareMatrix3& outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker)
1388 static_assert(tChannels >= 1u,
"Invalid channel number!");
1393 ocean_assert(inputFrame !=
nullptr && outputFrame !=
nullptr && outputMask !=
nullptr);
1395 if (approximationBinSize <= 1u)
1397 if (inputMask !=
nullptr)
1399 if (worker !=
nullptr)
1401 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::cameraFrame2cameraFrameMask8BitPerChannelSubset<tChannels>, &inputCamera, &inputOrientation, inputFrame, inputMask, inputFramePaddingElements, inputMaskPaddingElements, &outputCamera, &outputOrientation, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, 0u), 0u, outputCamera.
height());
1405 cameraFrame2cameraFrameMask8BitPerChannelSubset<tChannels>(&inputCamera, &inputOrientation, inputFrame, inputMask, inputFramePaddingElements, inputMaskPaddingElements, &outputCamera, &outputOrientation, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, outputCamera.
height());
1410 if (worker !=
nullptr)
1412 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::cameraFrame2cameraFrame8BitPerChannelSubset<tChannels>, &inputCamera, &inputOrientation, inputFrame, inputFramePaddingElements, &outputCamera, &outputOrientation, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, 0u), 0u, outputCamera.
height());
1416 cameraFrame2cameraFrame8BitPerChannelSubset<tChannels>(&inputCamera, &inputOrientation, inputFrame, inputFramePaddingElements, &outputCamera, &outputOrientation, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, outputCamera.
height());
1422 const unsigned int binsX = min(outputCamera.
width() / approximationBinSize, outputCamera.
width() / 4u);
1423 const unsigned int binsY = min(outputCamera.
height() / approximationBinSize, outputCamera.
height() / 4u);
1428 if (inputMask !=
nullptr)
1430 if (worker !=
nullptr)
1432 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2cameraFrameMaskLookup8BitPerChannelSubset<tChannels>, (
const LookupTable*)&lookupTable, inputFrame, inputMask, inputCamera.
width(), inputCamera.
height(), inputFramePaddingElements, inputMaskPaddingElements, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, 0u), 0u, outputCamera.
height());
1436 cameraFrame2cameraFrameMaskLookup8BitPerChannelSubset<tChannels>((
const LookupTable*)&lookupTable, inputFrame, inputMask, inputCamera.
width(), inputCamera.
height(), inputFramePaddingElements, inputMaskPaddingElements, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, outputCamera.
height());
1441 if (worker !=
nullptr)
1443 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2cameraFrameLookup8BitPerChannelSubset<tChannels>, (
const LookupTable*)&lookupTable, inputFrame, inputCamera.
width(), inputCamera.
height(), inputFramePaddingElements, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, 0u), 0u, outputCamera.
height());
1447 cameraFrame2cameraFrameLookup8BitPerChannelSubset<tChannels>((
const LookupTable*)&lookupTable, inputFrame, inputCamera.
width(), inputCamera.
height(), inputFramePaddingElements, outputFrame, outputMask, outputFramePaddingElements, outputMaskPaddingElements,
maskValue, 0u, outputCamera.
height());
1453 template <
unsigned int tChannels>
1454 inline void PanoramaFrame::panoramaFrame2cameraFrame8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPosition& panoramaFrameTopLeft,
const SquareMatrix3& orientation, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker,
const LookupTable* fineAdjustment)
1456 static_assert(tChannels >= 1u,
"Invalid channel number!");
1459 ocean_assert(panoramaFrame !=
nullptr && panoramaMask !=
nullptr);
1460 ocean_assert(panoramaFrameWidth != 0u && panoramaFrameHeight != 0u);
1461 ocean_assert(cameraFrame !=
nullptr && cameraMask !=
nullptr);
1463 if (approximationBinSize <= 1u)
1465 if (worker !=
nullptr)
1467 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::panoramaFrame2cameraFrame8BitPerChannelSubset<tChannels>, &pinholeCamera, panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), &orientation, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements,
maskValue, fineAdjustment, 0u, 0u), 0u, pinholeCamera.
height());
1471 panoramaFrame2cameraFrame8BitPerChannelSubset<tChannels>(&pinholeCamera, panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), &orientation, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements,
maskValue, fineAdjustment, 0u, pinholeCamera.
height());
1476 const unsigned int binsX = min(pinholeCamera.
width() / approximationBinSize, pinholeCamera.
width() / 4u);
1477 const unsigned int binsY = min(pinholeCamera.
height() / approximationBinSize, pinholeCamera.
height() / 4u);
1482 if (worker !=
nullptr)
1484 worker->
executeFunction(
Worker::Function::createStatic(&panoramaFrame2cameraFrameLookup8BitPerChannelSubset<tChannels>, (
const LookupTable*)(&lookupTable), panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrameWidth, panoramaFrameHeight, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements,
maskValue, 0u, 0u), 0u, pinholeCamera.
height());
1488 panoramaFrame2cameraFrameLookup8BitPerChannelSubset<tChannels>((
const LookupTable*)(&lookupTable), panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrameWidth, panoramaFrameHeight, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements,
maskValue, 0u, pinholeCamera.
height());
1493 template <
unsigned int tChannels>
1494 inline void PanoramaFrame::cameraFrame2panoramaFrame8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* cameraFrame,
const unsigned int cameraFramePaddingElements,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker,
const LookupTable* fineAdjustment)
1496 static_assert(tChannels >= 1u,
"Invalid channel number!");
1499 ocean_assert(cameraFrame !=
nullptr);
1500 ocean_assert(panoramaFrame !=
nullptr && panoramaMask !=
nullptr);
1501 ocean_assert(panoramaFrameWidth != 0u && panoramaFrameHeight != 0u);
1503 if (approximationBinSize <= 1u)
1505 if (worker !=
nullptr)
1507 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2panoramaFrame8BitPerChannelSubset<tChannels>, &pinholeCamera, cameraFrame, cameraFramePaddingElements, &orientation, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, fineAdjustment, 0u, 0u), 0u, panoramaFrameHeight);
1511 cameraFrame2panoramaFrame8BitPerChannelSubset<tChannels>(&pinholeCamera, cameraFrame, cameraFramePaddingElements, &orientation, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, fineAdjustment, 0u, panoramaFrameHeight);
1516 const unsigned int binSize = approximationBinSize != 0u ? approximationBinSize : 20u;
1518 const unsigned int binsX = min(panoramaFrameWidth / binSize, panoramaFrameWidth / 4u);
1519 const unsigned int binsY = min(panoramaFrameHeight / binSize, panoramaFrameHeight / 4u);
1520 LookupTable lookupTable(panoramaFrameWidth, panoramaFrameHeight, binsX, binsY);
1524 if (worker !=
nullptr)
1526 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2panoramaFrameLookup8BitPerChannelSubset<tChannels>, (
const LookupTable*)(&lookupTable), cameraFrame, pinholeCamera.
width(), pinholeCamera.
height(), cameraFramePaddingElements, panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, 0u, 0u), 0u, panoramaFrameHeight);
1530 cameraFrame2panoramaFrameLookup8BitPerChannelSubset<tChannels>(&lookupTable, cameraFrame, pinholeCamera.
width(), pinholeCamera.
height(), cameraFramePaddingElements, panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, 0u, panoramaFrameHeight);
1535 template <
unsigned int tChannels>
1536 inline void PanoramaFrame::cameraFrame2panoramaFrameMask8BitPerChannel(
const PinholeCamera& pinholeCamera,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const SquareMatrix3& orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const PixelPositionI& panoramaFrameTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int approximationBinSize,
Worker* worker,
const LookupTable* fineAdjustment)
1538 static_assert(tChannels >= 1u,
"Invalid channel number!");
1542 ocean_assert(cameraFrame !=
nullptr && cameraMask !=
nullptr);
1543 ocean_assert(panoramaFrame !=
nullptr && panoramaMask !=
nullptr);
1544 ocean_assert(panoramaFrameWidth != 0u && panoramaFrameHeight != 0u);
1546 if (approximationBinSize <= 1u)
1548 if (worker !=
nullptr)
1550 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2panoramaFrameMask8BitPerChannelSubset<tChannels>, &pinholeCamera, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements, &orientation, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, fineAdjustment, 0u, 0u), 0u, panoramaFrameHeight);
1554 cameraFrame2panoramaFrameMask8BitPerChannelSubset<tChannels>(&pinholeCamera, cameraFrame, cameraMask, cameraFramePaddingElements, cameraMaskPaddingElements, &orientation, panoramaDimensionWidth, panoramaDimensionHeight, panoramaFrameTopLeft.
x(), panoramaFrameTopLeft.
y(), panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, fineAdjustment, 0u, panoramaFrameHeight);
1559 const unsigned int binSize = approximationBinSize != 0u ? approximationBinSize : 20u;
1561 const unsigned int binsX = min(panoramaFrameWidth / binSize, panoramaFrameWidth / 4u);
1562 const unsigned int binsY = min(panoramaFrameHeight / binSize, panoramaFrameHeight / 4u);
1563 LookupTable lookupTable(panoramaFrameWidth, panoramaFrameHeight, binsX, binsY);
1567 if (worker !=
nullptr)
1569 worker->
executeFunction(
Worker::Function::createStatic(&cameraFrame2panoramaFrameMaskLookup8BitPerChannelSubset<tChannels>, (
const LookupTable*)(&lookupTable), cameraFrame, cameraMask, pinholeCamera.
width(), pinholeCamera.
height(), cameraFramePaddingElements, cameraMaskPaddingElements, panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, 0u, 0u), 0u, panoramaFrameHeight);
1573 cameraFrame2panoramaFrameMaskLookup8BitPerChannelSubset<tChannels>((
const LookupTable*)(&lookupTable), cameraFrame, cameraMask, pinholeCamera.
width(), pinholeCamera.
height(), cameraFramePaddingElements, cameraMaskPaddingElements, panoramaFrame, panoramaMask, panoramaFramePaddingElements, panoramaMaskPaddingElements,
maskValue, 0u, panoramaFrameHeight);
1578 template <
unsigned int tChannels>
1579 inline void PanoramaFrame::mergeSetAll8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker)
1581 static_assert(tChannels >= 1u,
"Invalid channel number!");
1583 if (worker !=
nullptr)
1585 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::mergeSetAll8BitPerChannelSubset<tChannels>, panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, 0u), 0u, subFrameHeight, 15u, 16u, 20u);
1589 mergeSetAll8BitPerChannelSubset<tChannels>(panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, subFrameHeight);
1593 template <
unsigned int tChannels>
1594 inline void PanoramaFrame::mergeSetNew8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker)
1596 static_assert(tChannels >= 1u,
"Invalid channel number!");
1598 if (worker !=
nullptr)
1600 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::mergeSetNew8BitPerChannelSubset<tChannels>, panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, 0u), 0u, subFrameHeight, 15u, 16u, 20u);
1604 mergeSetNew8BitPerChannelSubset<tChannels>(panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, subFrameHeight);
1608 template <
unsigned int tChannels>
1609 inline void PanoramaFrame::mergeAverageLocal8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker)
1611 static_assert(tChannels >= 1u,
"Invalid channel number!");
1613 if (worker !=
nullptr)
1615 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::mergeAverageLocal8BitPerChannelSubset<tChannels>, panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, 0u), 0u, subFrameHeight, 15u, 16u, 20u);
1619 mergeAverageLocal8BitPerChannelSubset<tChannels>(panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, subFrameHeight);
1623 template <
unsigned int tChannels>
1624 inline void PanoramaFrame::mergeAverageGlobal8BitPerChannel(
const uint8_t* panoramaSubFrame,
const uint8_t* panoramaSubMask,
const unsigned int subFrameWidth,
const unsigned int subFrameHeight,
const unsigned int panoramaSubFramePaddingElements,
const unsigned int panoramaSubMaskPaddingElements,
const PixelPosition& subTopLeft, uint32_t* panoramaNominatorFrame, uint32_t* panoramaDenominatorFrame, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaWidth,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const PixelPosition& panoramaTopLeft,
const uint8_t maskValue,
Worker* worker)
1626 static_assert(tChannels >= 1u,
"Invalid channel number!");
1628 if (worker !=
nullptr)
1630 worker->
executeFunction(
Worker::Function::createStatic(&PanoramaFrame::mergeAverageGlobal8BitPerChannelSubset<tChannels>, panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaNominatorFrame, panoramaDenominatorFrame, panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, 0u), 0u, subFrameHeight, 17u, 18u, 20u);
1634 mergeAverageGlobal8BitPerChannelSubset<tChannels>(panoramaSubFrame, panoramaSubMask, subFrameWidth, panoramaSubFramePaddingElements, panoramaSubMaskPaddingElements, subTopLeft.
x(), subTopLeft.
y(), panoramaNominatorFrame, panoramaDenominatorFrame, panoramaFrame, panoramaMask, panoramaWidth, panoramaFramePaddingElements, panoramaMaskPaddingElements, panoramaTopLeft.
x(), panoramaTopLeft.
y(),
maskValue, 0u, subFrameHeight);
1638 template <
unsigned int tChannels>
1639 void PanoramaFrame::cameraFrame2cameraFrame8BitPerChannelSubset(
const PinholeCamera* inputCamera,
const SquareMatrix3* inputOrientation,
const uint8_t* inputFrame,
const unsigned int inputFramePaddingElements,
const PinholeCamera* outputCamera,
const SquareMatrix3* outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows)
1641 static_assert(tChannels >= 1u,
"Invalid channel number!");
1643 ocean_assert(inputCamera !=
nullptr && inputCamera->
isValid());
1644 ocean_assert(inputOrientation !=
nullptr && !inputOrientation->
isSingular());
1646 ocean_assert(outputCamera !=
nullptr && outputCamera->
isValid());
1647 ocean_assert(outputOrientation !=
nullptr && !outputOrientation->
isSingular());
1649 ocean_assert(inputFrame !=
nullptr && outputFrame !=
nullptr && outputMask !=
nullptr);
1651 ocean_assert(firstOutputRow + numberOutputRows <= outputCamera->height());
1658 const unsigned int outputFrameStrideElements = outputCamera->
width() * tChannels + outputFramePaddingElements;
1659 const unsigned int outputMaskStrideElements = outputCamera->
width() + outputMaskPaddingElements;
1661 outputFrame += firstOutputRow * outputFrameStrideElements;
1662 outputMask += firstOutputRow * outputMaskStrideElements;
1664 for (
unsigned int y = firstOutputRow; y < firstOutputRow + numberOutputRows; ++y)
1666 for (
unsigned int x = 0u; x < outputCamera->
width(); ++x)
1670 if (inputPosition_05.
x() >= 0 && inputPosition_05.
x() <=
Scalar(inputCamera->
width()) && inputPosition_05.
y() >= 0 && inputPosition_05.
y() <=
Scalar(inputCamera->
height()))
1672 FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, PC_CENTER>(inputFrame, inputCamera->
width(), inputCamera->
height(), inputFramePaddingElements, inputPosition_05, outputFrame);
1680 outputFrame += tChannels;
1684 outputFrame += outputFramePaddingElements;
1685 outputMask += outputMaskPaddingElements;
1689 template <
unsigned int tChannels>
1690 void PanoramaFrame::cameraFrame2cameraFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* inputFrame,
const unsigned int inputWidth,
const unsigned int inputHeight,
const unsigned int inputFramePaddingElements, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows)
1692 static_assert(tChannels >= 1u,
"Invalid channel number!");
1694 ocean_assert(lookupTable && !lookupTable->
isEmpty());
1695 ocean_assert(inputFrame);
1696 ocean_assert(outputFrame && outputMask);
1698 const unsigned int outputFrameStrideElements = (
unsigned int)(lookupTable->
sizeX()) * tChannels + outputFramePaddingElements;
1699 const unsigned int outputMaskStrideElements = (
unsigned int)(lookupTable->
sizeX()) + outputMaskPaddingElements;
1701 outputFrame += firstOutputRow * outputFrameStrideElements;
1702 outputMask += firstOutputRow * outputMaskStrideElements;
1704 for (
unsigned int y = firstOutputRow; y < firstOutputRow + numberOutputRows; ++y)
1706 for (
unsigned int x = 0u; x < lookupTable->
sizeX(); ++x)
1710 if (inputPosition_05.
x() >= 0 && inputPosition_05.
x() <=
Scalar(inputWidth) && inputPosition_05.
y() >= 0 && inputPosition_05.
y() <=
Scalar(inputHeight))
1712 FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, PC_CENTER>(inputFrame, inputWidth, inputHeight, inputFramePaddingElements, inputPosition_05, outputFrame);
1720 outputFrame += tChannels;
1724 outputFrame += outputFramePaddingElements;
1725 outputMask += outputMaskPaddingElements;
1729 template <
unsigned int tChannels>
1730 void PanoramaFrame::cameraFrame2cameraFrameMask8BitPerChannelSubset(
const PinholeCamera* inputCamera,
const SquareMatrix3* inputOrientation,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements,
const PinholeCamera* outputCamera,
const SquareMatrix3* outputOrientation, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows)
1732 static_assert(tChannels >= 1u,
"Invalid channel number!");
1734 ocean_assert(inputCamera !=
nullptr && inputCamera->
isValid());
1735 ocean_assert(inputOrientation !=
nullptr && !inputOrientation->
isSingular());
1737 ocean_assert(outputCamera !=
nullptr && outputCamera->
isValid());
1738 ocean_assert(outputOrientation !=
nullptr && !outputOrientation->
isSingular());
1740 ocean_assert(inputFrame !=
nullptr && inputMask !=
nullptr && outputFrame !=
nullptr && outputMask !=
nullptr );
1742 ocean_assert(firstOutputRow + numberOutputRows <= outputCamera->height());
1749 const unsigned int outputFrameStrideElements = outputCamera->
width() * tChannels + outputFramePaddingElements;
1750 const unsigned int outputMaskStrideElements = outputCamera->
width() + outputMaskPaddingElements;
1752 outputFrame += firstOutputRow * outputFrameStrideElements;
1753 outputMask += firstOutputRow * outputMaskStrideElements;
1755 for (
unsigned int y = firstOutputRow; y < firstOutputRow + numberOutputRows; ++y)
1757 for (
unsigned int x = 0u; x < outputCamera->
width(); ++x)
1760 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(inputFrame, inputMask, inputCamera->
width(), inputCamera->
height(), inputFramePaddingElements, inputMaskPaddingElements, inputPosition, outputFrame, outputMask[x],
maskValue);
1762 outputFrame += tChannels;
1765 outputFrame += outputFramePaddingElements;
1766 outputMask += outputMaskStrideElements;
1770 template <
unsigned int tChannels>
1771 void PanoramaFrame::cameraFrame2cameraFrameMaskLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* inputFrame,
const uint8_t* inputMask,
const unsigned int inputWidth,
const unsigned int inputHeight,
const unsigned int inputFramePaddingElements,
const unsigned int inputMaskPaddingElements, uint8_t* outputFrame, uint8_t* outputMask,
const unsigned int outputFramePaddingElements,
const unsigned int outputMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstOutputRow,
const unsigned int numberOutputRows)
1773 static_assert(tChannels >= 1u,
"Invalid channel number!");
1775 ocean_assert(lookupTable !=
nullptr && !lookupTable->
isEmpty());
1776 ocean_assert(inputFrame !=
nullptr && inputMask !=
nullptr);
1777 ocean_assert(outputFrame !=
nullptr && outputMask !=
nullptr);
1779 const unsigned int outputFrameStrideElements = (
unsigned int)(lookupTable->
sizeX()) * tChannels + outputFramePaddingElements;
1780 const unsigned int outputMaskStrideElements = (
unsigned int)(lookupTable->
sizeX()) + outputMaskPaddingElements;
1782 outputFrame += firstOutputRow * outputFrameStrideElements;
1783 outputMask += firstOutputRow * outputMaskStrideElements;
1785 for (
unsigned int y = firstOutputRow; y < firstOutputRow + numberOutputRows; ++y)
1787 for (
unsigned int x = 0u; x < lookupTable->
sizeX(); ++x)
1791 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(inputFrame, inputMask, inputWidth, inputHeight, inputFramePaddingElements, inputMaskPaddingElements, inputPosition, outputFrame, outputMask[x],
maskValue);
1793 outputFrame += tChannels;
1796 outputFrame += outputFramePaddingElements;
1797 outputMask += outputMaskStrideElements;
1801 template <
unsigned int tChannels>
1802 void PanoramaFrame::panoramaFrame2cameraFrame8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const unsigned int panoramaFrameTopLeftX,
const unsigned int panoramaFrameTopLeftY,
const SquareMatrix3* orientation, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstCameraRow,
const unsigned int numberCameraRows)
1804 static_assert(tChannels >= 1u,
"Invalid channel number!");
1806 ocean_assert(pinholeCamera !=
nullptr && pinholeCamera->
isValid());
1807 ocean_assert(orientation !=
nullptr && !orientation->
isSingular());
1808 ocean_assert(firstCameraRow + numberCameraRows <= pinholeCamera->height());
1810 ocean_assert(panoramaFrameTopLeftX + panoramaFrameWidth <= panoramaDimensionWidth);
1811 ocean_assert(panoramaFrameTopLeftY + panoramaFrameHeight <= panoramaDimensionHeight);
1814 const unsigned int cameraFrameStrideElements = pinholeCamera->
width() * tChannels + cameraFramePaddingElements;
1815 const unsigned int cameraMaskStrideElements = pinholeCamera->
width() + cameraMaskPaddingElements;
1817 for (
unsigned int y = firstCameraRow; y < firstCameraRow + numberCameraRows; ++y)
1819 uint8_t* cameraFrameRow = cameraFrame + y * cameraFrameStrideElements;
1820 uint8_t* cameraMaskRow = cameraMask + y * cameraMaskStrideElements;
1822 for (
unsigned int x = 0u; x < pinholeCamera->
width(); ++x)
1828 cameraPosition += fineAdjustment->
bilinearValue(cameraPosition.
x(), cameraPosition.
y());
1834 const Vector2 panoramaPosition(
angle2pixel(angle, panoramaDimensionWidth, panoramaDimensionHeight));
1838 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements, localPanoramaPosition, cameraFrameRow, cameraMaskRow[x],
maskValue);
1840 cameraFrameRow += tChannels;
1845 template <
unsigned int tChannels>
1846 void PanoramaFrame::panoramaFrame2cameraFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* panoramaFrame,
const uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const unsigned int panoramaFrameTopLeftX,
const unsigned int panoramaFrameTopLeftY,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight, uint8_t* cameraFrame, uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstCameraRow,
const unsigned int numberCameraRows)
1848 static_assert(tChannels >= 1u,
"Invalid channel number!");
1850 ocean_assert(lookupTable !=
nullptr && *lookupTable);
1851 ocean_assert(firstCameraRow + numberCameraRows <= lookupTable->sizeY());
1853 const unsigned int cameraFrameStrideElements = (
unsigned int)(lookupTable->
sizeX()) * tChannels + cameraFramePaddingElements;
1854 const unsigned int cameraMaskStrideElements = (
unsigned int)(lookupTable->
sizeX()) + cameraMaskPaddingElements;
1856 const Scalar panoramaDimensionWidth_2 =
Scalar(panoramaDimensionWidth) *
Scalar(0.5);
1858 Vector2 topLeft, topRight, bottomLeft, bottomRight;
1859 Scalar factorTopLeft, factorTopRight, factorBottomLeft, factorBottomRight;
1861 for (
unsigned int y = firstCameraRow; y < firstCameraRow + numberCameraRows; ++y)
1863 uint8_t* cameraFrameRow = cameraFrame + y * cameraFrameStrideElements;
1864 uint8_t* cameraMaskRow = cameraMask + y * cameraMaskStrideElements;
1866 for (
unsigned int x = 0u; x < lookupTable->
sizeX(); ++x)
1868 lookupTable->
bilinearValue(
Scalar(x),
Scalar(y), topLeft, topRight, bottomLeft, bottomRight, factorTopLeft, factorTopRight, factorBottomLeft, factorBottomRight);
1870 if (topRight.
x() > topLeft.
x() && topRight.
x() - topLeft.
x() > panoramaDimensionWidth_2)
1872 topRight.
x() -=
Scalar(panoramaDimensionWidth);
1874 else if (topRight.
x() < topLeft.
x() && topLeft.
x() - topRight.
x() > panoramaDimensionWidth_2)
1876 topRight.
x() +=
Scalar(panoramaDimensionWidth);
1879 if (bottomLeft.
x() > topLeft.
x() && bottomLeft.
x() - topLeft.
x() > panoramaDimensionWidth_2)
1881 bottomLeft.
x() -=
Scalar(panoramaDimensionWidth);
1883 else if (bottomLeft.
x() < topLeft.
x() && topLeft.
x() - bottomLeft.
x() > panoramaDimensionWidth_2)
1885 bottomLeft.
x() +=
Scalar(panoramaDimensionWidth);
1888 if (bottomRight.
x() > topLeft.
x() && bottomRight.
x() - topLeft.
x() > panoramaDimensionWidth_2)
1890 bottomRight.
x() -=
Scalar(panoramaDimensionWidth);
1892 else if (bottomRight.
x() < topLeft.
x() && topLeft.
x() - bottomRight.
x() > panoramaDimensionWidth_2)
1894 bottomRight.
x() +=
Scalar(panoramaDimensionWidth);
1897 Vector2 localPanoramaPosition = topLeft * factorTopLeft + topRight * factorTopRight + bottomLeft * factorBottomLeft + bottomRight * factorBottomRight;
1899 if (localPanoramaPosition.
y() >=
Scalar(panoramaDimensionHeight))
1901 localPanoramaPosition.
y() =
Scalar(panoramaDimensionHeight * 2u) - localPanoramaPosition.
y();
1903 if (localPanoramaPosition.
x() > panoramaDimensionWidth_2)
1905 localPanoramaPosition.
x() -= panoramaDimensionWidth_2;
1909 localPanoramaPosition.
x() += panoramaDimensionWidth_2;
1912 else if (localPanoramaPosition.
y() <
Scalar(0))
1914 localPanoramaPosition.
y() = -localPanoramaPosition.
y();
1916 if (localPanoramaPosition.
x() > panoramaDimensionWidth_2)
1918 localPanoramaPosition.
x() -= panoramaDimensionWidth_2;
1922 localPanoramaPosition.
x() += panoramaDimensionWidth_2;
1926 ocean_assert(localPanoramaPosition.
y() >=
Scalar(0) && localPanoramaPosition.
y() <=
Scalar(panoramaDimensionHeight));
1928 if (localPanoramaPosition.
x() >=
Scalar(panoramaDimensionWidth))
1930 localPanoramaPosition.
x() -=
Scalar(panoramaDimensionWidth);
1932 else if (localPanoramaPosition.
x() <
Scalar(0))
1934 localPanoramaPosition.
x() +=
Scalar(panoramaDimensionWidth);
1937 ocean_assert(localPanoramaPosition.
x() >=
Scalar(0) && localPanoramaPosition.
x() <
Scalar(panoramaDimensionWidth));
1939 localPanoramaPosition.
x() -=
Scalar(panoramaFrameTopLeftX);
1940 localPanoramaPosition.
y() -=
Scalar(panoramaFrameTopLeftY);
1944 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(panoramaFrame, panoramaMask, panoramaFrameWidth, panoramaFrameHeight, panoramaFramePaddingElements, panoramaMaskPaddingElements, localPanoramaPosition, cameraFrameRow, cameraMaskRow[x],
maskValue);
1946 cameraFrameRow += tChannels;
1951 template <
unsigned int tChannels>
1952 void PanoramaFrame::cameraFrame2panoramaFrame8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* cameraFrame,
const unsigned int cameraFramePaddingElements,
const SquareMatrix3* orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const int panoramaFrameTopLeftX,
const int panoramaFrameTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows)
1954 static_assert(tChannels >= 1u,
"Invalid channel number!");
1956 ocean_assert(pinholeCamera !=
nullptr && pinholeCamera->
isValid());
1957 ocean_assert(orientation !=
nullptr && !orientation->
isSingular());
1958 ocean_assert_and_suppress_unused(firstPanoramaRow + numberPanoramaRows <= panoramaFrameHeight, panoramaFrameHeight);
1962 ocean_assert(panoramaDimensionWidth != 0u && panoramaDimensionHeight != 0u);
1964 const Scalar invPanoramaDimensionHeight =
Scalar(1) /
Scalar(panoramaDimensionHeight);
1968 const unsigned int panoramaFrameStrideElements = panoramaFrameWidth * tChannels + panoramaFramePaddingElements;
1969 const unsigned int panoramaMaskStrideElements = panoramaFrameWidth + panoramaMaskPaddingElements;
1973 for (
unsigned int y = firstPanoramaRow; y < firstPanoramaRow + numberPanoramaRows; ++y)
1975 uint8_t* panoramaFrameRow = panoramaFrame + y * panoramaFrameStrideElements;
1976 uint8_t* panoramaMaskRow = panoramaMask + y * panoramaMaskStrideElements;
1978 for (
unsigned int x = 0u; x < panoramaFrameWidth; ++x)
1983 const Vector2 angle(
pixel2angle(panoramaPosition, invPanoramaDimensionWidth, invPanoramaDimensionHeight));
1987 if (roughPrincipalRay * ray <= 0)
1994 const Vector3 invRay(invOrientation * ray);
2006 if (cameraPosition_05.
x() >= 0 && cameraPosition_05.
x() <=
Scalar(pinholeCamera->
width()) && cameraPosition_05.
y() >= 0 && cameraPosition_05.
y() <=
Scalar(pinholeCamera->
height()))
2008 FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, PC_CENTER>(cameraFrame, pinholeCamera->
width(), pinholeCamera->
height(), cameraFramePaddingElements, cameraPosition_05, panoramaFrameRow);
2017 panoramaFrameRow += tChannels;
2023 template <
unsigned int tChannels>
2024 void PanoramaFrame::cameraFrame2panoramaFrameLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* cameraFrame,
const unsigned int cameraFrameWidth,
const unsigned int cameraFrameHeight,
const unsigned int cameraFramePaddingElements, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows)
2026 static_assert(tChannels >= 1u,
"Invalid channel number!");
2028 ocean_assert(lookupTable !=
nullptr && !lookupTable->
isEmpty());
2029 ocean_assert(firstPanoramaRow + numberPanoramaRows <= lookupTable->sizeY());
2031 const unsigned int panoramaFrameStrideElements = (
unsigned int)(lookupTable->
sizeX()) * tChannels + panoramaFramePaddingElements;
2032 const unsigned int panoramaMaskStrideElements = (
unsigned int)(lookupTable->
sizeX()) + panoramaMaskPaddingElements;
2034 for (
unsigned int y = firstPanoramaRow; y < firstPanoramaRow + numberPanoramaRows; ++y)
2036 uint8_t* panoramaFrameRow = panoramaFrame + y * panoramaFrameStrideElements;
2037 uint8_t* panoramaMaskRow = panoramaMask + y * panoramaMaskStrideElements;
2039 for (
unsigned int x = 0u; x < lookupTable->
sizeX(); ++x)
2044 if (cameraPosition_05.
x() >= 0 && cameraPosition_05.
x() <=
Scalar(cameraFrameWidth) && cameraPosition_05.
y() >= 0 && cameraPosition_05.
y() <=
Scalar(cameraFrameHeight))
2046 FrameInterpolatorBilinear::interpolatePixel8BitPerChannel<tChannels, PC_CENTER>(cameraFrame, cameraFrameWidth, cameraFrameHeight, cameraFramePaddingElements, cameraPosition_05, panoramaFrameRow);
2054 panoramaFrameRow += tChannels;
2060 template <
unsigned int tChannels>
2061 void PanoramaFrame::cameraFrame2panoramaFrameMask8BitPerChannelSubset(
const PinholeCamera* pinholeCamera,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements,
const SquareMatrix3* orientation,
const unsigned int panoramaDimensionWidth,
const unsigned int panoramaDimensionHeight,
const int panoramaFrameTopLeftX,
const int panoramaFrameTopLeftY, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFrameWidth,
const unsigned int panoramaFrameHeight,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const LookupTable* fineAdjustment,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows)
2063 static_assert(tChannels >= 1u,
"Invalid channel number!");
2065 ocean_assert(pinholeCamera && pinholeCamera->
isValid());
2066 ocean_assert(orientation && !orientation->
isSingular());
2067 ocean_assert_and_suppress_unused(firstPanoramaRow + numberPanoramaRows <= panoramaFrameHeight, panoramaFrameHeight);
2068 ocean_assert(fineAdjustment ==
nullptr || ((
unsigned int)fineAdjustment->
sizeX() == pinholeCamera->
width() && (
unsigned int)fineAdjustment->
sizeY() == pinholeCamera->
height()));
2072 ocean_assert(panoramaDimensionWidth != 0u && panoramaDimensionHeight != 0u);
2074 const Scalar invPanoramaDimensionHeight =
Scalar(1) /
Scalar(panoramaDimensionHeight);
2078 const unsigned int panoramaFrameStrideElements = panoramaFrameWidth * tChannels + panoramaFramePaddingElements;
2079 const unsigned int panoramaMaskStrideElements = panoramaFrameWidth + panoramaMaskPaddingElements;
2081 for (
unsigned int y = firstPanoramaRow; y < firstPanoramaRow + numberPanoramaRows; ++y)
2083 uint8_t* panoramaFrameRow = panoramaFrame + y * panoramaFrameStrideElements;
2084 uint8_t* panoramaMaskRow = panoramaMask + y * panoramaMaskStrideElements;
2086 for (
unsigned int x = 0u; x < panoramaFrameWidth; ++x)
2091 const Vector2 angle(
pixel2angle(panoramaPosition, invPanoramaDimensionWidth, invPanoramaDimensionHeight));
2093 ocean_assert(ray.
z() < 0);
2096 ocean_assert(rayOnPlane.
z() < 0);
2105 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(cameraFrame, cameraMask, pinholeCamera->
width(), pinholeCamera->
height(), cameraFramePaddingElements, cameraMaskPaddingElements, cameraPosition, panoramaFrameRow, panoramaMaskRow[x],
maskValue);
2107 panoramaFrameRow += tChannels;
2112 template <
unsigned int tChannels>
2113 void PanoramaFrame::cameraFrame2panoramaFrameMaskLookup8BitPerChannelSubset(
const LookupTable* lookupTable,
const uint8_t* cameraFrame,
const uint8_t* cameraMask,
const unsigned int cameraFrameWidth,
const unsigned int cameraFrameHeight,
const unsigned int cameraFramePaddingElements,
const unsigned int cameraMaskPaddingElements, uint8_t* panoramaFrame, uint8_t* panoramaMask,
const unsigned int panoramaFramePaddingElements,
const unsigned int panoramaMaskPaddingElements,
const uint8_t maskValue,
const unsigned int firstPanoramaRow,
const unsigned int numberPanoramaRows)
2115 static_assert(tChannels >= 1u,
"Invalid channel number!");
2117 ocean_assert(lookupTable !=
nullptr && !lookupTable->
isEmpty());
2118 ocean_assert(firstPanoramaRow + numberPanoramaRows <= lookupTable->sizeY());
2120 const unsigned int panoramaFrameStrideElements = (
unsigned int)(lookupTable->
sizeX()) * tChannels + panoramaFramePaddingElements;
2121 const unsigned int panoramaMaskStrideElements = (
unsigned int)(lookupTable->
sizeX()) + panoramaMaskPaddingElements;
2123 for (
unsigned int y = firstPanoramaRow; y < firstPanoramaRow + numberPanoramaRows; ++y)
2125 uint8_t* panoramaFrameRow = panoramaFrame + y * panoramaFrameStrideElements;
2126 uint8_t* panoramaMaskRow = panoramaMask + y * panoramaMaskStrideElements;
2128 for (
unsigned int x = 0u; x < lookupTable->
sizeX(); ++x)
2132 AdvancedFrameInterpolatorBilinear::interpolatePixelWithMask8BitPerChannel<tChannels, PC_TOP_LEFT>(cameraFrame, cameraMask, cameraFrameWidth, cameraFrameHeight, cameraFramePaddingElements, cameraMaskPaddingElements, cameraPosition, panoramaFrameRow, panoramaMaskRow[x],
maskValue);
2134 panoramaFrameRow += tChannels;
This class implements a panorama frame with spherical projection model.
Definition: PanoramaFrame.h:47
virtual void clear()
Clears the panorama frame and allows to set a new first camera frame.
UpdateMode updateMode() const
Returns the update mode of this panorama frame.
Definition: PanoramaFrame.h:1154
static void cameraFrame2panoramaFrame8BitPerChannelSubset(const PinholeCamera *pinholeCamera, const uint8_t *cameraFrame, const unsigned int cameraFramePaddingElements, const SquareMatrix3 *orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const int panoramaFrameTopLeftX, const int panoramaFrameTopLeftY, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue, const LookupTable *fineAdjustment, const unsigned int firstPanoramaRow, const unsigned int numberPanoramaRows)
Copies (interpolates) the entire area of an 8 bit per data channel camera frame with specified camera...
Definition: PanoramaFrame.h:1952
PanoramaFrame(const Frame &frame, const Frame &mask, const uint8_t maskValue, const UpdateMode updateMode, Worker *worker=nullptr)
Creates a new panorama frame instance by an already existing (entire) panorama frame.
static Scalar approximateIntersectionArea(const PinholeCamera &pinholeCamera0, const SquareMatrix3 &orientation0, const PinholeCamera &pinholeCamera1, const SquareMatrix3 &orientation1, Scalar *intersectionRatio=nullptr)
Approximate the area of the intersection of two frames.
PixelPosition frameTopLeft_
The top left position of the sub-frame of the entire panorama frame.
Definition: PanoramaFrame.h:1118
static void mergeSetNew8BitPerChannelSubset(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int panoramaSubFramePaddingElements, const unsigned int panoramaSubMaskPaddingElements, const unsigned int subTopLeftX, const unsigned int subTopLeftY, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaTopLeftX, const unsigned int panoramaTopLeftY, const uint8_t maskValue, const unsigned int firstSubRow, const unsigned int numberSubRows)
Merges a subset of a given panorama sub frame with the already existing panorama frame by setting onl...
Scalar invertedDimensionHeight_
The inverse of the maximal height of the panorama frame, panoramaInvDimensionHeight = (1 / panoramaDi...
Definition: PanoramaFrame.h:1115
Vector2 panoramaPixel2cameraPixel(const PinholeCamera &pinholeCamera, const SquareMatrix3 &iOrientation, const Vector2 &panoramaPixel) const
Converts a given pixel position defined in the entire (maximal possible) panorama frame into the pixe...
Definition: PanoramaFrame.h:1215
bool reset(const PixelPosition &topLeft, const Frame &frame, const Frame &mask, Worker *worker=nullptr)
Resets the panorama frame of this object by one new panorama sub-frame.
static Vector3 angle2rayStrict(const Vector2 &angle)
Converts an angle in the panorama frame to a unit ray starting at the panorama frame's center.
Definition: PanoramaFrame.h:1372
static void cameraFrame2cameraFrameLookupTable(const PinholeCamera &inputCamera, const SquareMatrix3 &world_R_input, const PinholeCamera &outputCamera, const SquareMatrix3 &world_R_output, LookupTable &input_LT_output)
Creates a 2D lookup table allowing to interpolate pixel locations defined in one camera frame to pixe...
static void mergeAverageGlobal8BitPerChannelSubset(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int panoramaSubFramePaddingElements, const unsigned int panoramaSubMaskPaddingElements, const unsigned int subTopLeftX, const unsigned int subTopLeftY, uint32_t *panoramaNominatorFrame, uint32_t *panoramaDenominatorFrame, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaTopLeftX, const unsigned int panoramaTopLeftY, const uint8_t maskValue, const unsigned int firstSubRow, const unsigned int numberSubRows)
Merges a subset of a given panorama sub frame with the already existing panorama frame by averaging t...
static Vector2 pixel2angleStrict(const Vector2 &position, const Scalar invPanoramaDimensionWidth, const Scalar invPanoramaDimensionHeight)
Converts a pixel position in the entire (maximal possible) panorama frame to the corresponding angle ...
Definition: PanoramaFrame.h:1290
static void cameraFrame2cameraFrameMaskLookup8BitPerChannelSubset(const LookupTable *lookupTable, const uint8_t *inputFrame, const uint8_t *inputMask, const unsigned int inputWidth, const unsigned int inputHeight, const unsigned int inputFramePaddingElements, const unsigned int inputMaskPaddingElements, uint8_t *outputFrame, uint8_t *outputMask, const unsigned int outputFramePaddingElements, const unsigned int outputMaskPaddingElements, const uint8_t maskValue, const unsigned int firstOutputRow, const unsigned int numberOutputRows)
Converts a subset of a given input camera frame with 8 bit per channel captured with a given orientat...
Definition: PanoramaFrame.h:1771
Box2 panoramaSubFrameBoundingBox(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation) const
Determines the bounding box for a camera frame with given orientation in the panorama frame.
static Vector2 ray2angleStrict(const Vector3 &ray)
Converts a unit ray starting at the panorama frame's center to the corresponding angle.
Definition: PanoramaFrame.h:1344
const Frame & frame() const
Returns the current panorama sub-frame (not the maximal possible panorama frame).
Definition: PanoramaFrame.h:1139
static bool panoramaFrame2cameraFrame(const PinholeCamera &pinholeCamera, const Frame &panoramaFrame, const Frame &panoramaMask, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPosition &panoramaFrameTopLeft, const SquareMatrix3 &orientation, Frame &cameraFrame, Frame &cameraMask, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) a section from the entire panorama frame to a camera frame with specified camer...
Frame frame_
The actual panorama frame, may be a sub-frame of the entire panorama frame.
Definition: PanoramaFrame.h:1094
static void cameraFrame2panoramaFrameMaskLookup8BitPerChannelSubset(const LookupTable *lookupTable, const uint8_t *cameraFrame, const uint8_t *cameraMask, const unsigned int cameraFrameWidth, const unsigned int cameraFrameHeight, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue, const unsigned int firstPanoramaRow, const unsigned int numberPanoramaRows)
Copies (interpolates) a subset of an 8 bit per data channel camera frame (specified by a mask) with s...
Definition: PanoramaFrame.h:2113
static void cameraFrame2panoramaFrameLookupTable(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPositionI &panoramaFrameTopLeft, LookupTable &lookupTable, const LookupTable *fineAdjustment)
Creates a 2D lookup table allowing to interpolate positions defined in the entire panorama frame to p...
virtual ~PanoramaFrame()=default
Default destructor.
static Vector2 angle2pixelStrict(const Vector2 &angle, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight)
Converts an angle in the entire (maximal possible) panorama frame to the corresponding pixel position...
Definition: PanoramaFrame.h:1265
Vector2 cameraPixel2panoramaPixel(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, const Vector2 &cameraPixel, const Vector2 &referenceAngle) const
Converts a given pixel position defined in the current camera frame into the pixel position defined i...
Definition: PanoramaFrame.h:1185
uint8_t maskValue_
The mask value defining the mask value of valid pixels.
Definition: PanoramaFrame.h:1121
static Vectors2 generateFrameContour(const unsigned int width, const unsigned int height, const unsigned int count)
Creates are contour of (the outside of) a camera frame.
unsigned int dimensionWidth_
The maximal width of the panorama frame representing horizontal 360 degrees, in pixel.
Definition: PanoramaFrame.h:1106
static void cameraFrame2panoramaFrameLookup8BitPerChannelSubset(const LookupTable *lookupTable, const uint8_t *cameraFrame, const unsigned int cameraFrameWidth, const unsigned int cameraFrameHeight, const unsigned int cameraFramePaddingElements, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue, const unsigned int firstPanoramaRow, const unsigned int numberPanoramaRows)
Copies (interpolates) the entire area of an 8 bit per data channel camera frame with specified camera...
Definition: PanoramaFrame.h:2024
static void panoramaFrame2cameraFrame8BitPerChannelSubset(const PinholeCamera *pinholeCamera, const uint8_t *panoramaFrame, const uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const unsigned int panoramaFrameTopLeftX, const unsigned int panoramaFrameTopLeftY, const SquareMatrix3 *orientation, uint8_t *cameraFrame, uint8_t *cameraMask, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, const uint8_t maskValue, const LookupTable *fineAdjustment, const unsigned int firstCameraRow, const unsigned int numberCameraRows)
Copies (interpolates) a subset of a section from the entire panorama frame with 8 bit per data channe...
Definition: PanoramaFrame.h:1802
static void mergeAverageGlobal8BitPerChannel(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int panoramaSubFramePaddingElements, const unsigned panoramaSubMaskPaddingElements, const PixelPosition &subTopLeft, uint32_t *panoramaNominatorFrame, uint32_t *panoramaDenominatorFrame, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const PixelPosition &panoramaTopLeft, const uint8_t maskValue, Worker *worker=nullptr)
Merges a given panorama sub frame with the already existing panorama frame by averaging the all pixel...
static bool haveIntersectionByRays(const PinholeCamera &pinholeCamera0, const SquareMatrix3 &orientation0, const PinholeCamera &pinholeCamera1, const SquareMatrix3 &orientation1, const Scalar borderFactor=Scalar(0.1), const unsigned int minimalIntersections=2u)
Checks whether two camera frames have a guaranteed intersection.
Frame nominatorFrame_
The optional nominator frame of the panorama frame, necessary if UM_AVERAGE_GLOBAL is set as update m...
Definition: PanoramaFrame.h:1100
bool reset(const PinholeCamera &pinholeCamera, const Frame &frame, const SquareMatrix3 &orientation, const unsigned int approximationBinSize=20u, Worker *worker=nullptr)
Resets the panorama frame of this object by one new single camera frame.
static bool cameraFrame2panoramaFrame(const PinholeCamera &pinholeCamera, const Frame &cameraFrame, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPositionI &panoramaFrameTopLeft, Frame &panoramaFrame, Frame &panoramaMask, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) the entire area of a camera frame with specified camera orientation to a sectio...
static void panoramaFrame2cameraFrameLookupTable(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPosition &panoramaFrameTopLeft, LookupTable &lookupTable, const LookupTable *fineAdjustment)
Creates a 2D lookup table allowing to interpolate positions defined in the camera frame to positions ...
UpdateMode updateMode_
The update mode of this panorama frame.
Definition: PanoramaFrame.h:1124
static bool cameraFrame2panoramaFrame(const PinholeCamera &pinholeCamera, const Frame &cameraFrame, const Frame &cameraMask, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPositionI &panoramaFrameTopLeft, Frame &panoramaFrame, Frame &panoramaMask, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) the a subset of a camera frame (specified by a mask) with specified camera orie...
bool addFrame(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, const Frame &frame, const Frame &mask, const unsigned int approximationBinSize=20u, Worker *worker=nullptr)
Adds a new camera frame to the panorama frame for which the orientation is known.
static Vector2 cameraPixel2cameraPixel(const PinholeCamera &inputCamera, const SquareMatrix3 &inputOrientation, const Vector2 &inputPosition, const PinholeCamera &outputCamera, const SquareMatrix3 &outputOrientation)
Converts a camera pixel position defined in one frame into a camera pixel position defined in another...
static void mergeAverageLocal8BitPerChannel(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int panoramaSubFramePaddingElements, const unsigned panoramaSubMaskPaddingElements, const PixelPosition &subTopLeft, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const PixelPosition &panoramaTopLeft, const uint8_t maskValue, Worker *worker=nullptr)
Merges a given panorama sub frame with the already existing panorama frame by averaging the current p...
Definition: PanoramaFrame.h:1609
uint8_t maskValue() const
Returns the mask value defining the 8 bit pixel value of valid pixels.
Definition: PanoramaFrame.h:1149
LookupCorner2< Vector2 > LookupTable
Definition of a lookup table for 2D vectors.
Definition: PanoramaFrame.h:72
void resize(const PixelPosition &topLeft, const unsigned int width, const unsigned int height)
Resizes the internal panorama sub-frame.
unsigned int dimensionHeight_
The maximal height of the panorama frame representing vertical 180 degrees, in pixel.
Definition: PanoramaFrame.h:1109
PanoramaFrame(Frame &&frame, Frame &&mask, const uint8_t maskValue, const UpdateMode updateMode, Worker *worker=nullptr)
Creates a new panorama frame instance by an already existing (entire) panorama frame.
static void cameraFrame2panoramaFrameMask8BitPerChannel(const PinholeCamera &pinholeCamera, const uint8_t *cameraFrame, const uint8_t *cameraMask, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPositionI &panoramaFrameTopLeft, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) a subset of an 8 bit per data channel camera frame (specified by a mask) with s...
Definition: PanoramaFrame.h:1536
static void cameraFrame2panoramaFrame8BitPerChannel(const PinholeCamera &pinholeCamera, const uint8_t *cameraFrame, const unsigned int cameraFramePaddingElements, const SquareMatrix3 &orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPositionI &panoramaFrameTopLeft, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) the entire area of an 8 bit per data channel camera frame with specified camera...
Definition: PanoramaFrame.h:1494
unsigned int dimensionHeight() const
Returns the maximal possible height of the entire panorama frame representing vertical 180 degrees,...
Definition: PanoramaFrame.h:1169
static void cameraFrame2cameraFrame8BitPerChannelSubset(const PinholeCamera *inputCamera, const SquareMatrix3 *inputOrientation, const uint8_t *inputFrame, const unsigned int inputFramePaddingElements, const PinholeCamera *outputCamera, const SquareMatrix3 *outputOrientation, uint8_t *outputFrame, uint8_t *outputMask, const unsigned int outputFramePaddingElements, const unsigned int outputMaskPaddingElements, const uint8_t maskValue, const unsigned int firstOutputRow, const unsigned int numberOutputRows)
Converts a subset of a given input camera frame with 8 bit per channel captured with a given orientat...
Definition: PanoramaFrame.h:1639
Vector2 pixel2angle(const Vector2 &position) const
Converts the pixel position in the entire (maximal possible) panorama frame to the corresponding angl...
Definition: PanoramaFrame.h:1246
static void panoramaFrame2cameraFrame8BitPerChannel(const PinholeCamera &pinholeCamera, const uint8_t *panoramaFrame, const uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const PixelPosition &panoramaFrameTopLeft, const SquareMatrix3 &orientation, uint8_t *cameraFrame, uint8_t *cameraMask, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, const uint8_t maskValue=0xFFu, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) a section from the entire panorama frame with 8 bit per data channel to a camer...
Definition: PanoramaFrame.h:1454
const PixelPosition & frameTopLeft() const
Returns the top left position of the current panorama sub-frame.
Definition: PanoramaFrame.h:1159
static Vector2 ray2angle(const Vector3 &ray, const Vector2 &referenceAngle)
Converts a unit ray starting at the panorama frame's center to the corresponding angle.
Definition: PanoramaFrame.h:1307
UpdateMode
Definition of individual frame update modes.
Definition: PanoramaFrame.h:54
@ UM_SET_NEW
Sets only pixels in the panorama frame which haven't been set before.
Definition: PanoramaFrame.h:58
@ UM_SET_ALL
Overwrites all pixels in the panorama frame.
Definition: PanoramaFrame.h:60
@ UM_INVALID
Invalid update mode.
Definition: PanoramaFrame.h:56
@ UM_AVERAGE_LOCAL
Updates all pixels in the panorama frame by averaging the current pixel value with the new pixel valu...
Definition: PanoramaFrame.h:62
const Frame & mask() const
Returns the mask of the current panorama frame.
Definition: PanoramaFrame.h:1144
static void mergeSetAll8BitPerChannelSubset(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int panoramaSubFramePaddingElements, const unsigned int panoramaSubMaskPaddingElements, const unsigned int subTopLeftX, const unsigned int subTopLeftY, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaTopLeftX, const unsigned int panoramaTopLeftY, const uint8_t maskValue, const unsigned int firstSubRow, const unsigned int numberSubRows)
Merges a subset of a given panorama sub frame with the already existing panorama frame by setting all...
Frame mask_
The mask of the panorama frame defining valid and invalid pixels.
Definition: PanoramaFrame.h:1097
Vector2 cameraPixel2panoramaPixelStrict(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, const Vector2 &cameraPixel) const
Converts a given pixel position defined in the current camera frame into the pixel position defined i...
Definition: PanoramaFrame.h:1200
static bool haveIntersectionByInnerFov(const PinholeCamera &pinholeCamera0, const SquareMatrix3 &orientation0, const PinholeCamera &pinholeCamera1, const SquareMatrix3 &orientation1, Scalar *overlappingPercent=nullptr)
Checks whether two camera frames have a guaranteed intersection.
Scalar invertedDimensionWidth_
The inverse of the maximal width of the panorama frame, panoramaInvDimensionWidth = (1 / panoramaDime...
Definition: PanoramaFrame.h:1112
static void mergeAverageLocal8BitPerChannelSubset(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int panoramaSubFramePaddingElements, const unsigned int panoramaSubMaskPaddingElements, const unsigned int subTopLeftX, const unsigned int subTopLeftY, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaTopLeftX, const unsigned int panoramaTopLeftY, const uint8_t maskValue, const unsigned int firstSubRow, const unsigned int numberSubRows)
Merges a subset of a given panorama sub frame with the already existing panorama frame by averaging t...
static bool cameraFrame2cameraFrame(const PinholeCamera &inputCamera, const SquareMatrix3 &inputOrientation, const Frame &inputFrame, const Frame &inputMask, const PinholeCamera &outputCamera, const SquareMatrix3 &outputOrientation, Frame &outputFrame, Frame &outputMask, const uint8_t maskValue, const unsigned int approximationBinSize, Worker *worker)
Converts a given input camera frame captured with a given orientation into a corresponding camera fra...
static void panoramaFrame2cameraFrameLookup8BitPerChannelSubset(const LookupTable *lookupTable, const uint8_t *panoramaFrame, const uint8_t *panoramaMask, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const unsigned int panoramaFrameTopLeftX, const unsigned int panoramaFrameTopLeftY, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, uint8_t *cameraFrame, uint8_t *cameraMask, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, const uint8_t maskValue, const unsigned int firstCameraRow, const unsigned int numberCameraRows)
Copies (interpolates) a subset of a section from the entire panorama frame with 8 bit per data channe...
Definition: PanoramaFrame.h:1846
bool extractFrame(const PinholeCamera &pinholeCamera, const SquareMatrix3 &orientation, Frame &frame, Frame &mask, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr) const
Extracts a camera frame from the panorama frame.
Definition: PanoramaFrame.h:1174
static Vector3 angle2ray(const Vector2 &angle)
Converts an angle in the panorama frame to a unit ray starting at the panorama frame's center.
Definition: PanoramaFrame.h:1362
unsigned int dimensionWidth() const
Returns the maximal possible width of the entire panorama frame representing horizontal 360 degrees,...
Definition: PanoramaFrame.h:1164
Frame denominatorFrame_
The optional denominator frame of the panorama frame, necessary if UM_AVERAGE_GLOBAL is set as update...
Definition: PanoramaFrame.h:1103
PanoramaFrame()=default
Creates an invalid panorama frame instance.
static void cameraFrame2cameraFrameLookup8BitPerChannelSubset(const LookupTable *lookupTable, const uint8_t *inputFrame, const unsigned int inputWidth, const unsigned int inputHeight, const unsigned int inputFramePaddingElements, uint8_t *outputFrame, uint8_t *outputMask, const unsigned int outputFramePaddingElements, const unsigned int outputMaskPaddingElements, const uint8_t maskValue, const unsigned int firstOutputRow, const unsigned int numberOutputRows)
Converts a subset of a given input camera frame with 8 bit per channel captured with a given orientat...
Definition: PanoramaFrame.h:1690
bool isValid() const
Returns whether this panorama frame holds valid configuration parameters and thus can be used.
Definition: PanoramaFrame.h:1231
bool update(const PinholeCamera &pinholeCamera, const Frame &frame, const Frame &mask, const SquareMatrix3 &orientation, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Updates the panorama frame data with a new camera frame.
static void mergeSetAll8BitPerChannel(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int panoramaSubFramePaddingElements, const unsigned panoramaSubMaskPaddingElements, const PixelPosition &subTopLeft, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const PixelPosition &panoramaTopLeft, const uint8_t maskValue, Worker *worker=nullptr)
Merges a given panorama sub frame with the already existing panorama frame by setting all valid pixel...
Definition: PanoramaFrame.h:1579
static void mergeSetNew8BitPerChannel(const uint8_t *panoramaSubFrame, const uint8_t *panoramaSubMask, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int panoramaSubFramePaddingElements, const unsigned panoramaSubMaskPaddingElements, const PixelPosition &subTopLeft, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaWidth, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const PixelPosition &panoramaTopLeft, const uint8_t maskValue, Worker *worker=nullptr)
Merges a given panorama sub frame with the already existing panorama frame by setting only pixels whi...
Definition: PanoramaFrame.h:1594
static void cameraFrame2cameraFrameMask8BitPerChannelSubset(const PinholeCamera *inputCamera, const SquareMatrix3 *inputOrientation, const uint8_t *inputFrame, const uint8_t *inputMask, const unsigned int inputFramePaddingElements, const unsigned int inputMaskPaddingElements, const PinholeCamera *outputCamera, const SquareMatrix3 *outputOrientation, uint8_t *outputFrame, uint8_t *outputMask, const unsigned int outputFramePaddingElements, const unsigned int outputMaskPaddingElements, const uint8_t maskValue, const unsigned int firstOutputRow, const unsigned int numberOutputRows)
Converts a subset of a given input camera frame with 8 bit per channel captured with a given orientat...
Definition: PanoramaFrame.h:1730
bool cameraFrame2panoramaSubFrame(const PinholeCamera &pinholeCamera, const Frame &frame, const Frame &mask, const SquareMatrix3 &orientation, Frame &panoramaSubFrame, Frame &panoramaSubMask, PixelPositionI &subFrameTopLeft, const unsigned int approximationBinSize=20u, Worker *worker=nullptr, const LookupTable *fineAdjustment=nullptr)
Copies (interpolates) the entire area of a camera frame with specified camera orientation to a sub-fr...
bool setFrame(const PixelPosition &topLeft, const Frame &frame, const Frame &mask=Frame(), Worker *worker=nullptr)
Sets or resets the panorama sub-frame (not the maximal possible panorama frame).
bool merge(const Frame &panoramaSubFrame, const Frame &panoramaSubMask, const PixelPosition &subTopLeft, Worker *worker=nullptr)
Merges a given panorama sub-frame with given top left start position with the panorama frame of this ...
Vector2 angle2pixel(const Vector2 &angle) const
Converts an angle in the entire (maximal possible) panorama frame to the corresponding pixel position...
Definition: PanoramaFrame.h:1241
static void cameraFrame2panoramaFrameMask8BitPerChannelSubset(const PinholeCamera *pinholeCamera, const uint8_t *cameraFrame, const uint8_t *cameraMask, const unsigned int cameraFramePaddingElements, const unsigned int cameraMaskPaddingElements, const SquareMatrix3 *orientation, const unsigned int panoramaDimensionWidth, const unsigned int panoramaDimensionHeight, const int panoramaFrameTopLeftX, const int panoramaFrameTopLeftY, uint8_t *panoramaFrame, uint8_t *panoramaMask, const unsigned int panoramaFrameWidth, const unsigned int panoramaFrameHeight, const unsigned int panoramaFramePaddingElements, const unsigned int panoramaMaskPaddingElements, const uint8_t maskValue, const LookupTable *fineAdjustment, const unsigned int firstPanoramaRow, const unsigned int numberPanoramaRows)
Copies (interpolates) a subset of an 8 bit per data channel camera frame (specified by a mask) with s...
Definition: PanoramaFrame.h:2061
static void cameraFrame2cameraFrame8BitPerChannel(const PinholeCamera &inputCamera, const SquareMatrix3 &inputOrientation, const uint8_t *inputFrame, const uint8_t *inputMask, const unsigned int inputFramePaddingElements, const unsigned int inputMaskPaddingElements, const PinholeCamera &outputCamera, const SquareMatrix3 &outputOrientation, uint8_t *outputFrame, uint8_t *outputMask, const unsigned int outputFramePaddingElements, const unsigned int outputMaskPaddingElements, const uint8_t maskValue, const unsigned int approximationBinSize, Worker *worker)
Converts a given input camera frame with 8 bit per channel captured with a given orientation into a c...
Definition: PanoramaFrame.h:1386
T y() const
Returns the vertical coordinate position of this object.
Definition: PixelPosition.h:470
T x() const
Returns the horizontal coordinate position of this object.
Definition: PixelPosition.h:458
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
static SquareMatrixT3< U > flipMatrix3()
Returns the 3x3 transformation matrix flipping a transformation around the x-axis by 180 deg.
Definition: Camera.h:497
This class implements Ocean's image class.
Definition: Frame.h:1792
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4448
size_t sizeY() const
Returns the vertical dimension of this lookup object.
Definition: Lookup2.h:947
size_t sizeX() const
Returns the horizontal dimension of this lookup object.
Definition: Lookup2.h:941
bool isEmpty() const
Returns whether this lookup object does not hold any lookup bin.
Definition: Lookup2.h:1009
This class implements a 2D lookup object with values at the bins' corners defining the individual loo...
Definition: Lookup2.h:636
T clampedBilinearValue(const TScalar x, const TScalar y) const
Applies a lookup for a specific position in this lookup object while the position is clamped to match...
Definition: Lookup2.h:2112
T bilinearValue(const TScalar x, const TScalar y) const
Applies a lookup for a specific position in this lookup object.
Definition: Lookup2.h:1815
static constexpr T pi2()
Returns 2*PI which is equivalent to 360 degree.
Definition: Numeric.h:932
static constexpr T pi_2()
Returns PI/2 which is equivalent to 90 degree.
Definition: Numeric.h:938
static T atan2(const T y, const T x)
Returns the arctangent of a given value in radian.
Definition: Numeric.h:1632
static T sin(const T value)
Returns the sine of a given value.
Definition: Numeric.h:1568
static T abs(const T value)
Returns the absolute value of a given value.
Definition: Numeric.h:1220
static constexpr T pi()
Returns PI which is equivalent to 180 degree.
Definition: Numeric.h:926
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition: Numeric.h:2386
static constexpr bool isEqualEps(const T value)
Returns whether a value is smaller than or equal to a small epsilon.
Definition: Numeric.h:2087
static T cos(const T value)
Returns the cosine of a given value.
Definition: Numeric.h:1584
static T asin(const T value)
Returns the arcsine of a given value.
Definition: Numeric.h:2887
unsigned int width() const
Returns the width of the camera image.
Definition: PinholeCamera.h:1300
T principalPointX() const
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition: PinholeCamera.h:1318
const SquareMatrixT3< T > & invertedIntrinsic() const
Returns the inverted intrinsic camera matrix.
Definition: PinholeCamera.h:1263
VectorT2< T > distort(const VectorT2< T > &undistorted) const
Returns the distorted position of a given undistorted position defined in pixel coordinates.
Definition: PinholeCamera.h:1418
VectorT2< T > undistort(const VectorT2< T > &distorted, const unsigned int iterations=10u, const T zoom=T(1)) const
Returns the undistorted position of a given distorted position defined in pixel coordinates.
Definition: PinholeCamera.h:1373
bool isValid() const
Returns whether this camera is valid.
Definition: PinholeCamera.h:1572
const SquareMatrixT3< T > & intrinsic() const
Returns the intrinsic camera matrix.
Definition: PinholeCamera.h:1257
unsigned int height() const
Returns the height of the camera image.
Definition: PinholeCamera.h:1306
VectorT2< T > normalizedImagePoint2imagePoint(const VectorT2< T > &normalizedImagePoint, const bool distortImagePoint) const
Calculates the image point corresponding to a given normalized image point.
Definition: PinholeCamera.h:1602
T principalPointY() const
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition: PinholeCamera.h:1324
VectorT3< T > vector(const VectorT2< T > &position, const bool makeUnitVector=true) const
Returns a normalized vector (with length 1) starting at the camera's center and intersecting a given ...
Definition: PinholeCamera.h:2171
SquareMatrixT3< T > inverted() const
Returns the inverted matrix of this matrix.
Definition: SquareMatrix3.h:1176
bool isSingular() const
Returns whether this matrix is singular (and thus cannot be inverted).
Definition: SquareMatrix3.h:1341
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
const T & x() const noexcept
Returns the x value.
Definition: Vector3.h:800
const T & z() const noexcept
Returns the z value.
Definition: Vector3.h:824
T length() const
Returns the length of the vector.
Definition: Vector3.h:664
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
PixelPositionT< unsigned int > PixelPosition
Definition of the default PixelPosition object with a data type allowing only positive coordinate val...
Definition: PixelPosition.h:27
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition: Vector2.h:64
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15