8 #ifndef META_OCEAN_TRACKING_UTILITIES_H
9 #define META_OCEAN_TRACKING_UTILITIES_H
81 static inline void paintLine(
Frame& frame,
const Vector2& startPosition,
const Vector2& stopPosition,
const uint8_t* color =
nullptr,
const bool subPixel =
true);
95 static inline void paintLines(
Frame& frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const size_t numberLines,
const uint8_t* color =
nullptr,
Worker* worker =
nullptr,
const bool subPixel =
true,
const Vector2& offsetStartPositions =
Vector2(0, 0),
const Vector2& offsetStopPositions =
Vector2(0, 0));
107 template <
unsigned int tSize>
108 static inline void paintLines(
Frame& frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const size_t numberLines,
const uint8_t* color =
nullptr,
Worker* worker =
nullptr);
122 template <
unsigned int tSizeForeground,
unsigned int tSizeBackground>
123 static inline void paintLines(
Frame& frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const size_t numberLines,
const uint8_t* colorForeground =
nullptr,
const uint8_t* colorBackground =
nullptr,
Worker* worker =
nullptr);
135 template <
unsigned int tSize>
136 static inline void paintPaths(
Frame& frame,
const Vectors2* paths,
const size_t size,
const uint8_t* color =
nullptr,
Worker* worker =
nullptr);
151 template <
unsigned int tSize>
152 static inline void paintPaths(
Frame& frame,
const Vectors2* paths,
const size_t size,
const uint8_t* color0,
const uint8_t* color1,
const Scalar* factors,
Worker* worker =
nullptr);
161 template <
unsigned int tSize = 1u>
162 static void paintTriangle(
Frame& frame,
const Triangle2& triangle,
const uint8_t* color =
nullptr);
172 template <
unsigned int tSize = 1u>
173 static void paintTriangles(
Frame& frame,
const Triangles2& triangles,
const uint8_t* color =
nullptr,
Worker* worker =
nullptr);
184 template <
unsigned int tPo
intSize>
185 static inline void paintImagePoints(
Frame& frame,
const Vector2* imagePoints,
const size_t size,
const uint8_t* color,
Worker* worker =
nullptr);
198 template <
unsigned int tPo
intSize>
199 static inline void paintObjectPoints(
Frame& frame,
const AnyCamera& anyCamera,
const HomogenousMatrix4& world_T_camera,
const Vector3* objectPoints,
const size_t size,
const uint8_t* color,
Worker* worker =
nullptr);
225 template <
unsigned int tChannels>
226 static void paintFeaturePoint8BitPerChannel(uint8_t* frame,
const unsigned int width,
const unsigned int height,
const Vector2& position,
const Scalar radius,
const Scalar orientation,
const uint8_t* color,
const uint8_t* shadowColor,
const unsigned int framePaddingElements = 0u);
258 template <
unsigned int tChannels>
259 static inline void paintFeaturePoints8BitPerChannel(uint8_t* frame,
const unsigned int width,
const unsigned int height,
const Vector2* positions,
const Scalar* radii,
const Scalar* orientations,
const size_t size,
const uint8_t* color,
const uint8_t* shadowColor,
const Vector2& explicitOffset,
const unsigned int framePaddingElements,
Worker* worker =
nullptr);
283 template <
unsigned int tObjectPo
intSize,
unsigned int tImagePo
intSize>
284 static inline void paintCorrespondences(
Frame& frame,
const AnyCamera& camera,
const HomogenousMatrix4& model_T_camera,
const Vector3* objectPoints,
const Vector2* imagePoints,
const size_t correspondences,
const Scalar maxSqrError,
const uint8_t* colorValidObjectPoints,
const uint8_t* colorValidImagePoints,
const uint8_t* colorInvalidObjectPoints,
const uint8_t* colorInvalidImagePoints,
const bool drawObjectPoints =
true,
const bool drawImagePoints =
true,
const bool drawConnections =
true,
Worker* worker =
nullptr);
347 static bool paintCorrespondencesHomography(
const Frame& frame0,
const Frame& frame1,
const SquareMatrix3& points1_H_points0,
const Vector2* points0,
const Vector2* points1,
const size_t numberPoints,
const bool fullCoverage,
Frame& result,
const uint8_t* foregroundColor =
nullptr,
const uint8_t* backgroundColor =
nullptr,
const uint8_t* startColor =
nullptr,
Worker* worker =
nullptr);
366 static bool paintCorrespondencesOrientations(
const PinholeCamera& pinholeCamera,
const Frame& frame0,
const Frame& frame1,
const SquareMatrix3& orientation0,
const SquareMatrix3& orientation1,
const Vector2* points0,
const Vector2* points1,
const size_t numberPoints,
Frame& result,
const uint8_t* foregroundColor =
nullptr,
const uint8_t* backgroundColor =
nullptr,
const uint8_t* startColor =
nullptr,
Worker* worker =
nullptr);
377 static void paintPoints(
Frame& frame,
const Vector2* imagePoints,
const size_t number,
const unsigned int radius,
const uint8_t* colorInner =
nullptr,
const uint8_t* colorOuter =
nullptr);
394 static inline void paintPoints(
Frame& frame,
const HomogenousMatrix4& world_T_camera,
const PinholeCamera& pinholeCamera,
const Vector3* objectPoints,
const size_t numberObjectPoints,
const Vector2* imagePoints,
const size_t numberImagePoints,
const bool distortProjectedObjectPoints,
const unsigned int radiusObjectPoints,
const unsigned int radiusImagePoints,
const uint8_t* colorObjectPoints =
nullptr,
const uint8_t* colorImagePoints =
nullptr);
411 static void paintPointsIF(
Frame& frame,
const HomogenousMatrix4& flippedCamera_T_world,
const PinholeCamera& pinholeCamera,
const Vector3* objectPoints,
const size_t numberObjectPoints,
const Vector2* imagePoints,
const size_t numberImagePoints,
const bool distortProjectedObjectPoints,
const unsigned int radiusObjectPoints,
const unsigned int radiusImagePoints,
const uint8_t* colorObjectPoints =
nullptr,
const uint8_t* colorImagePoints =
nullptr);
464 template <
unsigned int tSize = 1u>
478 template <
unsigned int tSize = 1u>
479 static void paintTrianglesIF(
Frame& frame,
const HomogenousMatrix4& flippedCamera_T_world,
const AnyCamera& anyCamera,
const Triangle3* triangles,
const size_t numberTriangles,
const uint8_t* color =
nullptr,
Worker* worker =
nullptr);
546 static inline void paintQuads(
Frame& frame,
const HomogenousMatrix4& world_T_camera,
const AnyCamera& camera,
const Vector3& quadOrigin,
const Vector3& quadHorizontal,
const Vector3& quadVertical,
const unsigned int horizontalBins,
const unsigned int verticalBins,
const uint8_t* color =
nullptr);
603 static bool alignFramesHomographyFullCoverage(
const Frame& fixedFrame,
const Frame& dynamicFrame,
const SquareMatrix3& dynamic_H_fixed,
Frame& result,
const bool blend,
Worker* worker =
nullptr,
unsigned int maximalWidth = 16384u,
const unsigned int maximalHeight = 16384u,
unsigned int* fixedFrameLeft =
nullptr,
unsigned int* fixedFrameTop =
nullptr,
Scalar* dynamicFrameLeft =
nullptr,
Scalar* dynamicFrameTop =
nullptr,
Frame* fullFixedFrame =
nullptr,
Frame* fullDynamicFrame =
nullptr);
618 static void visualizeDatabase(
const Database& database,
const Index32 poseId,
Frame& frame,
const uint8_t* colorImagePoints,
const uint8_t* colorImagePointsInstable,
const uint8_t* colorImagePointsStable,
const unsigned int maximalPathLength = 20u,
const unsigned int stablePathLength = 100u,
const SquareMatrix3& transformation =
SquareMatrix3(
true),
Worker* worker =
nullptr);
680 static inline void paintLinesSubset(
Frame* frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const uint8_t* color,
const bool subPixel,
const Vector2* offsetStartPositions,
const Vector2* offsetStopPositions,
const unsigned int firstLine,
const unsigned int numberLines);
692 template <
unsigned int tSize>
693 static inline void paintLinesSubset(
Frame* frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const uint8_t* color,
const unsigned int firstLine,
const unsigned int numberLines);
707 template <
unsigned int tSizeForeground,
unsigned int tSizeBackground>
708 static inline void paintLinesSubset(
Frame* frame,
const Vector2* startPositions,
const Vector2* stopPositions,
const uint8_t* colorForeground,
const uint8_t* colorBackground,
const unsigned int firstLine,
const unsigned int numberLines);
720 template <
unsigned int tSize>
721 static inline void paintPathsSubset(
Frame* frame,
const Vectors2* paths,
const uint8_t* color,
const unsigned int firstPath,
const unsigned int numberPaths);
736 template <
unsigned int tSize>
737 static inline void paintPathsAdvancedSubset(
Frame* frame,
const Vectors2* paths,
const uint8_t* color0,
const uint8_t* color1,
const Scalar* factors,
const unsigned int firstPath,
const unsigned int numberPaths);
748 template <
unsigned int tSize = 1u>
749 static inline void paintTrianglesSubset(
Frame* frame,
const Triangle2* triangles,
const uint8_t* color,
const unsigned int firstTriangle,
const unsigned int numberTriangles);
762 template <
unsigned int tSize = 1u>
763 static inline void paintTrianglesIFSubset(
Frame* frame,
const HomogenousMatrix4* flippedCamera_T_world,
const AnyCamera* anyCamera,
const Triangle3* triangles,
const uint8_t* color,
const unsigned int firstTriangle,
const unsigned int numberTriangles);
774 template <
unsigned int tPo
intSize>
775 static inline void paintImagePointsSubset(
Frame* frame,
const Vector2* imagePoints,
const uint8_t* color,
const unsigned int firstImagePoint,
const unsigned int numberImagePoints);
788 template <
unsigned int tPo
intSize>
789 static inline void paintObjectPointsSubset(
Frame* frame,
const AnyCamera* anyCamera,
const HomogenousMatrix4* flippedCamera_T_world,
const Vector3* objectPoints,
const uint8_t* color,
const unsigned int firstObjectPoint,
const unsigned int numberObjectPoints);
808 template <
unsigned int tChannels>
809 static inline void paintFeaturePoints8BitPerChannelSubset(uint8_t* frame,
const unsigned int width,
const unsigned int height,
const Vector2* positions,
const Scalar* radii,
const Scalar* orientations,
const uint8_t* color,
const uint8_t* shadowColor,
const Scalar offsetX,
const Scalar offsetY,
const unsigned int framePaddingElements,
const unsigned int firstFeaturePoint,
const unsigned int numberFeaturePoints);
834 template <
unsigned int tObjectPo
intSize,
unsigned int tImagePo
intSize>
835 static void paintCorrespondencesSubset(
Frame* frame,
const AnyCamera* camera,
const HomogenousMatrix4* flippedCamera_T_model,
const Vector3* objectPoints,
const Vector2* imagePoints,
const Scalar maxSqrError,
const uint8_t* colorValidObjectPoints,
const uint8_t* colorValidImagePoints,
const uint8_t* colorInvalidObjectPoints,
const uint8_t* colorInvalidImagePoints,
const bool drawObjectPoints,
const bool drawImagePoints,
const bool drawConnections,
const unsigned int firstCorrespondence,
const unsigned int numberCorrespondences);
844 template <
unsigned int tBlendChannel,
unsigned int tChannels>
845 static inline void blendPixel(uint8_t* pixel,
const uint8_t blendFactor);
852 CV::Canvas::line<1u>(frame, startPosition.
x(), startPosition.
y(), stopPosition.
x(), stopPosition.
y(), color);
862 if (numberLines == 0)
869 worker->
executeFunction(
Worker::Function::createStatic(&
paintLinesSubset, &frame, startPositions, stopPositions, color, subPixel, &offsetStartPositions, &offsetStopPositions, 0u, 0u), 0u, (
unsigned int)(numberLines));
873 paintLinesSubset(&frame, startPositions, stopPositions, color, subPixel, &offsetStartPositions, &offsetStopPositions, 0u, (
unsigned int)(numberLines));
877 template <
unsigned int tSize>
880 if (numberLines == 0)
891 paintLinesSubset<tSize>(&frame, startPositions, stopPositions, color, 0u, (
unsigned int)numberLines);
895 template <
unsigned int tSizeForeground,
unsigned int tSizeBackground>
898 if (numberLines == 0)
905 worker->
executeFunction(
Worker::Function::createStatic(&paintLinesSubset<tSizeForeground, tSizeBackground>, &frame, startPositions, stopPositions, foregroundColor, backgroundColor, 0u, 0u), 0u, (
unsigned int)numberLines);
909 paintLinesSubset<tSizeForeground, tSizeBackground>(&frame, startPositions, stopPositions, foregroundColor, backgroundColor, 0u, (
unsigned int)numberLines);
913 template <
unsigned int tSize>
927 paintPathsSubset<tSize>(&frame, paths, color, 0u, (
unsigned int)size);
931 template <
unsigned int tSize>
945 paintPathsAdvancedSubset<tSize>(&frame, paths, color0, color1, factors, 0u, (
unsigned int)size);
949 template <
unsigned int tSize>
952 paintTrianglesSubset<tSize>(&frame, &triangle, color, 0u, 1u);
955 template <
unsigned int tSize>
958 if (triangles.empty())
969 paintTrianglesSubset<tSize>(&frame, triangles.
data(), color, 0u, (
unsigned int)triangles.size());
973 template <
unsigned int tPo
intSize>
976 static_assert(tPointSize % 2u == 1u,
"Invalid point size!");
989 paintImagePointsSubset<tPointSize>(&frame, imagePoints, color, 0u, (
unsigned int)size);
993 template <
unsigned int tPo
intSize>
996 static_assert(tPointSize % 2u == 1u,
"Invalid point size!");
1014 paintObjectPointsSubset<tPointSize>(&frame, &anyCamera, &flippedCamera_T_world, objectPoints, color, 0u, (
unsigned int)(size));
1018 template <
unsigned int tChannels>
1021 ocean_assert(frame && width != 0u && height != 0u && color);
1029 const Vector3 rightBottom = rotation *
Vector3(radius, radius, 0);
1030 const Vector3 leftBottom = rotation *
Vector3(-radius, radius, 0);
1034 CV::Canvas::line8BitPerChannel<tChannels, 3u>(frame, width, height, position.
x(), position.
y(), position.
x() + direction.
x(), position.
y() + direction.
y(), shadowColor, framePaddingElements);
1036 CV::Canvas::line8BitPerChannel<tChannels, 3u>(frame, width, height, position.
x() + leftTop.
x(), position.
y() + leftTop.
y(), position.
x() + leftBottom.
x(), position.
y() + leftBottom.
y(), shadowColor, framePaddingElements);
1037 CV::Canvas::line8BitPerChannel<tChannels, 3u>(frame, width, height, position.
x() + leftBottom.
x(), position.
y() + leftBottom.
y(), position.
x() + rightBottom.
x(), position.
y() + rightBottom.
y(), shadowColor, framePaddingElements);
1038 CV::Canvas::line8BitPerChannel<tChannels, 3u>(frame, width, height, position.
x() + rightBottom.
x(), position.
y() + rightBottom.
y(), position.
x() + rightTop.
x(), position.
y() + rightTop.
y(), shadowColor, framePaddingElements);
1039 CV::Canvas::line8BitPerChannel<tChannels, 3u>(frame, width, height, position.
x() + rightTop.
x(), position.
y() + rightTop.
y(), position.
x() + leftTop.
x(), position.
y() + leftTop.
y(), shadowColor, framePaddingElements);
1042 CV::Canvas::line8BitPerChannel<tChannels, 1u>(frame, width, height, position.
x(), position.
y(), position.
x() + direction.
x(), position.
y() + direction.
y(), color, framePaddingElements);
1044 CV::Canvas::line8BitPerChannel<tChannels, 1u>(frame, width, height, position.
x() + leftTop.
x(), position.
y() + leftTop.
y(), position.
x() + leftBottom.
x(), position.
y() + leftBottom.
y(), color, framePaddingElements);
1045 CV::Canvas::line8BitPerChannel<tChannels, 1u>(frame, width, height, position.
x() + leftBottom.
x(), position.
y() + leftBottom.
y(), position.
x() + rightBottom.
x(), position.
y() + rightBottom.
y(), color, framePaddingElements);
1046 CV::Canvas::line8BitPerChannel<tChannels, 1u>(frame, width, height, position.
x() + rightBottom.
x(), position.
y() + rightBottom.
y(), position.
x() + rightTop.
x(), position.
y() + rightTop.
y(), color, framePaddingElements);
1047 CV::Canvas::line8BitPerChannel<tChannels, 1u>(frame, width, height, position.
x() + rightTop.
x(), position.
y() + rightTop.
y(), position.
x() + leftTop.
x(), position.
y() + leftTop.
y(), color, framePaddingElements);
1050 template <
unsigned int tChannels>
1051 inline void Utilities::paintFeaturePoints8BitPerChannel(uint8_t* frame,
const unsigned int width,
const unsigned int height,
const Vector2* positions,
const Scalar* radii,
const Scalar* orientations,
const size_t size,
const uint8_t* color,
const uint8_t* shadowColor,
const Vector2& explicitOffset,
const unsigned int framePaddingElements,
Worker* worker)
1053 static_assert(tChannels != 0u,
"Invalid channel number!");
1055 ocean_assert(frame && width != 0u && height != 0u);
1064 worker->
executeFunction(
Worker::Function::createStatic(&paintFeaturePoints8BitPerChannelSubset<tChannels>, frame, width, height, positions, radii, orientations, color, shadowColor, explicitOffset.
x(), explicitOffset.
y(), framePaddingElements, 0u, 0u), 0u, (
unsigned int)(size), 11u, 12u, 20u);
1068 paintFeaturePoints8BitPerChannelSubset<tChannels>(frame, width, height, positions, radii, orientations, color, shadowColor, explicitOffset.
x(), explicitOffset.
y(), framePaddingElements, 0u, (
unsigned int)(size));
1072 template <
unsigned int tObjectPo
intSize,
unsigned int tImagePo
intSize>
1073 inline void Utilities::paintCorrespondences(
Frame& frame,
const AnyCamera& camera,
const HomogenousMatrix4& model_T_camera,
const Vector3* objectPoints,
const Vector2* imagePoints,
const size_t correspondences,
const Scalar maxSqrError,
const uint8_t* colorValidObjectPoints,
const uint8_t* colorValidImagePoints,
const uint8_t* colorInvalidObjectPoints,
const uint8_t* colorInvalidImagePoints,
const bool drawObjectPoints,
const bool drawImagePoints,
const bool drawConnections,
Worker* worker)
1075 static_assert(tObjectPointSize >= tImagePointSize,
"Invalid point size!");
1076 static_assert(tObjectPointSize % 2u == 1u,
"Invalid point size!");
1077 static_assert(tImagePointSize % 2u == 1u,
"Invalid point size!");
1079 if (correspondences == 0)
1088 worker->
executeFunction(
Worker::Function::createStatic(&paintCorrespondencesSubset<tObjectPointSize, tImagePointSize>, &frame, &camera, &flippedCamera_T_model, objectPoints, imagePoints, maxSqrError, colorValidObjectPoints, colorValidImagePoints, colorInvalidObjectPoints, colorInvalidImagePoints, drawObjectPoints, drawImagePoints, drawConnections, 0u, 0u), 0u, (
unsigned int)correspondences);
1092 paintCorrespondencesSubset<tObjectPointSize, tImagePointSize>(&frame, &camera, &flippedCamera_T_model, objectPoints, imagePoints, maxSqrError, colorValidObjectPoints, colorValidImagePoints, colorInvalidObjectPoints, colorInvalidImagePoints, drawObjectPoints, drawImagePoints, drawConnections, 0u, (
unsigned int)correspondences);
1096 inline void Utilities::paintPoints(
Frame& frame,
const HomogenousMatrix4& world_T_camera,
const PinholeCamera& pinholeCamera,
const Vector3* objectPoints,
const size_t numberObjectPoints,
const Vector2* imagePoints,
const size_t numberImagePoints,
const bool distortProjectedObjectPoints,
const unsigned int radiusObjectPoints,
const unsigned int radiusImagePoints,
const uint8_t* colorObjectPoints,
const uint8_t* colorImagePoints)
1098 paintPointsIF(frame,
PinholeCamera::standard2InvertedFlipped(world_T_camera), pinholeCamera, objectPoints, numberObjectPoints, imagePoints, numberImagePoints, distortProjectedObjectPoints, radiusObjectPoints, radiusImagePoints, colorObjectPoints, colorImagePoints);
1106 template <
unsigned int tSize>
1109 paintTrianglesIFSubset<tSize>(&frame, &flippedCamera_T_world, &anyCamera, &triangle, color, 0u, 1u);
1112 template <
unsigned int tSize>
1115 if (numberTriangles == 0)
1126 paintTrianglesIFSubset<tSize>(&frame, &flippedCamera_T_world, &anyCamera, triangles, color, 0u, (
unsigned int)(numberTriangles));
1132 ocean_assert(frame !=
nullptr);
1133 ocean_assert(startPositions !=
nullptr && stopPositions !=
nullptr);
1134 ocean_assert(offsetStartPositions !=
nullptr && offsetStopPositions !=
nullptr);
1136 for (
unsigned int n = firstLine; n < firstLine + numberLines; ++n)
1138 paintLine(*frame, startPositions[n] + *offsetStartPositions, stopPositions[n] + *offsetStopPositions, color, subPixel);
1142 template <
unsigned int tSize>
1145 ocean_assert(frame && startPositions && stopPositions);
1147 for (
unsigned int n = firstLine; n < firstLine + numberLines; ++n)
1149 CV::Canvas::line<tSize>(*frame, startPositions[n].x(), startPositions[n].y(), stopPositions[n].x(), stopPositions[n].y(), color);
1153 template <
unsigned int tSizeForeground,
unsigned int tSizeBackground>
1156 static_assert(tSizeForeground < tSizeBackground,
"Invalid line size");
1157 ocean_assert(frame && startPositions && stopPositions);
1159 for (
unsigned int n = firstLine; n < firstLine + numberLines; ++n)
1161 CV::Canvas::line<tSizeBackground>(*frame, startPositions[n].x(), startPositions[n].y(), stopPositions[n].x(), stopPositions[n].y(), colorBackground);
1162 CV::Canvas::line<tSizeForeground>(*frame, startPositions[n].x(), startPositions[n].y(), stopPositions[n].x(), stopPositions[n].y(), colorForeground);
1166 template <
unsigned int tSize>
1169 static_assert(tSize % 2u == 1u,
"Invalid size parameter.");
1171 ocean_assert(frame !=
nullptr);
1173 for (
unsigned int n = firstPath; n < firstPath + numberPaths; ++n)
1177 for (
size_t i = 1; i < path.size(); ++i)
1179 CV::Canvas::line<tSize>(*frame, path[i - 1], path[i], color);
1184 template <
unsigned int tSize>
1187 static_assert(tSize % 2u == 1u,
"Invalid size parameter.");
1189 ocean_assert(frame !=
nullptr);
1191 std::vector<uint8_t> color(frame->
channels());
1193 for (
unsigned int n = firstPath; n < firstPath + numberPaths; ++n)
1197 for (
unsigned int c = 0u; c < frame->
channels(); ++c)
1199 color[c] = uint8_t(
Scalar(color0[c]) * (1 - factors[n]) +
Scalar(color1[c]) * factors[n]);
1204 for (
size_t i = 1; i < path.size(); ++i)
1206 CV::Canvas::line<tSize>(*frame, path[i - 1], path[i], color.
data());
1211 template <
unsigned int tSize>
1214 static_assert(tSize % 2u == 1u,
"Invalid line width!");
1216 ocean_assert(frame && triangles);
1218 for (
unsigned int n = firstTriangle; n < firstTriangle + numberTriangles; ++n)
1220 const Triangle2& triangle = triangles[n];
1221 ocean_assert(triangle.
isValid());
1223 CV::Canvas::line<tSize>(*frame, triangle.
point0().x(), triangle.
point0().y(), triangle.
point1().x(), triangle.
point1().y(), color);
1224 CV::Canvas::line<tSize>(*frame, triangle.
point1().x(), triangle.
point1().y(), triangle.
point2().x(), triangle.
point2().y(), color);
1225 CV::Canvas::line<tSize>(*frame, triangle.
point2().x(), triangle.
point2().y(), triangle.
point0().x(), triangle.
point0().y(), color);
1229 template <
unsigned int tSize>
1232 static_assert(tSize % 2u == 1u,
"Invalid line width!");
1234 ocean_assert(frame !=
nullptr && flippedCamera_T_world !=
nullptr && anyCamera !=
nullptr && triangles !=
nullptr);
1236 for (
unsigned int n = firstTriangle; n < firstTriangle + numberTriangles; ++n)
1244 CV::Canvas::line<tSize>(*frame, imagePoint0.
x(), imagePoint0.
y(), imagePoint1.
x(), imagePoint1.
y(), color);
1245 CV::Canvas::line<tSize>(*frame, imagePoint1.
x(), imagePoint1.
y(), imagePoint2.
x(), imagePoint2.
y(), color);
1246 CV::Canvas::line<tSize>(*frame, imagePoint2.
x(), imagePoint2.
y(), imagePoint0.
x(), imagePoint0.
y(), color);
1251 template <
unsigned int tPo
intSize>
1254 static_assert(tPointSize % 2u == 1u,
"Invalid point size!");
1256 ocean_assert(frame !=
nullptr && imagePoints !=
nullptr);
1258 for (
unsigned int n = firstImagePoint; n < firstImagePoint + numberImagePoints; ++n)
1260 CV::Canvas::point<tPointSize>(*frame, imagePoints[n], color);
1264 template <
unsigned int tPo
intSize>
1267 static_assert(tPointSize % 2u == 1u,
"Invalid point size!");
1269 ocean_assert(frame !=
nullptr && anyCamera !=
nullptr && flippedCamera_T_world !=
nullptr && objectPoints !=
nullptr);
1271 for (
unsigned int n = firstObjectPoint; n < firstObjectPoint + numberObjectPoints; ++n)
1277 CV::Canvas::point<tPointSize>(*frame, projectedObjectPoint, color);
1282 template <
unsigned int tChannels>
1283 inline void Utilities::paintFeaturePoints8BitPerChannelSubset(uint8_t* frame,
const unsigned int width,
const unsigned int height,
const Vector2* positions,
const Scalar* radii,
const Scalar* orientations,
const uint8_t* color,
const uint8_t* shadowColor,
const Scalar offsetX,
const Scalar offsetY,
const unsigned int framePaddingElements,
const unsigned int firstFeaturePoint,
const unsigned int numberFeaturePoints)
1285 ocean_assert(frame && width != 0u && height != 0u);
1286 ocean_assert(positions && radii && orientations && color);
1288 for (
unsigned int n = firstFeaturePoint; n < firstFeaturePoint + numberFeaturePoints; ++n)
1290 paintFeaturePoint8BitPerChannel<tChannels>(frame, width, height, positions[n] +
Vector2(offsetX, offsetY), radii[n], orientations[n], color, shadowColor, framePaddingElements);
1294 template <
unsigned int tObjectPo
intSize,
unsigned int tImagePo
intSize>
1295 void Utilities::paintCorrespondencesSubset(
Frame* frame,
const AnyCamera* camera,
const HomogenousMatrix4* flippedCamera_T_model,
const Vector3* objectPoints,
const Vector2* imagePoints,
const Scalar maxSqrError,
const uint8_t* colorValidObjectPoints,
const uint8_t* colorValidImagePoints,
const uint8_t* colorInvalidObjectPoints,
const uint8_t* colorInvalidImagePoints,
const bool drawObjectPoints,
const bool drawImagePoints,
const bool drawConnections,
const unsigned int firstCorrespondence,
const unsigned int numberCorrespondences)
1297 static_assert(tObjectPointSize >= tImagePointSize,
"Invalid point size!");
1298 static_assert(tObjectPointSize % 2u == 1u,
"Invalid point size!");
1299 static_assert(tImagePointSize % 2u == 1u,
"Invalid point size!");
1301 ocean_assert(frame !=
nullptr && camera !=
nullptr && flippedCamera_T_model !=
nullptr && objectPoints !=
nullptr && imagePoints !=
nullptr );
1303 for (
unsigned int n = firstCorrespondence; n < firstCorrespondence + numberCorrespondences; ++n)
1309 const uint8_t* colorObjectPoint = (
sqrDistance <= maxSqrError) ? colorValidObjectPoints : colorInvalidObjectPoints;
1310 const uint8_t* colorImagePoint = (
sqrDistance <= maxSqrError) ? colorValidImagePoints : colorInvalidImagePoints;
1312 if (drawObjectPoints)
1314 CV::Canvas::point<tObjectPointSize>(*frame, projectedObjectPoint, colorObjectPoint);
1319 CV::Canvas::line<1u>(*frame, projectedObjectPoint, imagePoints[n], colorImagePoint);
1322 if (drawImagePoints)
1324 CV::Canvas::point<tImagePointSize>(*frame, imagePoints[n], colorImagePoint);
1329 template <
unsigned int tBlendChannel,
unsigned int tChannels>
1332 static_assert(tBlendChannel < tChannels,
"Invalid blend channel!");
1334 ocean_assert(pixel);
1336 if (blendFactor == 0xFF)
1338 for (
unsigned int n = 0u; n < tChannels; ++n)
1340 if (n == tBlendChannel)
This class implements the abstract base class for all AnyCamera objects.
Definition: AnyCamera.h:130
virtual unsigned int width() const =0
Returns the width of the camera image.
virtual VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const =0
Projects a 3D object point into the camera frame.
virtual unsigned int height() const =0
Returns the height of the camera image.
virtual bool isValid() const =0
Returns whether this camera is valid.
static bool line(Frame &frame, const int xStart, const int yStart, const int xEnd, const int yEnd, const uint8_t *value=nullptr)
Paints a line with specified start and end position with pixel accuracy.
static const uint8_t * yellow(const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_RGB24)
Returns the color values for a yellow color.
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 HomogenousMatrixT4< U > standard2InvertedFlipped(const HomogenousMatrixT4< U > &world_T_camera)
Transforms a standard homogenous 4x4 viewing (extrinsic camera) matrix into an inverted and flipped c...
Definition: Camera.h:734
static bool isObjectPointInFrontIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, const T epsilon=NumericT< T >::eps())
Determines whether a given 3D object point lies in front of a camera while the location of the camera...
Definition: Camera.h:811
This class implements a (possibly truncated) 3D cone.
Definition: Cone3.h:59
This class implements a 3D cylinder defined by its origin, axis, radius, and (signed) starting and st...
Definition: Cylinder3.h:80
This class implements Ocean's image class.
Definition: Frame.h:1792
T * data(const unsigned int planeIndex=0u)
Returns a pointer to the pixel data of a specific plane.
Definition: Frame.h:4159
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4448
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
@ FORMAT_UNDEFINED
Undefined pixel format.
Definition: Frame.h:187
unsigned int width() const
Returns the width of the frame format in pixel.
Definition: Frame.h:3143
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3148
unsigned int channels() const
Returns the number of individual channels the frame has.
Definition: Frame.h:3173
This class implements an output bitstream.
Definition: Bitstream.h:168
std::vector< unsigned char > Buffer
Definition of a vector holding bytes.
Definition: Maintenance.h:41
static constexpr T pi2()
Returns 2*PI which is equivalent to 360 degree.
Definition: Numeric.h:932
static constexpr bool isInsideRange(const T lower, const T value, const T upper, const T epsilon=NumericT< T >::eps())
Returns whether a value lies between a given range up to a provided epsilon border.
Definition: Numeric.h:2872
static constexpr int32_t round32(const T value)
Returns the rounded 32 bit integer value of a given value.
Definition: Numeric.h:2064
static constexpr T eps()
Returns a small epsilon.
This class implements a database for 3D object points, 2D image points and 6DOF camera poses.
Definition: Database.h:67
This class implements utility functions allowing e.g., for a more comfortable visualization of tracki...
Definition: tracking/Utilities.h:46
static bool readCamera(IO::InputBitstream &inputStream, PinholeCamera &pinholeCamera)
Reads a camera profile from a binary input stream.
static void paintTriangles(Frame &frame, const Triangles2 &triangles, const uint8_t *color=nullptr, Worker *worker=nullptr)
Paints a set of 2D triangles into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:956
static void paintPaths(Frame &frame, const Vectors2 *paths, const size_t size, const uint8_t *color=nullptr, Worker *worker=nullptr)
Paints several paths into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:914
static void paintTrianglesIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &anyCamera, const Triangle3 *triangles, const size_t numberTriangles, const uint8_t *color=nullptr, Worker *worker=nullptr)
Paints (projected) 3D triangles into a given frame.
Definition: tracking/Utilities.h:1113
static void paintPathsAdvancedSubset(Frame *frame, const Vectors2 *paths, const uint8_t *color0, const uint8_t *color1, const Scalar *factors, const unsigned int firstPath, const unsigned int numberPaths)
Paints a subset of several paths into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:1185
static Frame paintCorrespondencesBlend(const Frame &frame0, const Frame &frame1, const Vector2 *points0, const Vector2 *points1, const size_t numberPoints, const uint8_t *rgbColor=nullptr, Worker *worker=nullptr)
Blends two corresponding frames each with a ratio of fifty percent and paints a set of given feature ...
static void paintObjectPoints(Frame &frame, const AnyCamera &anyCamera, const HomogenousMatrix4 &world_T_camera, const Vector3 *objectPoints, const size_t size, const uint8_t *color, Worker *worker=nullptr)
Paints a set of 3D object points (rather their projected 2D counterparts respectively) into a given f...
Definition: tracking/Utilities.h:994
static bool paintPlane(Frame &frame, const HomogenousMatrix4 &world_T_camera, const AnyCamera &camera, const HomogenousMatrix4 &planeTransformation, const unsigned int bins, const uint8_t *foregroundColor, const uint8_t *backgroundColor, Scalar *expansion=nullptr)
Paints a 3D plane into the frame, further the origin of the plane is painted.
static void paintImagePointsSubset(Frame *frame, const Vector2 *imagePoints, const uint8_t *color, const unsigned int firstImagePoint, const unsigned int numberImagePoints)
Paints subset of a set of 2D image points into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:1252
static void paintLinesSubset(Frame *frame, const Vector2 *startPositions, const Vector2 *stopPositions, const uint8_t *color, const bool subPixel, const Vector2 *offsetStartPositions, const Vector2 *offsetStopPositions, const unsigned int firstLine, const unsigned int numberLines)
Paints a subset of a set of lines into a given frame.
Definition: tracking/Utilities.h:1130
static void paintWireframeConeIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_cone, const PinholeCamera &pinholeCamera, const Cone3 &cone, const bool distortProjectedObjectPoints=true, Worker *worker=nullptr, const uint8_t *color=CV::Canvas::yellow(), const unsigned int numCircles=6u, const unsigned int numVerticalLines=4u, const unsigned int numSamples=72u)
Paints a (projected) wire-frame cone into a given frame.
static bool alignFramesHomography(const Frame &fixedFrame, const Frame &dynamicFrame, const SquareMatrix3 &dynamic_H_fixed, Frame &result, const bool blend, Worker *worker=nullptr)
Aligns two frames connected by a given homography into one frame while the resulting frame covers the...
static void paintLineIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &anyCamera, const Vector3 &objectPoint0, const Vector3 &objectPoint1, const unsigned int segments, const uint8_t *foregroundColor, const uint8_t *backgroundColor)
Paints a (projected) 3D line into a given frame.
static void paintLines(Frame &frame, const Vector2 *startPositions, const Vector2 *stopPositions, const size_t numberLines, const uint8_t *color=nullptr, Worker *worker=nullptr, const bool subPixel=true, const Vector2 &offsetStartPositions=Vector2(0, 0), const Vector2 &offsetStopPositions=Vector2(0, 0))
Paints a set of lines into a given frame.
Definition: tracking/Utilities.h:860
static Frame blendFrames(const Frame &frame0, const Frame &frame1, Worker *worker=nullptr)
Blends two given frames having the same frame type.
static Frame blendFrames(const Frame &frame0, const Frame &frame1, Vector2 &offset0, Vector2 &offset1, const FrameType::PixelFormat pixelFormat=FrameType::FORMAT_UNDEFINED, Worker *worker=nullptr)
Blends two given frames with same pixel origin.
static void paintObjectPointsSubset(Frame *frame, const AnyCamera *anyCamera, const HomogenousMatrix4 *flippedCamera_T_world, const Vector3 *objectPoints, const uint8_t *color, const unsigned int firstObjectPoint, const unsigned int numberObjectPoints)
Paints a subset of set of 3D object points (rather their projected 2D counterparts respectively) into...
Definition: tracking/Utilities.h:1265
static bool readDatabase(IO::InputBitstream &inputStream, Database &database)
Reads a database information from a binary input stream.
static void blendPixel(uint8_t *pixel, const uint8_t blendFactor)
Paints / blends a binary 8 bit mask pixel into a given pixel with 8 bit per channel.
Definition: tracking/Utilities.h:1330
static void paintFeaturePoint8BitPerChannel(uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 &position, const Scalar radius, const Scalar orientation, const uint8_t *color, const uint8_t *shadowColor, const unsigned int framePaddingElements=0u)
Paints a feature point having a radius (a scale) and orientation.
Definition: tracking/Utilities.h:1019
static bool paintPlaneIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &camera, const HomogenousMatrix4 &planeTransformation, const Scalar expansion, const unsigned int bins, const uint8_t *foregroundColor, const uint8_t *backgroundColor)
Paints a 3D plane into the frame, further the origin of the plane is painted.
static void paintPathsSubset(Frame *frame, const Vectors2 *paths, const uint8_t *color, const unsigned int firstPath, const unsigned int numberPaths)
Paints a subset of several paths into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:1167
static Frame paintBoundingBox(const Frame &frame, const CV::PixelBoundingBox &boundingBox, Worker *worker=nullptr)
Paints / blends a bounding box into a given frame.
static void paintFeaturePoint(Frame &frame, const Vector2 &position, const Scalar radius, const Scalar orientation, const uint8_t *color, const uint8_t *shadowColor)
Paints a feature point having a radius (a scale) and orientation.
static void paintQuads(Frame &frame, const HomogenousMatrix4 &world_T_camera, const AnyCamera &camera, const Vector3 &quadOrigin, const Vector3 &quadHorizontal, const Vector3 &quadVertical, const unsigned int horizontalBins, const unsigned int verticalBins, const uint8_t *color=nullptr)
Paints quads that are located on a 3D plane into a given frame.
Definition: tracking/Utilities.h:1101
static void paintFeaturePoints8BitPerChannel(uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 *positions, const Scalar *radii, const Scalar *orientations, const size_t size, const uint8_t *color, const uint8_t *shadowColor, const Vector2 &explicitOffset, const unsigned int framePaddingElements, Worker *worker=nullptr)
Paints feature points having a radius (a scale) and orientation.
Definition: tracking/Utilities.h:1051
static void visualizeDatabase(const Database &database, const Index32 poseId, Frame &frame, const uint8_t *colorImagePoints, const uint8_t *colorImagePointsInstable, const uint8_t *colorImagePointsStable, const unsigned int maximalPathLength=20u, const unsigned int stablePathLength=100u, const SquareMatrix3 &transformation=SquareMatrix3(true), Worker *worker=nullptr)
Visualizes image point information of a tracking database for a specific pose id.
static void paintPoints(Frame &frame, const Vector2 *imagePoints, const size_t number, const unsigned int radius, const uint8_t *colorInner=nullptr, const uint8_t *colorOuter=nullptr)
Paints a set of image points into a given frame.
static void paintQuadsIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &camera, const Vector3 &quadOrigin, const Vector3 &quadHorizontal, const Vector3 &quadVertical, const unsigned int horizontalBins, const unsigned int verticalBins, const uint8_t *color=nullptr)
Paints quads that are located on a 3D plane into a given frame.
static void paintLine(Frame &frame, const Vector2 &startPosition, const Vector2 &stopPosition, const uint8_t *color=nullptr, const bool subPixel=true)
Paints a line into a given frame.
Definition: tracking/Utilities.h:848
static Frame paintMask(const Frame &frame, const Frame &mask, const uint8_t maskValue=uint8_t(0xFFu), Worker *worker=nullptr)
Paints / blends a binary 8 bit mask into a given frame with identical frame dimension.
static bool alignFramesHomographyFullCoverage(const Frame &fixedFrame, const Frame &dynamicFrame, const SquareMatrix3 &dynamic_H_fixed, Frame &result, const bool blend, Worker *worker=nullptr, unsigned int maximalWidth=16384u, const unsigned int maximalHeight=16384u, unsigned int *fixedFrameLeft=nullptr, unsigned int *fixedFrameTop=nullptr, Scalar *dynamicFrameLeft=nullptr, Scalar *dynamicFrameTop=nullptr, Frame *fullFixedFrame=nullptr, Frame *fullDynamicFrame=nullptr)
Aligns two frames connected by a given homography into one frame entirely covering the frame content ...
static void paintCorrespondences(Frame &frame, const AnyCamera &camera, const HomogenousMatrix4 &model_T_camera, const Vector3 *objectPoints, const Vector2 *imagePoints, const size_t correspondences, const Scalar maxSqrError, const uint8_t *colorValidObjectPoints, const uint8_t *colorValidImagePoints, const uint8_t *colorInvalidObjectPoints, const uint8_t *colorInvalidImagePoints, const bool drawObjectPoints=true, const bool drawImagePoints=true, const bool drawConnections=true, Worker *worker=nullptr)
Paints a set of correspondences between 2D image points and 3D object points (rather their projected ...
Definition: tracking/Utilities.h:1073
static void paintTrianglesIFSubset(Frame *frame, const HomogenousMatrix4 *flippedCamera_T_world, const AnyCamera *anyCamera, const Triangle3 *triangles, const uint8_t *color, const unsigned int firstTriangle, const unsigned int numberTriangles)
Projects and paints a subset of 3D triangles into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:1230
static void paintImagePoints(Frame &frame, const Vector2 *imagePoints, const size_t size, const uint8_t *color, Worker *worker=nullptr)
Paints a set of 2D image points into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:974
static bool writeDatabase(const Database &database, IO::OutputBitstream &outputStream)
Writes the information of a database to a given output stream as binary information.
static bool paintCorrespondencesHomography(const Frame &frame0, const Frame &frame1, const SquareMatrix3 &points1_H_points0, const Vector2 *points0, const Vector2 *points1, const size_t numberPoints, const bool fullCoverage, Frame &result, const uint8_t *foregroundColor=nullptr, const uint8_t *backgroundColor=nullptr, const uint8_t *startColor=nullptr, Worker *worker=nullptr)
Joins two corresponding frames by application of a homography and paints a set of given feature corre...
static void paintBoundingBoxIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &anyCamera, const Box3 &boundingBox, const uint8_t *foregroundColor, const uint8_t *backgroundColor, const bool edgesOnly=true)
Paints a (projected) 3D axis aligned bounding box into a given frame.
static void paintCoordinateSystemIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &anyCamera, const HomogenousMatrix4 &world_T_coordinateSystem, const Scalar length)
Paints a 3D coordinate system (projected) into a frame.
static void paintFeaturePoints(Frame &frame, const Vector2 *positions, const Scalar *radii, const Scalar *orientations, const size_t size, const uint8_t *color, const uint8_t *shadowColor, const Vector2 &explicitOffset=Vector2(0, 0), Worker *worker=nullptr)
Paints feature points having a radius (a scale) and orientation.
static Frame paintCorrespondencesHorizontal(const Frame &frame0, const Frame &frame1, const Vector2 *points0, const Vector2 *points1, const size_t numberPoints, const uint8_t *color=nullptr, Worker *worker=nullptr)
Joins two corresponding frames horizontally and paints a set of given feature correspondences.
static bool paintCorrespondencesOrientations(const PinholeCamera &pinholeCamera, const Frame &frame0, const Frame &frame1, const SquareMatrix3 &orientation0, const SquareMatrix3 &orientation1, const Vector2 *points0, const Vector2 *points1, const size_t numberPoints, Frame &result, const uint8_t *foregroundColor=nullptr, const uint8_t *backgroundColor=nullptr, const uint8_t *startColor=nullptr, Worker *worker=nullptr)
Joins two corresponding frames by application of their orientations and paints a set of given feature...
static void paintTriangle(Frame &frame, const Triangle2 &triangle, const uint8_t *color=nullptr)
Paints a 2D triangle into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:950
static Frame paintCorrespondencesVertical(const Frame &frame0, const Frame &frame1, const Vector2 *points0, const Vector2 *points1, const size_t numberPoints, const uint8_t *color=nullptr, Worker *worker=nullptr)
Joins two corresponding frames vertically and paints a set of given feature correspondences.
static void paintTrianglesSubset(Frame *frame, const Triangle2 *triangles, const uint8_t *color, const unsigned int firstTriangle, const unsigned int numberTriangles)
Paints a subset of 2D triangles into a given frame with sub-pixel accuracy.
Definition: tracking/Utilities.h:1212
static bool writeCamera(const PinholeCamera &pinholeCamera, IO::OutputBitstream &outputStream)
Writes a camera profile to a binary output stream.
static void paintWireframeCylinderIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_cylinder, const PinholeCamera &pinholeCamera, const Cylinder3 &cylinder, const bool distortProjectedObjectPoints=true, Worker *worker=nullptr, const uint8_t *color=CV::Canvas::yellow(), const unsigned int numCircles=6u, const unsigned int numVerticalLines=4u, const unsigned int numSamples=72u)
Paints a (projected) wire-frame cylinder into a given frame.
static void paintFeaturePoints8BitPerChannelSubset(uint8_t *frame, const unsigned int width, const unsigned int height, const Vector2 *positions, const Scalar *radii, const Scalar *orientations, const uint8_t *color, const uint8_t *shadowColor, const Scalar offsetX, const Scalar offsetY, const unsigned int framePaddingElements, const unsigned int firstFeaturePoint, const unsigned int numberFeaturePoints)
Paints a subset of feature points having a radius (a scale) and orientation.
Definition: tracking/Utilities.h:1283
static void paintTriangleIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const AnyCamera &anyCamera, const Triangle3 &triangle, const uint8_t *color=nullptr)
Paints a (projected) 3D triangle into a given frame.
Definition: tracking/Utilities.h:1107
static void paintCorrespondencesSubset(Frame *frame, const AnyCamera *camera, const HomogenousMatrix4 *flippedCamera_T_model, const Vector3 *objectPoints, const Vector2 *imagePoints, const Scalar maxSqrError, const uint8_t *colorValidObjectPoints, const uint8_t *colorValidImagePoints, const uint8_t *colorInvalidObjectPoints, const uint8_t *colorInvalidImagePoints, const bool drawObjectPoints, const bool drawImagePoints, const bool drawConnections, const unsigned int firstCorrespondence, const unsigned int numberCorrespondences)
Paints a subset of a set of correspondences between 2D image points and 3D object points (rather thei...
Definition: tracking/Utilities.h:1295
static void paintPointsIF(Frame &frame, const HomogenousMatrix4 &flippedCamera_T_world, const PinholeCamera &pinholeCamera, const Vector3 *objectPoints, const size_t numberObjectPoints, const Vector2 *imagePoints, const size_t numberImagePoints, const bool distortProjectedObjectPoints, const unsigned int radiusObjectPoints, const unsigned int radiusImagePoints, const uint8_t *colorObjectPoints=nullptr, const uint8_t *colorImagePoints=nullptr)
Paints (projected) object points and image points into a given frame.
static Maintenance::Buffer encodeEnvironment(const Frame &frame, const Vectors2 &frameImagePoints, const Vectors3 &frameObjectPoints, const HomogenousMatrix4 &framePose, const Vectors3 &objectPoints)
Encodes the tracking environment composes of a frame mesh (a frame with correspondences of 2D image p...
This class implements a 2D triangle with Cartesian coordinates.
Definition: Triangle2.h:81
const VectorT2< T > & point2() const
Returns the third triangle corner.
Definition: Triangle2.h:415
const VectorT2< T > & point0() const
Returns the first triangle corner.
Definition: Triangle2.h:403
const VectorT2< T > & point1() const
Returns the second triangle corner.
Definition: Triangle2.h:409
bool isValid() const
Returns whether this triangle can provide valid barycentric coordinates (for 64 bit floating point va...
Definition: Triangle2.h:806
This class implements a 3D triangle.
Definition: Triangle3.h:80
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
T sqrDistance(const VectorT2< T > &right) const
Returns the square distance between this 2D position and a second 2D position.
Definition: Vector2.h:633
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
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.
unsigned int sqrDistance(const char first, const char second)
Returns the square distance between two values.
Definition: base/Utilities.h:1089
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
SquareMatrixT3< Scalar > SquareMatrix3
Definition of the SquareMatrix3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with ...
Definition: SquareMatrix3.h:35
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Triangle2 > Triangles2
Definition of a vector holding 2D triangles.
Definition: Triangle2.h:57
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition: Vector3.h:22
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition: Vector2.h:64
std::vector< Vector3 > Vectors3
Definition of a vector holding Vector3 objects.
Definition: Vector3.h:65
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15