Spinnaker SDK C++
4.3.0.189
 
 

 
Loading...
Searching...
No Matches
ImageUtilityStereo Class Reference

Static helper functions for stereo related computations. More...

#include <ImageUtilityStereo.h>

Static Public Member Functions

static bool IsStereoCamera (CameraPtr pCamera)
 Returns true if the camera is a stereo camera or false otherwise.
 
static ImagePtr ProcessDisparity (const ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const DisparityProcessingMethod processingMethod, const StereoCameraParameters &stereoCameraParameters)
 Post-process the disparity image by filling in holes and reducing noise using the specified disparity processing method.
 
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)
 Filters speckles from a copy of the input mono disparity image.
 
static void FilterSpecklesFromImage (ImagePtr &disparityImage, const int maxSpeckleSize, const float speckleThreshold, const float disparityScaleFactor, const float invalidDataValue)
 Filters speckles in-place on the input mono disparity image.
 
static ImagePtr CreateGradientImage (const ImagePtr &rectifiedImage)
 Creates an 8-bit gradient magnitude image from rectified image.
 
static void CreateGradientImage (const ImagePtr &rectifiedImage, ImagePtr &gradientImage)
 Creates an 8-bit gradient magnitude image from rectified image.
 
static ImagePtr EdgeInterpolation (const ImagePtr &disparityImage, const float invalidDataValue, const ImagePtr &gradientImage, const float edgeThreshold, const int maxDistance)
 Performs edge-aware interpolation on the input disparity image to fill in invalid pixels, using information from nearby valid pixels and edges.
 
static void EdgeInterpolationFromImage (ImagePtr &disparityImage, const float invalidDataValue, const ImagePtr &gradientImage, const float edgeThreshold, const int maxDistance)
 Performs edge-aware interpolation in-place on the input disparity image to fill in invalid pixels, using information from nearby valid pixels and edges.
 
static ImagePtr JointBilateral (const ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const float sigmaSpatial, const float sigmaColor, const int filterDiameter)
 Applies a joint bilateral filter on the input disparity image using the corresponding rectified image as a guide.
 
static void JointBilateralFromImage (ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const float sigmaSpatial, const float sigmaColor, const int filterDiameter)
 Applies a joint bilateral filter in-place on the input disparity image using the corresponding rectified image as a guide.
 
static ImagePtr DomainTransform (const ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const float sigmaSpatial, const float sigmaColor, const int numIterations=3)
 Applies a fast, edge-preserving filter on the input disparity image using the domain transform normalized convolution technique.
 
static void DomainTransformFromImage (ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const float sigmaSpatial, const float sigmaColor, const int numIterations=3)
 Applies a fast, edge-preserving filter in-place on the input disparity image using the domain transform normalized convolution technique.
 
static bool Compute3DPointFromPixel (const uint16_t disparity, const StereoCameraParameters &stereoCameraParameters, Stereo3DPoint &stereo3DPoint)
 Computes 3D point from disparity value.
 
static PointCloud ComputePointCloud (const ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const PointCloudParameters &pointCloudParameters, const StereoCameraParameters &stereoCameraParameters)
 Computes 3D point cloud from a stereo pair consisting of a disparity/rectified image using a stereo matching algorithm.
 
static void ComputePointCloud (const ImagePtr &disparityImage, const ImagePtr &rectifiedImage, const PointCloudParameters &pointCloudParameters, const StereoCameraParameters &stereoCameraParameters, PointCloud &pointCloud)
 Computes 3D point cloud from a stereo pair consisting of a disparity/rectified image using a stereo matching algorithm.
 
static bool ComputeDistanceToPoint (const ImagePtr &disparityImage, const StereoCameraParameters &stereoParam, const ImagePixel &imagePixel, float &distance)
 Computes the distance of a point to the camera world coordinates origin, from the disparity image.
 
static bool ComputeDistanceBetweenPoints (const ImagePtr &disparityImage, const StereoCameraParameters &stereoParam, const ImagePixel &imagePixel1, const ImagePixel &ImagePixel2, float &distance)
 Computes the distance between two points in the disparity image.
 
static ImagePtr CreateDepthImage (const ImagePtr &disparityImage, const StereoCameraParameters &stereoCameraParameters, const uint16_t invalidDepthVal, float &minDepthVal, float &maxDepthVal)
 Computes a depth image.
 
static void CreateDepthImage (const ImagePtr &disparityImage, const StereoCameraParameters &stereoCameraParameters, const uint16_t invalidDepthVal, ImagePtr &depthImage, float &minDepthVal, float &maxDepthVal)
 Computes a depth image.
 

Static Public Attributes

static uint16_t maxDepthThresholdInMm
 
static uint16_t maxDepthThresholdInMeter
 

Detailed Description

Static helper functions for stereo related computations.

Member Function Documentation

◆ Compute3DPointFromPixel()

static bool Compute3DPointFromPixel ( const uint16_t  disparity,
const StereoCameraParameters stereoCameraParameters,
Stereo3DPoint stereo3DPoint 
)
static

Computes 3D point from disparity value.

Parameters
disparityThe disparity value
stereoCameraParametersThe parameters for the stereo camera
stereo3DPointThe computed 3D point
See also
StereoCameraParameters
Returns
True if the function finished successfully, or false otherwise

◆ ComputeDistanceBetweenPoints()

static bool ComputeDistanceBetweenPoints ( const ImagePtr disparityImage,
const StereoCameraParameters stereoParam,
const ImagePixel imagePixel1,
const ImagePixel ImagePixel2,
float &  distance 
)
static

Computes the distance between two points in the disparity image.

Parameters
disparityImageThe disparity image
stereoParamThe stereo camera parameters
imagePixel1The first pixel in the image
imagePixel2The second pixel in the image
distanceThe distance between the two points
Returns
True if the function finished successfully, or false otherwise

◆ ComputeDistanceToPoint()

static bool ComputeDistanceToPoint ( const ImagePtr disparityImage,
const StereoCameraParameters stereoParam,
const ImagePixel imagePixel,
float &  distance 
)
static

Computes the distance of a point to the camera world coordinates origin, from the disparity image.

Parameters
disparityImageThe disparity image
stereoParamThe stereo camera parameters
imagePixelThe pixel in the image
distanceThe distance of the point to the camera world coordinates origin
Returns
True if the function finished successfully, or false otherwise.

◆ ComputePointCloud() [1/2]

static PointCloud ComputePointCloud ( const ImagePtr disparityImage,
const ImagePtr rectifiedImage,
const PointCloudParameters pointCloudParameters,
const StereoCameraParameters stereoCameraParameters 
)
static

Computes 3D point cloud from a stereo pair consisting of a disparity/rectified image using a stereo matching algorithm.

Parameters
disparityImageThe disparity image from a stereo pair consisting of a disparity/rectified image.
rectifiedImageThe rectified image from a stereo pair consisting of a disparity/rectified image.
pointCloudParametersThe parameters for computing the point cloud
stereoCameraParametersThe parameters for the stereo camera
See also
StereoCameraParameters
PointCloudParameters
Returns
A PointCloud object containing the computed point cloud
Examples
StereoAcquisition.cpp, and StereoAcquisition_QuickSpin.cpp.

◆ ComputePointCloud() [2/2]

static void ComputePointCloud ( const ImagePtr disparityImage,
const ImagePtr rectifiedImage,
const PointCloudParameters pointCloudParameters,
const StereoCameraParameters stereoCameraParameters,
PointCloud pointCloud 
)
static

Computes 3D point cloud from a stereo pair consisting of a disparity/rectified image using a stereo matching algorithm.

Parameters
disparityImageThe disparity image from a stereo pair consisting of a disparity/rectified image.
rectifiedImageThe rectified image from a stereo pair consisting of a disparity/rectified image.
pointCloudParametersThe parameters for computing the point cloud
stereoCameraParametersThe parameters for the stereo camera
pointCloudThe computed point cloud will be stored in this object
See also
StereoCameraParameters
PointCloudParameters

◆ CreateDepthImage() [1/2]

static ImagePtr CreateDepthImage ( const ImagePtr disparityImage,
const StereoCameraParameters stereoCameraParameters,
const uint16_t  invalidDepthVal,
float &  minDepthVal,
float &  maxDepthVal 
)
static

Computes a depth image.

A depth image reinterprets disparity data by mapping the disparity for each pixel to a depth (z) value based on the image focal length and baseline. The source image is required to carry disparity information.

Parameters
disparityImageThe source image from which to create the depth values
invalidDepthValvalue to mark invalid pixels, where the depth should not be computed for
minDepthValThe actual minimum depth in the image
maxDepthValThe actual maximum depth in the image
Returns
The depth image

◆ CreateDepthImage() [2/2]

static void CreateDepthImage ( const ImagePtr disparityImage,
const StereoCameraParameters stereoCameraParameters,
const uint16_t  invalidDepthVal,
ImagePtr depthImage,
float &  minDepthVal,
float &  maxDepthVal 
)
static

Computes a depth image.

A depth image reinterprets disparity data by mapping the disparity for each pixel to a depth (z) value based on the image focal length and baseline. The source image is required to carry disparity information. The destination is required to be initialized with Mono16 pixel format, and have the same width, height, x offset, and y offset as the source image.

Parameters
disparityImageThe source image from which to create the depth values
stereoCameraParametersThe stereo camera parameters
invalidDepthValvalue to mark invalid pixels, where the depth should not be computed for
depthImageThe destination image in which to store the created depth values
minDepthValThe actual minimum depth in the image
maxDepthValThe actual maximum depth in the image

◆ CreateGradientImage() [1/2]

static ImagePtr CreateGradientImage ( const ImagePtr rectifiedImage)
static

Creates an 8-bit gradient magnitude image from rectified image.

The gradient magnitude is computed by converting rectified image to a grayscale image and applying Sobel filters in the X and Y direction.

Parameters
rectifiedImageRectified image
Returns
Gradient magnitude image

◆ CreateGradientImage() [2/2]

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

Creates an 8-bit gradient magnitude image from rectified image.

The gradient magnitude is computed by converting rectified image to a grayscale image and applying Sobel filters in the X and Y direction. Resulting gradient data is stored in the provided gradientImage object.

Parameters
rectifiedImageRectified image
gradientImageThe image where the gradient data will be stored

◆ DomainTransform()

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

Applies a fast, edge-preserving filter on the input disparity image using the domain transform normalized convolution technique.

The filter uses a joint image to guide smoothing, preserving edges present in the guide while smoothing the target image. Note that only Mono16 pixel format disparity image is supported.

Parameters
disparityImageThe disparity image (Mono16)
rectifiedImageThe rectified image
sigmaSpatialThe spatial standard deviation for the filter
sigmaColorThe color standard deviation for the filter
numIterationsThe number of iterations to perform (default is 3)
Returns
Filtered disparity image

◆ DomainTransformFromImage()

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

Applies a fast, edge-preserving filter in-place on the input disparity image using the domain transform normalized convolution technique.

The filter uses a joint image to guide smoothing, preserving edges present in the guide while smoothing the target image. Note that only Mono16 pixel format disparity image is supported.

Parameters
disparityImageThe disparity image (Mono16)
rectifiedImageThe rectified image
sigmaSpatialThe spatial standard deviation for the filter
sigmaColorThe color standard deviation for the filter
numIterationsThe number of iterations to perform (default is 3)

◆ EdgeInterpolation()

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

Performs edge-aware interpolation on the input disparity image to fill in invalid pixels, using information from nearby valid pixels and edges.

Note that only Mono16 pixel format disparity image is supported.

See also
CreateGradientImage
Parameters
disparityImageThe disparity image (Mono16)
invalidDataValueThe value assigned to invalid data
gradientImageThe gradient magnitude image (Mono8)
edgeThresholdThe threshold for edge detection
maxDistanceThe maximum distance to search for valid pixels
Returns
Edge-aware interpolated image

◆ EdgeInterpolationFromImage()

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

Performs edge-aware interpolation in-place on the input disparity image to fill in invalid pixels, using information from nearby valid pixels and edges.

Note that only Mono16 pixel format disparity image is supported.

See also
CreateGradientImage
Parameters
disparityImageThe disparity image (Mono16)
invalidDataValueThe value assigned to invalid data
gradientImageThe gradient magnitude image (Mono8)
edgeThresholdThe threshold for edge detection
maxDistanceThe maximum distance to search for valid pixels

◆ FilterSpeckles()

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

Filters speckles from a copy of the input mono disparity image.

Note that only Mono16 pixel format image is supported.

Parameters
disparityImageThe disparity image
maxSpeckleSizeThe maximum allowed speckle size
speckleThresholdThe speckle size threshold
disparityScaleFactorThe coordinate scale factor
invalidDataValueThe value assigned to invalid data
Returns
Speckle filtered image

◆ FilterSpecklesFromImage()

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

Filters speckles in-place on the input mono disparity image.

Note that only Mono16 pixel format image is supported.

Parameters
disparityImageThe disparity image
maxSpeckleSizeThe maximum allowed speckle size
speckleThresholdThe speckle size threshold
disparityScaleFactorThe coordinate scale factor
invalidDataValueThe value assigned to invalid data

◆ IsStereoCamera()

static bool IsStereoCamera ( CameraPtr  pCamera)
static

Returns true if the camera is a stereo camera or false otherwise.

Parameters
pCameraThe camera
Returns
True if the camera is stereo camera, or false otherwise

◆ JointBilateral()

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

Applies a joint bilateral filter on the input disparity image using the corresponding rectified image as a guide.

This edge-preserving filter smooths the disparity image while maintaining sharp edges aligned with the guide image. The filter uses both spatial and color information to determine the influence of neighboring pixels. Only Mono16 pixel format disparity images are supported.

Parameters
disparityImageThe disparity image to be filtered (Mono16)
rectifiedImageThe rectified image used as the guide for edge preservation
sigmaSpatialThe spatial standard deviation for the filter kernel
sigmaColorThe color standard deviation for the filter kernel
filterDiameterThe diameter of the filter kernel
Returns
Joint bilateral filtered image

◆ JointBilateralFromImage()

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

Applies a joint bilateral filter in-place on the input disparity image using the corresponding rectified image as a guide.

This edge-preserving filter smooths the disparity image while maintaining sharp edges aligned with the guide image. The filter uses both spatial and color information to determine the influence of neighboring pixels. Only Mono16 pixel format disparity images are supported.

Parameters
disparityImageThe disparity image to be filtered (Mono16)
rectifiedImageThe rectified image used as the guide for edge preservation
sigmaSpatialThe spatial standard deviation for the filter kernel
sigmaColorThe color standard deviation for the filter kernel
filterDiameterThe diameter of the filter kernel

◆ ProcessDisparity()

static ImagePtr ProcessDisparity ( const ImagePtr disparityImage,
const ImagePtr rectifiedImage,
const DisparityProcessingMethod  processingMethod,
const StereoCameraParameters stereoCameraParameters 
)
static

Post-process the disparity image by filling in holes and reducing noise using the specified disparity processing method.

The disparity image is expected to be a Mono16 pixel format image.

Parameters
disparityImageThe disparity image to fill
rectifiedImageThe rectified image used for filling
processingMethodThe method to use for post processing the disparity image
Returns
Post-processed disparity image

◆ ProcessDisparityFromImage()

static void ProcessDisparityFromImage ( ImagePtr disparityImage,
const ImagePtr rectifiedImage,
const DisparityProcessingMethod  processingMethod,
const StereoCameraParameters stereoCameraParameters 
)
static

Member Data Documentation

◆ maxDepthThresholdInMeter

uint16_t maxDepthThresholdInMeter
static

◆ maxDepthThresholdInMm

uint16_t maxDepthThresholdInMm
static

The documentation for this class was generated from the following file: