Skip to content

File ManagedImageUtilityStereo.h

File List > SpinnakerNET > ManagedImageUtilityStereo.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_MANAGED_IMAGE_UTILITY_STEREO_H
#define FLIR_SPINNAKER_MANAGED_IMAGE_UTILITY_STEREO_H

#include "ManagedCamera.h"
#include "ManagedImage.h"
#include "ManagedDefs.h"
#include "ManagedCameraDefs.h"
#include "ManagedPointCloud.h"
#include "ManagedScan3DParameters.h"
#include "Translate.h"
#include "SpinnakerPlatform.h"

using namespace ::System;
using namespace ::System::Runtime::InteropServices;

namespace SpinnakerNET
{


    public ref class ManagedImageUtilityStereo
    {
    public:
        static bool IsStereoCamera(IManagedCamera ^ pCamera);

        // PRIMARY: ProcessDisparity with ManagedScan3D
        static IManagedImage^ ProcessDisparity(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            DisparityProcessingMethod processingMethod,
            ManagedScan3DParameters^ scan3dParams);

        // LEGACY: ProcessDisparity with StereoCameraParameters
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static IManagedImage^ ProcessDisparity(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            DisparityProcessingMethod processingMethod,
            StereoCameraParameters^ stereoCameraParameters);

        // PRIMARY: ProcessDisparityFromImage with ManagedScan3D
        static void ProcessDisparityFromImage(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            DisparityProcessingMethod processingMethod,
            ManagedScan3DParameters^ scan3dParams);

        // LEGACY: ProcessDisparityFromImage with StereoCameraParameters
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static void ProcessDisparityFromImage(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            DisparityProcessingMethod processingMethod,
            StereoCameraParameters^ stereoCameraParameters);

        static IManagedImage^ FilterSpeckles(
            IManagedImage^ disparityImage,
            int maxSpeckleSize,
            float speckleThreshold,
            float disparityScaleFactor,
            float invalidDataValue);

        static void FilterSpecklesFromImage(
            IManagedImage^ disparityImage,
            int maxSpeckleSize,
            float speckleThreshold,
            float disparityScaleFactor,
            float invalidDataValue);

        static IManagedImage^ CreateGradientImage(
            IManagedImage^ rectifiedImage);

        static void CreateGradientImage(
            IManagedImage^ rectifiedImage,
            IManagedImage^ gradientImage);

        static IManagedImage^ EdgeInterpolation(
            IManagedImage^ disparityImage,
            float invalidDataValue, 
            IManagedImage^ gradientImage,
            float edgeThreshold,
            int maxDistance);

        static void EdgeInterpolationFromImage(
            IManagedImage^ disparityImage,
            float invalidDataValue, 
            IManagedImage^ gradientImage,
            float edgeThreshold,
            int maxDistance);

        static IManagedImage^ DomainTransform(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor,
            int numIterations);

        static IManagedImage^ DomainTransform(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor);

        static void DomainTransformFromImage(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor,
            int numIterations);

        static void DomainTransformFromImage(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor);

        // PRIMARY: Compute3DPointFromPixel with ManagedScan3D
        static bool Compute3DPointFromPixel(
            uint16_t disparity,
            ManagedScan3DParameters^ scan3dParams,
            Stereo3DPoint stereo3DPoint);

        // LEGACY: Compute3DPointFromPixel with StereoCameraParameters
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static bool Compute3DPointFromPixel(
            uint16_t disparity,
            StereoCameraParameters^ stereoCameraParameters,
            Stereo3DPoint stereo3DPoint);

        // PRIMARY: ComputePointCloud with ManagedScan3DParameters (return value)
        static ManagedPointCloud^ ComputePointCloud(
            IManagedImage^ disparityImage,
            IManagedImage^ referenceImage,
            PointCloudParameters^ pointCloudParameters,
            ManagedScan3DParameters^ scan3dParams);

        // LEGACY: ComputePointCloud with StereoCameraParameters (return value)
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static ManagedPointCloud^ ComputePointCloud(
            IManagedImage^ disparityImage,
            IManagedImage^ referenceImage,
            PointCloudParameters^ pointCloudParameters,
            StereoCameraParameters^ stereoCameraParameters);

        // PRIMARY: ComputePointCloud with ManagedScan3DParameters (in-place)
        static void ComputePointCloud(
            IManagedImage^ disparityImage,
            IManagedImage ^ referenceImage,
            PointCloudParameters^ pointCloudParameters,
            ManagedScan3DParameters^ scan3dParams,
            ManagedPointCloud^ pointCloud);

        // LEGACY: ComputePointCloud with StereoCameraParameters (in-place)
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static void ComputePointCloud(
            IManagedImage^ disparityImage,
            IManagedImage ^ referenceImage,
            PointCloudParameters^ pointCloudParameters,
            StereoCameraParameters^ stereoCameraParameters,
            ManagedPointCloud^ pointCloud);

        // PRIMARY: ComputeDistanceToPoint with ManagedScan3D
        static bool ComputeDistanceToPoint(
            IManagedImage^ disparityImage,
            ManagedScan3DParameters^ scan3dParams,
            ImagePixel^ imagePixel,
            float& distance);

        // LEGACY: ComputeDistanceToPoint with StereoCameraParameters
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static bool ComputeDistanceToPoint(
            IManagedImage^ disparityImage,
            StereoCameraParameters^ stereoCameraParameters,
            ImagePixel^ imagePixel,
            float& distance);

        // PRIMARY: ComputeDistanceBetweenPoints with ManagedScan3D
        static bool ComputeDistanceBetweenPoints(
            IManagedImage^ disparityImage,
            ManagedScan3DParameters^ scan3dParams,
            ImagePixel^ imagePixel1,
            ImagePixel^ ImagePixel2,
            float& distance);

        // LEGACY: ComputeDistanceBetweenPoints with StereoCameraParameters
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static bool ComputeDistanceBetweenPoints(
            IManagedImage^ disparityImage,
            StereoCameraParameters^ stereoCameraParameters,
            ImagePixel^ imagePixel1,
            ImagePixel^ ImagePixel2,
            float& distance);

        // PRIMARY: CreateDepthImage with ManagedScan3DParameters (return value)
        static IManagedImage^ CreateDepthImage(
            IManagedImage^ disparityImage,
            ManagedScan3DParameters^ scan3dParams,
            float& minDepthVal,
            float& maxDepthVal);

        // LEGACY: CreateDepthImage with StereoCameraParameters (return value)
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static IManagedImage^ CreateDepthImage(
            IManagedImage^ disparityImage,
            StereoCameraParameters^ stereoCameraParameters,
            uint16_t invalidDepthVal,
            float& minDepthVal,
            float& maxDepthVal);

        // PRIMARY: CreateDepthImage with ManagedScan3DParameters (in-place)
        static void CreateDepthImage(
            IManagedImage^ disparityImage,
            ManagedScan3DParameters^ scan3dParams,
            IManagedImage^ depthImage,
            float& minDepthVal,
            float& maxDepthVal);

        // LEGACY: CreateDepthImage with StereoCameraParameters (in-place)
        [System::ObsoleteAttribute("Use overload with ManagedScan3DParameters instead", false)]
        static void CreateDepthImage(
            IManagedImage^ disparityImage,
            StereoCameraParameters^ stereoCameraParameters,
            uint16_t invalidDepthVal,
            IManagedImage^ depthImage,
            float& minDepthVal,
            float& maxDepthVal);

        static IManagedImage^ JointBilateral(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor,
            int filterDiameter);

        static void JointBilateralFromImage(
            IManagedImage^ disparityImage,
            IManagedImage^ rectifiedImage,
            float sigmaSpatial,
            float sigmaColor,
            int filterDiameter);
    };

}

#endif // FLIR_SPINNAKER_MANAGED_IMAGE_UTILITY_H