VectorToMagnitude2d
Computes amplitude and orientation of a 2D vector such as a gradient from its X and Y components.
Access to parameter description
For an introduction to gradient operations: Gradient Section.
VectorToMagnitude2d extracts the Euclidean norm, maximum component or orientation of a 2D vector from its X and Y components.
It is typically used to compute the magnitude of a 2D image gradient.
The results depend on the selected output mode.
See also
Access to parameter description
For an introduction to gradient operations: Gradient Section.
VectorToMagnitude2d extracts the Euclidean norm, maximum component or orientation of a 2D vector from its X and Y components.
It is typically used to compute the magnitude of a 2D image gradient.
The results depend on the selected output mode.
See also
Function Syntax
This function returns a VectorToMagnitude2dOutput structure containing outputAmplitudeImage and outputOrientationImage.
// Output structure of the vectorToMagnitude2d function. struct VectorToMagnitude2dOutput { /// The amplitude output image. std::shared_ptr< iolink::ImageView > outputAmplitudeImage; /// The orientation output image. std::shared_ptr< iolink::ImageView > outputOrientationImage; }; // Function prototype
VectorToMagnitude2dOutput vectorToMagnitude2d( std::shared_ptr< iolink::ImageView > inputImageX, std::shared_ptr< iolink::ImageView > inputImageY, VectorToMagnitude2d::OutputType outputType, std::shared_ptr< iolink::ImageView > outputAmplitudeImage = NULL, std::shared_ptr< iolink::ImageView > outputOrientationImage = NULL );
This function returns a tuple containing output_amplitude_image and output_orientation_image.
// Function prototype. vector_to_magnitude_2d( input_image_x, input_image_y, output_type = VectorToMagnitude2d.OutputType.AMPLITUDE_MAXIMUM, output_amplitude_image = None, output_orientation_image = None )
This function returns a VectorToMagnitude2dOutput structure containing outputAmplitudeImage and outputOrientationImage.
/// Output structure of the VectorToMagnitude2d function. public struct VectorToMagnitude2dOutput { /// The amplitude output image. public IOLink.ImageView outputAmplitudeImage; /// The orientation output image. public IOLink.ImageView outputOrientationImage; }; // Function prototype. public static VectorToMagnitude2dOutput VectorToMagnitude2d( IOLink.ImageView inputImageX, IOLink.ImageView inputImageY, VectorToMagnitude2d.OutputType outputType = ImageDev.VectorToMagnitude2d.OutputType.AMPLITUDE_MAXIMUM, IOLink.ImageView outputAmplitudeImage = null, IOLink.ImageView outputOrientationImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
inputImageX |
The X vector component input image. | Image | Grayscale or Multispectral | nullptr | |||||||
inputImageY |
The Y vector component input image. | Image | Grayscale or Multispectral | nullptr | |||||||
outputType |
The output mode.
|
Enumeration | AMPLITUDE_MAXIMUM | ||||||||
outputAmplitudeImage |
The amplitude output image. | Image | nullptr | ||||||||
outputOrientationImage |
The orientation output image. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
input_image_x |
The X vector component input image. | image | Grayscale or Multispectral | None | |||||||
input_image_y |
The Y vector component input image. | image | Grayscale or Multispectral | None | |||||||
output_type |
The output mode.
|
enumeration | AMPLITUDE_MAXIMUM | ||||||||
output_amplitude_image |
The amplitude output image. | image | None | ||||||||
output_orientation_image |
The orientation output image. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
inputImageX |
The X vector component input image. | Image | Grayscale or Multispectral | null | |||||||
inputImageY |
The Y vector component input image. | Image | Grayscale or Multispectral | null | |||||||
outputType |
The output mode.
|
Enumeration | AMPLITUDE_MAXIMUM | ||||||||
outputAmplitudeImage |
The amplitude output image. | Image | null | ||||||||
outputOrientationImage |
The orientation output image. | Image | null |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); VectorToMagnitude2d vectorToMagnitude2dAlgo; vectorToMagnitude2dAlgo.setInputImageX( polystyrene ); vectorToMagnitude2dAlgo.setInputImageY( polystyrene ); vectorToMagnitude2dAlgo.setOutputType( VectorToMagnitude2d::OutputType::AMPLITUDE_MAXIMUM ); vectorToMagnitude2dAlgo.execute(); std::cout << "outputAmplitudeImage:" << vectorToMagnitude2dAlgo.outputAmplitudeImage()->toString(); std::cout << "outputOrientationImage:" << vectorToMagnitude2dAlgo.outputOrientationImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) vector_to_magnitude_2d_algo = imagedev.VectorToMagnitude2d() vector_to_magnitude_2d_algo.input_image_x = polystyrene vector_to_magnitude_2d_algo.input_image_y = polystyrene vector_to_magnitude_2d_algo.output_type = imagedev.VectorToMagnitude2d.AMPLITUDE_MAXIMUM vector_to_magnitude_2d_algo.execute() print( "output_amplitude_image:", str( vector_to_magnitude_2d_algo.output_amplitude_image ) ) print( "output_orientation_image:", str( vector_to_magnitude_2d_algo.output_orientation_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); VectorToMagnitude2d vectorToMagnitude2dAlgo = new VectorToMagnitude2d { inputImageX = polystyrene, inputImageY = polystyrene, outputType = VectorToMagnitude2d.OutputType.AMPLITUDE_MAXIMUM }; vectorToMagnitude2dAlgo.Execute(); Console.WriteLine( "outputAmplitudeImage:" + vectorToMagnitude2dAlgo.outputAmplitudeImage.ToString() ); Console.WriteLine( "outputOrientationImage:" + vectorToMagnitude2dAlgo.outputOrientationImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = vectorToMagnitude2d( polystyrene, polystyrene, VectorToMagnitude2d::OutputType::AMPLITUDE_MAXIMUM ); std::cout << "outputAmplitudeImage:" << result.outputAmplitudeImage->toString(); std::cout << "outputOrientationImage:" << result.outputOrientationImage->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result_output_amplitude_image, result_output_orientation_image = imagedev.vector_to_magnitude_2d( polystyrene, polystyrene, imagedev.VectorToMagnitude2d.AMPLITUDE_MAXIMUM ) print( "output_amplitude_image:", str( result_output_amplitude_image ) ) print( "output_orientation_image:", str( result_output_orientation_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); Processing.VectorToMagnitude2dOutput result = Processing.VectorToMagnitude2d( polystyrene, polystyrene, VectorToMagnitude2d.OutputType.AMPLITUDE_MAXIMUM ); Console.WriteLine( "outputAmplitudeImage:" + result.outputAmplitudeImage.ToString() ); Console.WriteLine( "outputOrientationImage:" + result.outputOrientationImage.ToString() );