Skip to content

File ManagedImageUtility.h

File List > SpinnakerNET > ManagedImageUtility.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 LIM   ITED 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_H
#define FLIR_SPINNAKER_MANAGED_IMAGE_UTILITY_H

#include "ManagedImage.h"
#include "ManagedDefs.h"
#include "ManagedCameraDefs.h"
#include "Translate.h"
#include "SpinnakerPlatform.h"

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

namespace SpinnakerNET
{


    public ref class ManagedImageUtility
    {
    public:

        enum class ImageScalingAlgorithm
        {
            /*
                * Uses copies of the nearest source pixels to compute a scaled image.
                * The scaling factor used with this algorithm will be rounded to the
                * nearest integer (upscaling) or inverse integer (downscaling).
                * eg. 1.3 will be rounded to 1 and 0.3 will be rounded to (1 / 3).
                */
            NEAREST_NEIGHBOR
        };

        enum class SourceDataRange
        {
            IMAGE_DATA_RANGE,
            ABSOLUTE_DATA_RANGE,
            IMAGE_MIN_ABSOLUTE_MAX,
            ABSOLUTE_MIN_IMAGE_MAX
        };

        static IManagedImage^ CreateScaled(IManagedImage^ srcImage, ImageScalingAlgorithm scalingAlg, double scalingFactor);
        static void CreateScaled(IManagedImage^ srcImage, ManagedImage^ destImage, ImageScalingAlgorithm scalingAlg, double scalingFactor);

        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, PixelFormatEnums destPixelFormat);
        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, PixelFormatEnums destPixelFormat, SourceDataRange srcDataRange);

        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, double min, double max);
        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, double min, double max, SourceDataRange srcDataRange);

        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, double min, double max, PixelFormatEnums destPixelFormat);
        static IManagedImage^ CreateNormalized(IManagedImage^ srcImage, double min, double max, PixelFormatEnums destPixelFormat, SourceDataRange srcDataRange);

        static void CreateNormalized(IManagedImage^ srcImage, IManagedImage^ destImage);
        static void CreateNormalized(IManagedImage^ srcImage, IManagedImage^ destImage, SourceDataRange srcDataRange);

        static void CreateNormalized(IManagedImage^ srcImage, IManagedImage^ destImage, double min, double max);
        static void CreateNormalized(IManagedImage^ srcImage, IManagedImage^ destImage, double min, double max, SourceDataRange srcDataRange);
    };

}

#endif // FLIR_SPINNAKER_MANAGED_IMAGE_UTILITY_H