8#ifndef META_OCEAN_MATH_ANY_CAMERA_H 
    9#define META_OCEAN_MATH_ANY_CAMERA_H 
   23template <
typename T> 
class AnyCameraT;
 
  153        virtual std::string 
name() 
const = 0;
 
  162        virtual std::unique_ptr<AnyCameraT<T>> 
clone(
const unsigned int width = 0
u, 
const unsigned int height = 0
u) 
const = 0;
 
  186        virtual unsigned int width() 
const = 0;
 
  449        template <
typename U>
 
 
  604template <
typename T, 
typename TCameraWrapper>
 
  644        std::string 
name() 
const override;
 
  653        std::unique_ptr<AnyCameraT<T>> 
clone(
const unsigned int width = 0
u, 
const unsigned int height = 0
u) 
const override;
 
  662        std::unique_ptr<AnyCameraT<float>> 
cloneToFloat(
const unsigned int width = 0
u, 
const unsigned int height = 0
u) 
const override;
 
  671        std::unique_ptr<AnyCameraT<double>> 
cloneToDouble(
const unsigned int width = 0
u, 
const unsigned int height = 0
u) 
const override;
 
  677        unsigned int width() 
const override;
 
  683        unsigned int height() 
const override;
 
  732        T 
fovX() 
const override;
 
  739        T 
fovY() 
const override;
 
 
  937template <
typename T, 
typename TCameraWrapperBase>
 
  945        using typename TCameraWrapperBase::ActualCamera;
 
  971        inline T 
fovX() 
const;
 
  977        inline T 
fovY() 
const;
 
 
 1046template <
typename T>
 
 1085        inline unsigned int width() 
const;
 
 1091        inline unsigned int height() 
const;
 
 1188        template <
typename U>
 
 1189        inline std::unique_ptr<AnyCameraT<U>> 
clone(
const unsigned int width = 0u, 
const unsigned int height = 0u) 
const;
 
 1201        static inline std::string 
name();
 
 
 1215template <
typename T>
 
 1254        inline unsigned int width() 
const;
 
 1260        inline unsigned int height() 
const;
 
 1362        template <
typename U>
 
 1363        inline std::unique_ptr<AnyCameraT<U>> 
clone(
const unsigned int width = 0u, 
const unsigned int height = 0u) 
const;
 
 1375        static inline std::string 
name();
 
 
 1388template <
typename T>
 
 1403        const std::string& 
reason() 
const;
 
 
 1438template <
typename T>
 
 1477        inline unsigned int width() 
const;
 
 1483        inline unsigned int height() 
const;
 
 1585        template <
typename U>
 
 1586        inline std::unique_ptr<AnyCameraT<U>> 
clone(
const unsigned int width = 0u, 
const unsigned int height = 0u) 
const;
 
 1598        static inline std::string 
name();
 
 
 1612template <
typename T>
 
 1642template <
typename T>
 
 1672template <
typename T>
 
 1696template <
typename T>
 
 1699    ocean_assert(camera != 
nullptr && camera->isValid() && segmentSteps >= 1);
 
 1701    if (camera != 
nullptr && camera->isValid() && segmentSteps >= 1)
 
 1705        if (determineCameraBoundary(*camera, cameraBoundarySegments, segmentSteps))
 
 1708            cameraBoundarySegments_ = std::move(cameraBoundarySegments);
 
 
 1713template <
typename T>
 
 1716    ocean_assert(camera_ != 
nullptr);
 
 1717    ocean_assert(camera_->isValid());
 
 1718    ocean_assert(flippedCamera_T_world.
isValid());
 
 1720    const VectorT3<T> cameraObjectPointIF = flippedCamera_T_world * objectPoint;
 
 1727    const T invZ = T(1) / cameraObjectPointIF.
z();
 
 1729    const VectorT2<T> normalizedImagePoint(cameraObjectPointIF.
x() * invZ, cameraObjectPointIF.
y() * invZ);
 
 1731    if (!isInside(cameraBoundarySegments_, normalizedImagePoint))
 
 1736    if (imagePoint != 
nullptr)
 
 1738        *imagePoint = camera_->projectToImageIF(cameraObjectPointIF);
 
 1740        ocean_assert_accuracy(camera_->isInside(*imagePoint, T(std::max(camera_->width(), camera_->height())) * T(-0.1)));
 
 
 1746template <
typename T>
 
 1752template <
typename T>
 
 1755    return cameraBoundarySegments_;
 
 
 1758template <
typename T>
 
 1761    ocean_assert(camera_ == 
nullptr || !cameraBoundarySegments_.empty());
 
 1763    return camera_ != 
nullptr;
 
 
 1766template <
typename T>
 
 1769    ocean_assert(camera.
isValid());
 
 1775    ocean_assert(segmentSteps >= 1);
 
 1776    if (segmentSteps < 1)
 
 1781    constexpr unsigned int border = 0u;
 
 1783    const std::array<VectorT2<T>, 4> corners =
 
 1799    const T sqrProjectionErrorPrincipalPoint = camera.
projectToImageIF(principalObjectPoint).sqrDistance(principalPoint);
 
 1801    if (sqrProjectionErrorPrincipalPoint > maximalSqrDistance)
 
 1803        ocean_assert(
false && 
"The camera model is not precise enough");
 
 1808    normalizedImagePoints.reserve(corners.size() * segmentSteps);
 
 1810    for (
size_t nCorner = 0; nCorner < corners.size(); ++nCorner)
 
 1813        const VectorT2<T>& corner1 = corners[(nCorner + 1u) % corners.size()];
 
 1815        for (
size_t nStep = 0; nStep < segmentSteps; ++nStep)
 
 1817            const T factor = T(nStep) / T(segmentSteps);
 
 1819            const VectorT2<T> distortedImagePoint = corner0 * (T(1) - factor) + corner1 * factor;
 
 1821            const VectorT2<T> offsetTowardsPrincipalPoint = (principalPoint - distortedImagePoint).normalizedOrZero() * T(1.0); 
 
 1825            if (isValidForPoint(camera, distortedImagePoint, maximalSqrDistance, 3u))
 
 1827                objectPoint = camera.
vectorIF(distortedImagePoint, 
false );
 
 1836                VectorT2<T> boundaryImagePoint = distortedImagePoint;
 
 1839                objectPoint = principalObjectPoint;
 
 1841                constexpr unsigned int iterations = 20u;
 
 1843                for (
unsigned int nIteration = 0u; nIteration < iterations; ++nIteration)
 
 1845                    if (boundaryImagePoint.
sqrDistance(centerImagePoint) <= maximalSqrDistance)
 
 1850                    const VectorT2<T> middleImagePoint = (boundaryImagePoint + centerImagePoint) * T(0.5);
 
 1855                    const T sqrMiddleDistance = middleImagePoint.
sqrDistance(projectedMiddleObjectPoint);
 
 1857                    if (sqrMiddleDistance <= maximalSqrDistance)
 
 1859                        centerImagePoint = middleImagePoint;
 
 1861                        objectPoint = camera.
vectorIF(middleImagePoint + offsetTowardsPrincipalPoint, 
false );
 
 1865                        boundaryImagePoint = middleImagePoint;
 
 1869                ocean_assert(objectPoint != principalObjectPoint);
 
 1875                const VectorT2<T> normalizedImagePoint  = objectPoint.
xy() / objectPoint.
z();
 
 1877                normalizedImagePoints.emplace_back(normalizedImagePoint.
x(), normalizedImagePoint.
y());
 
 1882    ocean_assert(normalizedImagePoints.size() >= 3);
 
 1883    ocean_assert(normalizedImagePoints.size() == segmentSteps * corners.size());
 
 1885    ocean_assert(cameraBoundarySegments.empty());
 
 1886    cameraBoundarySegments.clear();
 
 1888    cameraBoundarySegments.reserve(normalizedImagePoints.size());
 
 1890    for (
size_t n = 1; n < normalizedImagePoints.size(); ++n)
 
 1892        cameraBoundarySegments.emplace_back(normalizedImagePoints[n - 1], normalizedImagePoints[n]);
 
 1895    cameraBoundarySegments.emplace_back(normalizedImagePoints.back(), normalizedImagePoints.front());
 
 
 1900template <
typename T>
 
 1903    ocean_assert(cameraBoundarySegments.size() >= 3);
 
 1907    for (
const FiniteLineT2<T>& cameraBoundarySegment : cameraBoundarySegments)
 
 1911        const bool segmentTopDown = cameraBoundarySegment.point0().y() < cameraBoundarySegment.point1().y();
 
 1915            if (cameraBoundarySegment.point1().y() < normalizedImagePoint.
y() || normalizedImagePoint.
y() < cameraBoundarySegment.point0().y())
 
 1922            if (cameraBoundarySegment.point0().y() < normalizedImagePoint.
y() || normalizedImagePoint.
y() < cameraBoundarySegment.point1().y())
 
 1928        if (cameraBoundarySegment.isOnLine(normalizedImagePoint))
 
 1935        if (cameraBoundarySegment.isLeftOfLine(normalizedImagePoint) == segmentTopDown)
 
 1944    return counter % 2 == 1;
 
 
 1947template <
typename T>
 
 1950    ocean_assert(camera.
isValid());
 
 1951    ocean_assert(camera.
isInside(imagePoint, T(-1)));
 
 1952    ocean_assert(maximalReprojectionError >= T(0));
 
 1953    ocean_assert(additionalChecksTowardsPrincipalPoint>= 1u);
 
 1966    const VectorT2<T> direction = (principalPoint - imagePoint).normalizedOrZero();
 
 1974    for (
unsigned int n = 0u; n < std::min(additionalChecksTowardsPrincipalPoint, 10u); ++n)
 
 1976        const VectorT2<T> additionalImagePoint = imagePoint + direction * T(n + 1u);
 
 
 1996        return anyCamera->cloneToFloat();
 
 
 2008        return anyCamera->cloneToDouble();
 
 
 2014template <
typename T>
 
 2015template <
typename U>
 
 2018    static_assert(std::is_same<T, U>::value, 
"Invalid data types!");
 
 
 2023template <
typename T, 
typename TCameraWrapper>
 
 2030template <
typename T, 
typename TCameraWrapper>
 
 2037template <
typename T, 
typename TCameraWrapper>
 
 2040    return TCameraWrapper::anyCameraType();
 
 
 2043template <
typename T, 
typename TCameraWrapper>
 
 2046    return TCameraWrapper::name();
 
 
 2049template <
typename T, 
typename TCameraWrapper>
 
 2052    return TCameraWrapper::template clone<T>(width, height);
 
 
 2055template <
typename T, 
typename TCameraWrapper>
 
 2058    return TCameraWrapper::template clone<float>(width, height);
 
 
 2061template <
typename T, 
typename TCameraWrapper>
 
 2064    return TCameraWrapper::template clone<double>(width, height);
 
 
 2067template <
typename T, 
typename TCameraWrapper>
 
 2070    return TCameraWrapper::width();
 
 
 2073template <
typename T, 
typename TCameraWrapper>
 
 2076    return TCameraWrapper::height();
 
 
 2079template <
typename T, 
typename TCameraWrapper>
 
 2082    return TCameraWrapper::principalPoint();
 
 
 2085template <
typename T, 
typename TCameraWrapper>
 
 2088    return TCameraWrapper::principalPointX();
 
 
 2091template <
typename T, 
typename TCameraWrapper>
 
 2094    return TCameraWrapper::principalPointY();
 
 
 2097template <
typename T, 
typename TCameraWrapper>
 
 2100    return TCameraWrapper::focalLengthX();
 
 
 2103template <
typename T, 
typename TCameraWrapper>
 
 2106    return TCameraWrapper::focalLengthY();
 
 
 2109template <
typename T, 
typename TCameraWrapper>
 
 2112    return TCameraWrapper::inverseFocalLengthX();
 
 
 2115template <
typename T, 
typename TCameraWrapper>
 
 2118    return TCameraWrapper::inverseFocalLengthY();
 
 
 2121template <
typename T, 
typename TCameraWrapper>
 
 2124    return TCameraWrapper::fovX();
 
 
 2127template <
typename T, 
typename TCameraWrapper>
 
 2130    return TCameraWrapper::fovY();
 
 
 2133template <
typename T, 
typename TCameraWrapper>
 
 2136    return TCameraWrapper::isInside(imagePoint, signedBorder);
 
 
 2139template <
typename T, 
typename TCameraWrapper>
 
 2142    return TCameraWrapper::projectToImage(objectPoint);
 
 
 2145template <
typename T, 
typename TCameraWrapper>
 
 2148    return TCameraWrapper::projectToImage(world_T_camera, objectPoint);
 
 
 2151template <
typename T, 
typename TCameraWrapper>
 
 2154    return TCameraWrapper::projectToImageIF(objectPoint);
 
 
 2157template <
typename T, 
typename TCameraWrapper>
 
 2160    return TCameraWrapper::projectToImageIF(flippedCamera_T_world, objectPoint);
 
 
 2163template <
typename T, 
typename TCameraWrapper>
 
 2166    return TCameraWrapper::projectToImage(objectPoints, size, imagePoints);
 
 
 2169template <
typename T, 
typename TCameraWrapper>
 
 2172    return TCameraWrapper::projectToImage(world_T_camera, objectPoints, size, imagePoints);
 
 
 2175template <
typename T, 
typename TCameraWrapper>
 
 2178    return TCameraWrapper::projectToImageIF(objectPoints, size, imagePoints);
 
 
 2181template <
typename T, 
typename TCameraWrapper>
 
 2184    return TCameraWrapper::projectToImageIF(flippedCamera_T_world, objectPoints, size, imagePoints);
 
 
 2187template <
typename T, 
typename TCameraWrapper>
 
 2190    return TCameraWrapper::vector(distortedImagePoint, makeUnitVector);
 
 
 2193template <
typename T, 
typename TCameraWrapper>
 
 2196    return TCameraWrapper::vector(distortedImagePoints, size, vectors, makeUnitVector);
 
 
 2199template <
typename T, 
typename TCameraWrapper>
 
 2202    return TCameraWrapper::vectorIF(distortedImagePoint, makeUnitVector);
 
 
 2205template <
typename T, 
typename TCameraWrapper>
 
 2208    return TCameraWrapper::vectorIF(distortedImagePoints, size, vectors, makeUnitVector);
 
 
 2211template <
typename T, 
typename TCameraWrapper>
 
 2214    return TCameraWrapper::ray(distortedImagePoint, world_T_camera);
 
 
 2217template <
typename T, 
typename TCameraWrapper>
 
 2220    return TCameraWrapper::ray(distortedImagePoint);
 
 
 2223template <
typename T, 
typename TCameraWrapper>
 
 2226    return TCameraWrapper::pointJacobian2x3IF(flippedCameraObjectPoint, jx, jy);
 
 
 2229template <
typename T, 
typename TCameraWrapper>
 
 2232    return TCameraWrapper::pointJacobian2nx3IF(flippedCameraObjectPoints, numberObjectPoints, jacobians);
 
 
 2235template <
typename T, 
typename TCameraWrapper>
 
 2238    ocean_assert(eps >= T(0));
 
 2240    if (isValid() != anyCamera.
isValid())
 
 2252    if (name() != anyCamera.
name())
 
 
 2260template <
typename T, 
typename TCameraWrapper>
 
 2263    return TCameraWrapper::isValid();
 
 
 2266template <
typename T, 
typename TCameraWrapperBase>
 
 2273template <
typename T, 
typename TCameraWrapperBase>
 
 2280template <
typename T, 
typename TCameraWrapperBase>
 
 2283    return VectorT2<T>(TCameraWrapperBase::principalPointX(), TCameraWrapperBase::principalPointY());
 
 
 2286template <
typename T, 
typename TCameraWrapperBase>
 
 2289    ocean_assert(TCameraWrapperBase::isValid());
 
 2304    if (T(TCameraWrapperBase::width()) <= TCameraWrapperBase::principalPointX())
 
 2306        ocean_assert(
false && 
"Invalid principal point");
 
 2307        return T(2) * leftAngle;
 
 2310    const T rightAngle = 
NumericT<T>::atan((T(TCameraWrapperBase::width()) - TCameraWrapperBase::principalPointX()) * TCameraWrapperBase::inverseFocalLengthX());
 
 2312    return leftAngle + rightAngle;
 
 
 2315template <
typename T, 
typename TCameraWrapperBase>
 
 2318    ocean_assert(TCameraWrapperBase::isValid());
 
 2333    if (T(TCameraWrapperBase::height()) <= TCameraWrapperBase::principalPointY())
 
 2335        ocean_assert(
false && 
"Invalid principal point");
 
 2336        return T(2) * topAngle;
 
 2339    const T bottomAngle = 
NumericT<T>::atan((T(TCameraWrapperBase::height()) - TCameraWrapperBase::principalPointY()) * TCameraWrapperBase::inverseFocalLengthY());
 
 2341    return topAngle + bottomAngle;
 
 
 2344template <
typename T, 
typename TCameraWrapperBase>
 
 2347    ocean_assert(TCameraWrapperBase::isValid());
 
 2349    const unsigned int cameraWidth = TCameraWrapperBase::width();
 
 2350    const unsigned int cameraHeight = TCameraWrapperBase::height();
 
 2352    ocean_assert(signedBorder < T(std::min(cameraWidth / 2u, cameraHeight / 2u)));
 
 2354    return imagePoint.
x() >= signedBorder && imagePoint.
y() >= signedBorder
 
 2355            && imagePoint.
x() < T(cameraWidth) - signedBorder && imagePoint.
y() < T(cameraHeight) - signedBorder;
 
 
 2358template <
typename T, 
typename TCameraWrapperBase>
 
 2361    return TCameraWrapperBase::projectToImageIF(
VectorT3<T>(objectPoint.
x(), -objectPoint.
y(), -objectPoint.
z()));
 
 
 2364template <
typename T, 
typename TCameraWrapperBase>
 
 2370template <
typename T, 
typename TCameraWrapperBase>
 
 2373    ocean_assert(size == 0 || objectPoints != 
nullptr);
 
 2374    ocean_assert(size == 0 || imagePoints != 
nullptr);
 
 2376    for (
size_t n = 0; n < size; ++n)
 
 2379        imagePoints[n] = TCameraWrapperBase::projectToImageIF(
VectorT3<T>(objectPoint.
x(), -objectPoint.
y(), -objectPoint.
z()));
 
 
 2383template <
typename T, 
typename TCameraWrapperBase>
 
 2389template <
typename T, 
typename TCameraWrapperBase>
 
 2392    const VectorT3<T> localVectorIF(TCameraWrapperBase::vectorIF(distortedImagePoint, makeUnitVector));
 
 2394    return VectorT3<T>(localVectorIF.
x(), -localVectorIF.
y(), -localVectorIF.
z());
 
 
 2397template <
typename T, 
typename TCameraWrapperBase>
 
 2400    TCameraWrapperBase::vectorIF(distortedImagePoints, size, vectors, makeUnitVector);
 
 2402    for (
size_t n = 0; n < size; ++n)
 
 2406        vectors[n] = 
VectorT3<T>(localVectorIF.
x(), -localVectorIF.
y(), -localVectorIF.
z());
 
 
 2410template <
typename T, 
typename TCameraWrapperBase>
 
 2413    ocean_assert(TCameraWrapperBase::isValid() && world_T_camera.
isValid());
 
 
 2418template <
typename T, 
typename TCameraWrapperBase>
 
 2421    ocean_assert(TCameraWrapperBase::isValid());
 
 
 2426template <
typename T, 
typename TCameraWrapperBase>
 
 2429    ocean_assert(flippedCameraObjectPoints != 
nullptr);
 
 2430    ocean_assert(numberObjectPoints >= 1);
 
 2431    ocean_assert(jacobians != 
nullptr);
 
 2433    for (
size_t n = 0; n < numberObjectPoints; ++n)
 
 2435        TCameraWrapperBase::pointJacobian2x3IF(flippedCameraObjectPoints[n], jacobians + 0, jacobians + 3);
 
 
 2440template <
typename T>
 
 2442    actualCamera_(std::move(actualCamera))
 
 
 2447template <
typename T>
 
 2449    actualCamera_(actualCamera)
 
 
 2454template <
typename T>
 
 2457    return actualCamera_;
 
 
 2460template <
typename T>
 
 2463    return actualCamera_.width();
 
 
 2466template <
typename T>
 
 2469    return actualCamera_.height();
 
 
 2472template <
typename T>
 
 2475    return T(actualCamera_.principalPointX());
 
 
 2478template <
typename T>
 
 2481    return T(actualCamera_.principalPointY());
 
 
 2484template <
typename T>
 
 2487    return T(actualCamera_.focalLengthX());
 
 
 2490template <
typename T>
 
 2493    return T(actualCamera_.focalLengthY());
 
 
 2496template <
typename T>
 
 2499    return T(actualCamera_.inverseFocalLengthX());
 
 
 2502template <
typename T>
 
 2505    return T(actualCamera_.inverseFocalLengthY());
 
 
 2508template <
typename T>
 
 2514template <
typename T>
 
 2517    return VectorT2<T>(actualCamera_.template projectToImageIF<true>(flippedCamera_T_world, objectPoint, 
true));
 
 
 2520template <
typename T>
 
 2523    ocean_assert(size == 0 || objectPoints != 
nullptr);
 
 2524    ocean_assert(size == 0 || imagePoints != 
nullptr);
 
 2526    for (
size_t n = 0; n < size; ++n)
 
 2528        imagePoints[n] = projectToImageIF(objectPoints[n]);
 
 
 2532template <
typename T>
 
 2535    ocean_assert(size == 0 || objectPoints != 
nullptr);
 
 2536    ocean_assert(size == 0 || imagePoints != 
nullptr);
 
 2538    for (
size_t n = 0; n < size; ++n)
 
 2540        imagePoints[n] = projectToImageIF(flippedCamera_T_world, objectPoints[n]);
 
 
 2544template <
typename T>
 
 2547    const VectorT2<T> undistortedImagePoint(actualCamera_.template undistort<true>(distortedImagePoint));
 
 2549    return VectorT3<T>(actualCamera_.vectorIF(undistortedImagePoint, makeUnitVector));
 
 
 2552template <
typename T>
 
 2555    ocean_assert(distortedImagePoints != 
nullptr && size > 0);
 
 2556    ocean_assert(vectors != 
nullptr);
 
 2558    for (
size_t n = 0; n < size; ++n)
 
 2560        vectors[n] = vectorIF(distortedImagePoints[n], makeUnitVector);
 
 
 2564template <
typename T>
 
 2567    ocean_assert(jx != 
nullptr && jy != 
nullptr);
 
 2568    actualCamera_.template pointJacobian2x3IF<T, true>(flippedCameraObjectPoint, jx, jy);
 
 
 2571template <
typename T>
 
 2574    ocean_assert(eps >= T(0));
 
 2576    return actualCamera_.isEqual(basePinhole.
actualCamera_, eps);
 
 
 2579template <
typename T>
 
 2582    return actualCamera_.isValid();
 
 
 2585template <
typename T>
 
 2586template <
typename U>
 
 2589    ocean_assert(actualCamera_.isValid());
 
 2591    if constexpr (std::is_same<T, U>::value)
 
 2593        if ((width == 0u && height == 0u) || (width == actualCamera_.width() && height == actualCamera_.height()))
 
 2595            return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBasePinholeT<U>>>>(actualCamera_);
 
 2598        const unsigned int validWidth = (height * actualCamera_.width() + actualCamera_.height() / 2u) / actualCamera_.height();
 
 2599        const unsigned int validHeight = (width * actualCamera_.height() + actualCamera_.width() / 2u) / actualCamera_.width();
 
 2603            ocean_assert(
false && 
"Wrong aspect ratio!");
 
 2607        return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBasePinholeT<U>>>>(
PinholeCameraT<U>(width, height, actualCamera_));
 
 2613        if ((width == 0u && height == 0u) || (width == actualCamera_.width() && height == actualCamera_.height()))
 
 2615            return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBasePinholeT<U>>>>(convertedPinholeCamera);
 
 2618        const unsigned int validWidth = (height * actualCamera_.width() + actualCamera_.height() / 2u) / actualCamera_.height();
 
 2619        const unsigned int validHeight = (width * actualCamera_.height() + actualCamera_.width() / 2u) / actualCamera_.width();
 
 2623            ocean_assert(
false && 
"Wrong aspect ratio!");
 
 2627        return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBasePinholeT<U>>>>(
PinholeCameraT<U>(width, height, convertedPinholeCamera));
 
 
 2631template <
typename T>
 
 2637template <
typename T>
 
 2640    return std::string(
"Ocean Pinhole");
 
 
 2643template <
typename T>
 
 2645    actualCamera_(std::move(camera))
 
 
 2650template <
typename T>
 
 2652    actualCamera_(camera)
 
 
 2657template <
typename T>
 
 2660    return actualCamera_;
 
 
 2663template <
typename T>
 
 2666    return actualCamera_.width();
 
 
 2669template <
typename T>
 
 2672    return actualCamera_.height();
 
 
 2675template <
typename T>
 
 2678    return actualCamera_.principalPoint();
 
 
 2681template <
typename T>
 
 2684    return actualCamera_.principalPointX();
 
 
 2687template <
typename T>
 
 2690    return actualCamera_.principalPointY();
 
 
 2693template <
typename T>
 
 2696    return actualCamera_.focalLengthX();
 
 
 2699template <
typename T>
 
 2702    return actualCamera_.focalLengthY();
 
 
 2705template <
typename T>
 
 2708    return actualCamera_.inverseFocalLengthX();
 
 
 2711template <
typename T>
 
 2714    return actualCamera_.inverseFocalLengthY();
 
 
 2717template <
typename T>
 
 2720    return actualCamera_.projectToImageIF(objectPoint);
 
 
 2723template <
typename T>
 
 2726    return actualCamera_.projectToImageIF(flippedCamera_T_world, objectPoint);
 
 
 2729template <
typename T>
 
 2732    ocean_assert(size == 0 || objectPoints != 
nullptr);
 
 2733    ocean_assert(size == 0 || imagePoints != 
nullptr);
 
 2735    for (
size_t n = 0; n < size; ++n)
 
 2737        imagePoints[n] = projectToImageIF(objectPoints[n]);
 
 
 2741template <
typename T>
 
 2744    ocean_assert(size == 0 || objectPoints != 
nullptr);
 
 2745    ocean_assert(size == 0 || imagePoints != 
nullptr);
 
 2747    for (
size_t n = 0; n < size; ++n)
 
 2749        imagePoints[n] = projectToImageIF(flippedCamera_T_world, objectPoints[n]);
 
 
 2753template <
typename T>
 
 2756    return actualCamera_.vectorIF(distortedImagePoint, makeUnitVector);
 
 
 2759template <
typename T>
 
 2762    ocean_assert(distortedImagePoints != 
nullptr && size > 0);
 
 2763    ocean_assert(vectors != 
nullptr);
 
 2765    for (
size_t n = 0; n < size; ++n)
 
 2767        vectors[n] = vectorIF(distortedImagePoints[n], makeUnitVector);
 
 
 2771template <
typename T>
 
 2774    actualCamera_.pointJacobian2x3IF(flippedCameraObjectPoint, jx, jy);
 
 
 2777template <
typename T>
 
 2780    ocean_assert(eps >= T(0));
 
 2782    return actualCamera_.isEqual(baseFisheye.
actualCamera_, eps);
 
 
 2785template <
typename T>
 
 2788    return actualCamera_.isValid();
 
 
 2791template <
typename T>
 
 2792template <
typename U>
 
 2795    ocean_assert(actualCamera_.isValid());
 
 2797    if ((width == 0u && height == 0u) || (width == actualCamera_.width() && height == actualCamera_.height()))
 
 2799        return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBaseFisheyeT<U>>>>(
FisheyeCameraT<U>(actualCamera_));
 
 2802    const unsigned int validWidth = (height * actualCamera_.width() + actualCamera_.height() / 2u) / actualCamera_.height();
 
 2806        ocean_assert(
false && 
"Wrong aspect ratio!");
 
 2810    const T xFactor = T(width) / T(actualCamera_.width());
 
 2811    const T yFactor = T(height) / T(actualCamera_.height());
 
 2813    const U newPrincipalX = U(actualCamera_.principalPointX() * xFactor);
 
 2814    const U newPrincipalY = U(actualCamera_.principalPointY() * yFactor);
 
 2816    const U newFocalLengthX = U(actualCamera_.focalLengthX() * xFactor);
 
 2817    const U newFocalLengthY = U(actualCamera_.focalLengthY() * yFactor);
 
 2819    U radialDistortion[6];
 
 2820    for (
unsigned int n = 0u; n < 6u; ++n)
 
 2822        radialDistortion[n] = U(actualCamera_.radialDistortion()[n]);
 
 2825    const U tangentialDistortion[2] =
 
 2827        U(actualCamera_.tangentialDistortion()[0]),
 
 2828        U(actualCamera_.tangentialDistortion()[1])
 
 2831    return std::make_unique<AnyCameraWrappingT<U, CameraWrapperT<U, CameraWrapperBaseFisheyeT<U>>>>(
FisheyeCameraT<U>(width, height, newFocalLengthX, newFocalLengthY, newPrincipalX, newPrincipalY, radialDistortion, tangentialDistortion));
 
 
 2834template <
typename T>
 
 2840template <
typename T>
 
 2843    return std::string(
"Ocean Fisheye");
 
 
 2846template <
typename T>
 
 2848    actualCamera_(std::move(camera))
 
 
 2853template <
typename T>
 
 2855    actualCamera_(camera)
 
 
 2860template <
typename T>
 
 2863    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2865    ocean_assert(
false && 
"This function must never be called.");
 
 2867    return actualCamera_;
 
 
 2870template <
typename T>
 
 2873    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2875    ocean_assert(
false && 
"This function must never be called.");
 
 2877    return (
unsigned int)(-1);
 
 
 2880template <
typename T>
 
 2883    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2885    ocean_assert(
false && 
"This function must never be called.");
 
 2887    return (
unsigned int)(-1);
 
 
 2890template <
typename T>
 
 2893    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2895    ocean_assert(
false && 
"This function must never be called.");
 
 
 2900template <
typename T>
 
 2903    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2905    ocean_assert(
false && 
"This function must never be called.");
 
 
 2910template <
typename T>
 
 2913    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2915    ocean_assert(
false && 
"This function must never be called.");
 
 
 2920template <
typename T>
 
 2923    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2925    ocean_assert(
false && 
"This function must never be called.");
 
 
 2930template <
typename T>
 
 2933    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2935    ocean_assert(
false && 
"This function must never be called.");
 
 
 2940template <
typename T>
 
 2943    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2945    ocean_assert(
false && 
"This function must never be called.");
 
 
 2950template <
typename T>
 
 2953    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2955    ocean_assert(
false && 
"This function must never be called.");
 
 
 2960template <
typename T>
 
 2963    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2965    ocean_assert(
false && 
"This function must never be called.");
 
 
 2970template <
typename T>
 
 2973    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2975    ocean_assert(
false && 
"This function must never be called.");
 
 
 2980template <
typename T>
 
 2983    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2985    ocean_assert(
false && 
"This function must never be called.");
 
 
 2989template <
typename T>
 
 2992    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 2994    ocean_assert(
false && 
"This function must never be called.");
 
 
 2997template <
typename T>
 
 3000    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 3002    ocean_assert(
false && 
"This function must never be called.");
 
 
 3007template <
typename T>
 
 3010    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 3012    ocean_assert(
false && 
"This function must never be called.");
 
 
 3015template <
typename T>
 
 3018    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 3020    ocean_assert(
false && 
"This function must never be called.");
 
 
 3023template <
typename T>
 
 3026    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 3028    ocean_assert(
false && 
"This function must never be called.");
 
 
 3033template <
typename T>
 
 3039template <
typename T>
 
 3040template <
typename U>
 
 3043    Log::error() << 
"Invalid camera: " << actualCamera_.reason();
 
 3045    ocean_assert(
false && 
"This function must never be called.");
 
 
 3050template <
typename T>
 
 3056template <
typename T>
 
 3059    return std::string(
"Invalid camera");
 
 
 3062template <
typename T>
 
 3069template <
typename T>
 
This class implements the abstract base class for all AnyCamera objects.
Definition AnyCamera.h:130
 
virtual ~AnyCameraT()=default
Destructs the AnyCamera object.
 
virtual VectorT3< T > vector(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const =0
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
 
AnyCameraT(AnyCameraT< T > &&)=delete
Disabled move constructor.
 
virtual LineT3< T > ray(const VectorT2< T > &distortedImagePoint) const =0
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
 
virtual unsigned int width() const =0
Returns the width of the camera image.
 
virtual T focalLengthX() const =0
Returns the horizontal focal length parameter.
 
virtual VectorT2< T > projectToImage(const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > &objectPoint) const =0
Projects a 3D object point into the camera frame.
 
virtual void vectorIF(const VectorT2< T > *distortedImagePoints, const size_t size, VectorT3< T > *vectors, const bool makeUnitVector=true) const =0
Returns vectors starting at the camera's center and intersecting a given 2D points in the image.
 
virtual void projectToImage(const VectorT3< T > *objectPoints, const size_t size, VectorT2< T > *imagePoints) const =0
Projects several 3D object points into the camera frame at once.
 
virtual VectorT2< T > principalPoint() const =0
Returns the coordinate of the principal point of the camera image in the pixel domain.
 
virtual std::unique_ptr< AnyCameraT< double > > cloneToDouble(const unsigned int width=0u, const unsigned int height=0u) const =0
Returns a copy of this camera object with double precision.
 
virtual T inverseFocalLengthY() const =0
Returns the inverse vertical focal length parameter.
 
AnyCameraT & operator=(AnyCameraT &&)=delete
Disabled move operator.
 
virtual void projectToImageIF(const VectorT3< T > *objectPoints, const size_t size, VectorT2< T > *imagePoints) const =0
Projects several 3D object points into the camera frame at once.
 
virtual std::unique_ptr< AnyCameraT< T > > clone(const unsigned int width=0u, const unsigned int height=0u) const =0
Returns a copy of this camera object.
 
virtual T fovX() const =0
Returns the field of view in x direction of the camera.
 
virtual VectorT2< T > projectToImage(const VectorT3< T > &objectPoint) const =0
Projects a 3D object point into the camera frame.
 
virtual T inverseFocalLengthX() const =0
Returns the inverse horizontal focal length parameter.
 
virtual T focalLengthY() const =0
Returns the vertical focal length parameter.
 
virtual void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const =0
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
 
AnyCameraT & operator=(const AnyCameraT &)=delete
Disabled assign operator.
 
T TScalar
The scalar data type of this object.
Definition AnyCamera.h:134
 
virtual unsigned int height() const =0
Returns the height of the camera image.
 
virtual VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const =0
Projects a 3D object point into the camera frame.
 
virtual T fovY() const =0
Returns the field of view in x direction of the camera.
 
virtual T principalPointY() const =0
Returns the y-value of the principal point of the camera image in the pixel domain.
 
virtual void projectToImage(const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > *objectPoints, const size_t size, VectorT2< T > *imagePoints) const =0
Projects several 3D object points into the camera frame at once.
 
virtual bool isEqual(const AnyCameraT< T > &anyCamera, const T eps=NumericT< T >::eps()) const =0
Returns whether two camera objects are identical up to a given epsilon.
 
virtual VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const =0
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
 
virtual bool isValid() const =0
Returns whether this camera is valid.
 
virtual LineT3< T > ray(const VectorT2< T > &distortedImagePoint, const HomogenousMatrixT4< T > &world_T_camera) const =0
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
 
virtual VectorT2< T > projectToImageIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint) const =0
Projects a 3D object point into the camera frame.
 
virtual AnyCameraType anyCameraType() const =0
Returns the type of this camera.
 
AnyCameraT()=default
Protected default constructor.
 
virtual void vector(const VectorT2< T > *distortedImagePoints, const size_t size, VectorT3< T > *vectors, const bool makeUnitVector=true) const =0
Determines vectors starting at the camera's center and intersecting given 2D points in the image.
 
virtual void pointJacobian2nx3IF(const VectorT3< T > *flippedCameraObjectPoints, const size_t numberObjectPoints, T *jacobians) const =0
Calculates the 2n x 3 jacobian matrix for the 3D object point projection into the camera frame.
 
virtual std::string name() const =0
Returns the name of this camera.
 
AnyCameraT(const AnyCameraT< T > &anyCamera)=default
Protected copy constructor.
 
static std::shared_ptr< AnyCameraT< T > > convert(const std::shared_ptr< AnyCameraT< U > > &anyCamera)
Converts an AnyCamera object with arbitrary scalar type to another AnyCamera object with arbitrary sc...
Definition AnyCamera.h:2016
 
virtual std::unique_ptr< AnyCameraT< float > > cloneToFloat(const unsigned int width=0u, const unsigned int height=0u) const =0
Returns a copy of this camera object with float precision.
 
virtual void projectToImageIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > *objectPoints, const size_t size, VectorT2< T > *imagePoints) const =0
Projects several 3D object points into the camera frame at once.
 
virtual bool isInside(const VectorT2< T > &imagePoint, const T signedBorder=T(0)) const =0
Returns whether a given 2D image point lies inside the camera frame.
 
virtual T principalPointX() const =0
Returns the x-value of the principal point of the camera image in the pixel domain.
 
This class implements a specialized AnyCamera object wrapping the actual camera model.
Definition AnyCamera.h:608
 
VectorT2< T > principalPoint() const override
Returns the coordinate of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2080
 
void pointJacobian2nx3IF(const VectorT3< T > *flippedCameraObjectPoints, const size_t numberObjectPoints, T *jacobians) const override
Calculates the 2n x 3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:2230
 
VectorT2< T > projectToImage(const VectorT3< T > &objectPoint) const override
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2140
 
bool isEqual(const AnyCameraT< T > &anyCamera, const T eps=NumericT< T >::eps()) const override
Returns whether two camera objects are identical up to a given epsilon.
Definition AnyCamera.h:2236
 
unsigned int width() const override
Returns the width of the camera image.
Definition AnyCamera.h:2068
 
unsigned int height() const override
Returns the height of the camera image.
Definition AnyCamera.h:2074
 
std::unique_ptr< AnyCameraT< float > > cloneToFloat(const unsigned int width=0u, const unsigned int height=0u) const override
Returns a copy of this camera object with float precision.
Definition AnyCamera.h:2056
 
std::unique_ptr< AnyCameraT< T > > clone(const unsigned int width=0u, const unsigned int height=0u) const override
Returns a copy of this camera object.
Definition AnyCamera.h:2050
 
T focalLengthY() const override
Returns the vertical focal length parameter.
Definition AnyCamera.h:2104
 
bool isValid() const override
Returns whether this camera is valid.
Definition AnyCamera.h:2261
 
AnyCameraType anyCameraType() const override
Returns the type of this camera.
Definition AnyCamera.h:2038
 
T inverseFocalLengthX() const override
Returns the inverse horizontal focal length parameter.
Definition AnyCamera.h:2110
 
T principalPointY() const override
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2092
 
AnyCameraWrappingT(ActualCamera &&actualCamera)
Creates a new AnyCamera object wrapping the actual camera model.
Definition AnyCamera.h:2024
 
VectorT3< T > vector(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const override
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2188
 
VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const override
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2152
 
T TScalar
The scalar data type of this object.
Definition AnyCamera.h:612
 
T focalLengthX() const override
Returns the horizontal focal length parameter.
Definition AnyCamera.h:2098
 
T fovX() const override
Returns the field of view in x direction of the camera.
Definition AnyCamera.h:2122
 
bool isInside(const VectorT2< T > &imagePoint, const T signedBorder=T(0)) const override
Returns whether a given 2D image point lies inside the camera frame.
Definition AnyCamera.h:2134
 
std::string name() const override
Returns the name of this camera.
Definition AnyCamera.h:2044
 
LineT3< T > ray(const VectorT2< T > &distortedImagePoint, const HomogenousMatrixT4< T > &world_T_camera) const override
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2212
 
VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector=true) const override
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2200
 
typename TCameraWrapper::ActualCamera ActualCamera
The actual camera object wrapped by this class.
Definition AnyCamera.h:618
 
T principalPointX() const override
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2086
 
std::unique_ptr< AnyCameraT< double > > cloneToDouble(const unsigned int width=0u, const unsigned int height=0u) const override
Returns a copy of this camera object with double precision.
Definition AnyCamera.h:2062
 
void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const override
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:2224
 
T fovY() const override
Returns the field of view in x direction of the camera.
Definition AnyCamera.h:2128
 
T inverseFocalLengthY() const override
Returns the inverse vertical focal length parameter.
Definition AnyCamera.h:2116
 
This class implements a helper class allowing to check whether a 3D object point projects into the ca...
Definition AnyCamera.h:516
 
static bool isValidForPoint(const AnyCameraT< T > &camera, const VectorT2< T > &imagePoint, const T maximalReprojectionError=T(1), const unsigned int additionalChecksTowardsPrincipalPoint=3u)
Returns whether a given camera model is valid for a specified 2D image point in the camera image.
Definition AnyCamera.h:1948
 
const SharedAnyCameraT< T > & camera() const
Returns the camera model of this checker.
Definition AnyCamera.h:1747
 
static bool determineCameraBoundary(const AnyCameraT< T > &camera, FiniteLinesT2< T > &cameraBoundarySegments, const size_t segmentSteps)
Determines the camera boundary of a given camera model in normalized image coordinates.
Definition AnyCamera.h:1767
 
CameraProjectionCheckerT()=default
Default constructor creating an invalid object.
 
bool isValid() const
Returns whether this checker holds a valid camera model and is ready to be used.
Definition AnyCamera.h:1759
 
FiniteLinesT2< T > cameraBoundarySegments_
The 2D line segments defined in the camera's normalized image plane defining the camera's boundary,...
Definition AnyCamera.h:594
 
const FiniteLinesT2< T > & cameraBoundarySegments() const
Returns the 2D line segments defined in the camera's normalized image plane defining the camera's bou...
Definition AnyCamera.h:1753
 
SharedAnyCameraT< T > camera_
The actual camera model this checker is based on.
Definition AnyCamera.h:591
 
static bool isInside(const FiniteLinesT2< T > &cameraBoundarySegments, const VectorT2< T > &normalizedImagePoint)
Returns whether a given normalized image point lies inside the camera's boundary.
Definition AnyCamera.h:1901
 
bool projectToImageIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, VectorT2< T > *imagePoint=nullptr) const
Returns whether a 3D object point is located in front of the camera and projects into the camera imag...
Definition AnyCamera.h:1714
 
This class implements the base class for all cameras.
Definition Camera.h:54
 
This class implements the base wrapper around Ocean's fisheye camera profile.
Definition AnyCamera.h:1217
 
T principalPointX() const
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2682
 
T inverseFocalLengthX() const
Returns the inverse horizontal focal length parameter.
Definition AnyCamera.h:2706
 
ActualCamera actualCamera_
The actual fisheye camera object.
Definition AnyCamera.h:1380
 
unsigned int height() const
Returns the height of the camera image.
Definition AnyCamera.h:2670
 
void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:2772
 
unsigned int width() const
Returns the width of the camera image.
Definition AnyCamera.h:2664
 
bool isValid() const
Returns whether this camera is valid.
Definition AnyCamera.h:2786
 
FisheyeCameraT< T > ActualCamera
Definition of the actual camera object wrapped by this class.
Definition AnyCamera.h:1223
 
T inverseFocalLengthY() const
Returns the inverse vertical focal length parameter.
Definition AnyCamera.h:2712
 
static AnyCameraType anyCameraType()
Returns the type of this camera.
Definition AnyCamera.h:2835
 
VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector) const
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2754
 
const ActualCamera & actualCamera() const
Returns the actual camera object wrapped in this class.
Definition AnyCamera.h:2658
 
VectorT2< T > principalPoint() const
Returns the coordinate of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2676
 
T principalPointY() const
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2688
 
static std::string name()
Returns the name of this camera.
Definition AnyCamera.h:2841
 
T focalLengthX() const
Returns the horizontal focal length parameter.
Definition AnyCamera.h:2694
 
T focalLengthY() const
Returns the vertical focal length parameter.
Definition AnyCamera.h:2700
 
VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2718
 
CameraWrapperBaseFisheyeT(ActualCamera &&actualCamera)
Creates a new CameraWrapperBaseFisheyeT object wrapping the actual camera model.
Definition AnyCamera.h:2644
 
std::unique_ptr< AnyCameraT< U > > clone(const unsigned int width=0u, const unsigned int height=0u) const
Returns a copy of the actual camera object.
Definition AnyCamera.h:2793
 
bool isEqual(const CameraWrapperBaseFisheyeT< T > &baseFisheye, const T eps=NumericT< T >::eps()) const
Returns whether two camera objects are identical up to a given epsilon.
Definition AnyCamera.h:2778
 
This class implements the base wrapper around an invalid camera profile.
Definition AnyCamera.h:1440
 
bool isEqual(const CameraWrapperBaseInvalidT< T > &baseInvalid, const T eps=NumericT< T >::eps()) const
Returns whether two camera objects are identical up to a given epsilon.
Definition AnyCamera.h:3024
 
InvalidCameraT< T > ActualCamera
Definition of the actual camera object wrapped by this class.
Definition AnyCamera.h:1446
 
VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2961
 
CameraWrapperBaseInvalidT(ActualCamera &&actualCamera)
Creates a new CameraWrapperBaseInvalidT object wrapping the actual camera model.
Definition AnyCamera.h:2847
 
unsigned int height() const
Returns the height of the camera image.
Definition AnyCamera.h:2881
 
const ActualCamera & actualCamera() const
Returns the actual camera object wrapped in this class.
Definition AnyCamera.h:2861
 
static std::string name()
Returns the name of this camera.
Definition AnyCamera.h:3057
 
ActualCamera actualCamera_
The actual invalid camera.
Definition AnyCamera.h:1603
 
T principalPointX() const
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2901
 
VectorT2< T > principalPoint() const
Returns the coordinate of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2891
 
T inverseFocalLengthX() const
Returns the inverse horizontal focal length parameter.
Definition AnyCamera.h:2941
 
bool isValid() const
Returns whether this camera is valid.
Definition AnyCamera.h:3034
 
static AnyCameraType anyCameraType()
Returns the type of this camera.
Definition AnyCamera.h:3051
 
std::unique_ptr< AnyCameraT< U > > clone(const unsigned int width=0u, const unsigned int height=0u) const
Returns a copy of the actual camera object.
Definition AnyCamera.h:3041
 
T inverseFocalLengthY() const
Returns the inverse vertical focal length parameter.
Definition AnyCamera.h:2951
 
void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:3016
 
VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector) const
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2998
 
T focalLengthY() const
Returns the vertical focal length parameter.
Definition AnyCamera.h:2931
 
T principalPointY() const
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2911
 
T focalLengthX() const
Returns the horizontal focal length parameter.
Definition AnyCamera.h:2921
 
unsigned int width() const
Returns the width of the camera image.
Definition AnyCamera.h:2871
 
This class implements the base wrapper around Ocean's pinhole camera profile.
Definition AnyCamera.h:1048
 
T inverseFocalLengthX() const
Returns the inverse horizontal focal length parameter.
Definition AnyCamera.h:2497
 
void pointJacobian2x3IF(const VectorT3< T > &flippedCameraObjectPoint, T *jx, T *jy) const
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:2565
 
PinholeCameraT< T > ActualCamera
Definition of the actual camera object wrapped by this class.
Definition AnyCamera.h:1054
 
unsigned int height() const
Returns the height of the camera image.
Definition AnyCamera.h:2467
 
bool isValid() const
Returns whether this camera is valid.
Definition AnyCamera.h:2580
 
T principalPointY() const
Returns the y-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2479
 
T inverseFocalLengthY() const
Returns the inverse vertical focal length parameter.
Definition AnyCamera.h:2503
 
static std::string name()
Returns the name of this camera.
Definition AnyCamera.h:2638
 
ActualCamera actualCamera_
The actual pinhole camera.
Definition AnyCamera.h:1206
 
const ActualCamera & actualCamera() const
Returns the actual camera object wrapped in this class.
Definition AnyCamera.h:2455
 
unsigned int width() const
Returns the width of the camera image.
Definition AnyCamera.h:2461
 
CameraWrapperBasePinholeT(ActualCamera &&actualCamera)
Creates a new CameraWrapperBasePinholeT object wrapping the actual camera model.
Definition AnyCamera.h:2441
 
VectorT3< T > vectorIF(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector) const
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2545
 
VectorT2< T > projectToImageIF(const VectorT3< T > &objectPoint) const
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2509
 
static AnyCameraType anyCameraType()
Returns the type of this camera.
Definition AnyCamera.h:2632
 
T principalPointX() const
Returns the x-value of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2473
 
bool isEqual(const CameraWrapperBasePinholeT< T > &basePinhole, const T eps=NumericT< T >::eps()) const
Returns whether two camera objects are identical up to a given epsilon.
Definition AnyCamera.h:2572
 
std::unique_ptr< AnyCameraT< U > > clone(const unsigned int width=0u, const unsigned int height=0u) const
Returns a copy of the actual camera object.
Definition AnyCamera.h:2587
 
T focalLengthY() const
Returns the vertical focal length parameter.
Definition AnyCamera.h:2491
 
T focalLengthX() const
Returns the horizontal focal length parameter.
Definition AnyCamera.h:2485
 
This class implements a wrapper for an actual camera object.
Definition AnyCamera.h:939
 
LineT3< T > ray(const VectorT2< T > &distortedImagePoint, const HomogenousMatrixT4< T > &world_T_camera) const
Returns a ray starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2411
 
T fovY() const
Returns the field of view in x direction of the camera.
Definition AnyCamera.h:2316
 
T fovX() const
Returns the field of view in x direction of the camera.
Definition AnyCamera.h:2287
 
CameraWrapperT(ActualCamera &&actualCamera)
Creates a new CameraWrapperT object wrapping the actual camera model.
Definition AnyCamera.h:2267
 
VectorT3< T > vector(const VectorT2< T > &distortedImagePoint, const bool makeUnitVector) const
Returns a vector starting at the camera's center and intersecting a given 2D point in the image.
Definition AnyCamera.h:2390
 
void pointJacobian2nx3IF(const VectorT3< T > *flippedCameraObjectPoints, const size_t numberObjectPoints, T *jacobians) const
Calculates the 2x3 jacobian matrix for the 3D object point projection into the camera frame.
Definition AnyCamera.h:2427
 
bool isInside(const VectorT2< T > &imagePoint, const T signedBorder=T(0)) const
Returns whether a given 2D image point lies inside the camera frame.
Definition AnyCamera.h:2345
 
VectorT2< T > principalPoint() const
Returns the coordinate of the principal point of the camera image in the pixel domain.
Definition AnyCamera.h:2281
 
VectorT2< T > projectToImage(const VectorT3< T > &objectPoint) const
Projects a 3D object point into the camera frame.
Definition AnyCamera.h:2359
 
This class implements an finite line in 2D space.
Definition FiniteLine2.h:82
 
Class representing a fisheye camera.
Definition FisheyeCamera.h:106
 
This class implements a 4x4 homogeneous transformation matrix using floating point values with the pr...
Definition HomogenousMatrix4.h:110
 
SquareMatrixT3< T > rotationMatrix() const
Returns the rotation matrix of the transformation.
Definition HomogenousMatrix4.h:1493
 
VectorT3< T > translation() const
Returns the translation of the transformation.
Definition HomogenousMatrix4.h:1381
 
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition HomogenousMatrix4.h:1806
 
This class implements invalid camera profiles, e.g.
Definition AnyCamera.h:1390
 
const std::string & reason() const
Returns the reason of this invalid camera.
Definition AnyCamera.h:3070
 
std::string reason_
The reason why no valid camera is available.
Definition AnyCamera.h:1408
 
InvalidCameraT(const std::string &reason)
Creates an invalid camera.
Definition AnyCamera.h:3063
 
This class implements an infinite line in 3D space.
Definition Line3.h:68
 
static MessageObject error()
Returns the message for error messages.
Definition Messenger.h:1074
 
This class provides basic numeric functionalities.
Definition Numeric.h:57
 
static constexpr T minValue()
Returns the min scalar value.
Definition Numeric.h:3253
 
static T atan(const T value)
Returns the arctangent of a given value.
Definition Numeric.h:1616
 
static T abs(const T value)
Returns the absolute value of a given value.
Definition Numeric.h:1220
 
static bool isEqual(const T first, const T second)
Returns whether two values are equal up to a small epsilon.
Definition Numeric.h:2389
 
static constexpr T sqr(const T value)
Returns the square of a given value.
Definition Numeric.h:1495
 
Definition of a pinhole camera model.
Definition PinholeCamera.h:114
 
This class implements a vector with two elements.
Definition Vector2.h:96
 
const T & x() const noexcept
Returns the x value.
Definition Vector2.h:710
 
const T & y() const noexcept
Returns the y value.
Definition Vector2.h:722
 
bool isNull() const
Returns whether this vector is a null vector up to a small epsilon.
Definition Vector2.h:746
 
T sqrDistance(const VectorT2< T > &right) const
Returns the square distance between this 2D position and a second 2D position.
Definition Vector2.h:645
 
This class implements a vector with three elements.
Definition Vector3.h:97
 
const T & y() const noexcept
Returns the y value.
Definition Vector3.h:824
 
const T & x() const noexcept
Returns the x value.
Definition Vector3.h:812
 
VectorT2< T > xy() const noexcept
Returns the x and y component of the vector as new 2D vector.
Definition Vector3.h:848
 
static VectorT3< T > minValue()
Returns a 3D vector with all elements set to NumericT::minValue().
Definition Vector3.h:1059
 
const T & z() const noexcept
Returns the z value.
Definition Vector3.h:836
 
std::shared_ptr< AnyCameraD > SharedAnyCameraD
Definition of a shared pointer holding an AnyCamera object with double precision.
Definition AnyCamera.h:67
 
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:60
 
std::vector< FiniteLineT2< T > > FiniteLinesT2
Definition of a typename alias for vectors with FiniteLineT2 objects.
Definition FiniteLine2.h:50
 
std::vector< VectorT2< T > > VectorsT2
Definition of a typename alias for vectors with VectorT2 objects.
Definition Vector2.h:57
 
SharedAnyCamerasT< float > SharedAnyCamerasF
Definition of a vector holding AnyCameraF objects.
Definition AnyCamera.h:104
 
SharedAnyCamerasT< double > SharedAnyCamerasD
Definition of a vector holding AnyCameraD objects.
Definition AnyCamera.h:97
 
AnyCameraType
Definition of individual camera types.
Definition AnyCamera.h:111
 
std::shared_ptr< AnyCameraF > SharedAnyCameraF
Definition of a shared pointer holding an AnyCamera object with float precision.
Definition AnyCamera.h:74
 
std::vector< std::shared_ptr< AnyCameraT< T > > > SharedAnyCamerasT
Definition of a typename alias for vectors with shared AnyCameraT objects.
Definition AnyCamera.h:83
 
SharedAnyCamerasT< Scalar > SharedAnyCameras
Definition of a vector holding AnyCamera objects.
Definition AnyCamera.h:90
 
std::shared_ptr< AnyCameraT< T > > SharedAnyCameraT
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:53
 
@ FISHEYE
A fisheye camera.
 
@ PINHOLE
A pinhole camera.
 
@ INVALID
An invalid camera type.
 
The namespace covering the entire Ocean framework.
Definition Accessor.h:15