Skip to content

File ImageUtilityStereo.h

File List > include > ImageUtilityStereo.h

Go to the documentation of this file

//=============================================================================
// Copyright (c) 2026 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR).
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================

#ifndef FLIR_SPINNAKER_IMAGE_UTILITY_STEREO_H
#define FLIR_SPINNAKER_IMAGE_UTILITY_STEREO_H

#include "SpinnakerPlatform.h"
#include "SpinnakerDefs.h"
#include "PointCloud.h"
#include "CameraDefs.h"
#include "Image.h"
#include "ImagePtr.h"
#include "CameraPtr.h"
#include "Scan3DParameters.h"

namespace Spinnaker
{
    class SPINNAKER_API ImageUtilityStereo
    {
      public:
        static bool IsStereoCamera(CameraPtr pCamera);

        static ImagePtr ProcessDisparity(
            const ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const DisparityProcessingMethod processingMethod,
            const Scan3DParameters& scan3dParams);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static ImagePtr ProcessDisparity(
                            const ImagePtr& disparityImage,
                            const ImagePtr& rectifiedImage,
                            const DisparityProcessingMethod processingMethod,
                            const StereoCameraParameters& stereoCameraParameters);)

        static void ProcessDisparityFromImage(
            ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const DisparityProcessingMethod processingMethod,
            const Scan3DParameters& scan3dParams);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static void ProcessDisparityFromImage(
                            ImagePtr& disparityImage,
                            const ImagePtr& rectifiedImage,
                            const DisparityProcessingMethod processingMethod,
                            const StereoCameraParameters& stereoCameraParameters);)

        static ImagePtr FilterSpeckles(
            const ImagePtr& disparityImage,
            const int maxSpeckleSize,
            const float speckleThreshold,
            const float disparityScaleFactor,
            const float invalidDataValue);

        static void FilterSpecklesFromImage(
            ImagePtr& disparityImage,
            const int maxSpeckleSize,
            const float speckleThreshold,
            const float disparityScaleFactor,
            const float invalidDataValue);

        static ImagePtr CreateGradientImage(const ImagePtr& rectifiedImage);

        static void CreateGradientImage(const ImagePtr& rectifiedImage, ImagePtr& gradientImage);

        static ImagePtr EdgeInterpolation(
            const ImagePtr& disparityImage,
            const float invalidDataValue,
            const ImagePtr& gradientImage,
            const float edgeThreshold,
            const int maxDistance);

        static void EdgeInterpolationFromImage(
            ImagePtr& disparityImage,
            const float invalidDataValue,
            const ImagePtr& gradientImage,
            const float edgeThreshold,
            const int maxDistance);

        static ImagePtr JointBilateral(
            const ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const float sigmaSpatial,
            const float sigmaColor,
            const int filterDiameter);

        static void JointBilateralFromImage(
            ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const float sigmaSpatial,
            const float sigmaColor,
            const int filterDiameter);

        static ImagePtr DomainTransform(
            const ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const float sigmaSpatial,
            const float sigmaColor,
            const int numIterations = 3);

        static void DomainTransformFromImage(
            ImagePtr& disparityImage,
            const ImagePtr& rectifiedImage,
            const float sigmaSpatial,
            const float sigmaColor,
            const int numIterations = 3);

        static bool Compute3DPointFromPixel(
            const uint16_t disparity,
            const Scan3DParameters& scan3dParams,
            Stereo3DPoint& stereo3DPoint);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static bool Compute3DPointFromPixel(
                            const uint16_t disparity,
                            const StereoCameraParameters& stereoCameraParameters,
                            Stereo3DPoint& stereo3DPoint);)

        static PointCloud ComputePointCloud(
            const ImagePtr& rangeImage,
            const ImagePtr& intensityImage,
            const PointCloudParameters& pointCloudParameters,
            const Scan3DParameters& scan3dParams);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static PointCloud ComputePointCloud(
                            const ImagePtr& rangeImage,
                            const ImagePtr& intensityImage,
                            const PointCloudParameters& pointCloudParameters,
                            const StereoCameraParameters& stereoCameraParameters);)

        static void ComputePointCloud(
            const ImagePtr& rangeImage,
            const ImagePtr& intensityImage,
            const PointCloudParameters& pointCloudParameters,
            const Scan3DParameters& scan3dParams,
            PointCloud& pointCloud);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static void ComputePointCloud(
                            const ImagePtr& rangeImage,
                            const ImagePtr& intensityImage,
                            const PointCloudParameters& pointCloudParameters,
                            const StereoCameraParameters& stereoCameraParameters,
                            PointCloud& pointCloud);)

        static bool ComputeDistanceToPoint(
            const ImagePtr& rangeImage,
            const Scan3DParameters& scan3dParams,
            const ImagePixel& imagePixel,
            float& distance);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static bool ComputeDistanceToPoint(
                            const ImagePtr& rangeImage,
                            const StereoCameraParameters& stereoParam,
                            const ImagePixel& imagePixel,
                            float& distance);)

        static bool ComputeDistanceBetweenPoints(
            const ImagePtr& rangeImage,
            const Scan3DParameters& scan3dParams,
            const ImagePixel& imagePixel1,
            const ImagePixel& imagePixel2,
            float& distance);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static bool ComputeDistanceBetweenPoints(
                            const ImagePtr& rangeImage,
                            const StereoCameraParameters& stereoParam,
                            const ImagePixel& imagePixel1,
                            const ImagePixel& ImagePixel2,
                            float& distance);)

        static ImagePtr CreateDepthImage(
            const ImagePtr& rangeImage,
            const Scan3DParameters& scan3dParams,
            float& minDepthVal,
            float& maxDepthVal);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static ImagePtr CreateDepthImage(
                            const ImagePtr& rangeImage,
                            const StereoCameraParameters& stereoCameraParameters,
                            const uint16_t invalidDepthVal,
                            float& minDepthVal,
                            float& maxDepthVal);)

        static void CreateDepthImage(
            const ImagePtr& rangeImage,
            const Scan3DParameters& scan3dParams,
            ImagePtr& depthImage,
            float& minDepthVal,
            float& maxDepthVal);

        DEPRECATED_FUNC("Use Scan3DParameters instead of StereoCameraParameters",
                        static void CreateDepthImage(
                            const ImagePtr& rangeImage,
                            const StereoCameraParameters& stereoCameraParameters,
                            const uint16_t invalidDepthVal,
                            ImagePtr& depthImage,
                            float& minDepthVal,
                            float& maxDepthVal);)

        static uint16_t maxDepthThresholdInMm;

        static uint16_t maxDepthThresholdInMeter;
    };

} // namespace Spinnaker

#endif // FLIR_SPINNAKER_IMAGE_UTILITY_STEREO_H