RadialGradientCentered2d
Performs a two-dimensional gradient projection with a directional vector defined by a center point.
Access to parameter description
For an introduction:
Notices:
See also
Access to parameter description
For an introduction:
- section Edge Detection
- section Introduction to Gradient
- section Gradient Projections
Notices:
- A common way to get input images $G_x$ and $G_y$ is to apply the Canny-Deriche operator in the X and Y directions, using GradientOperator2d with a spread of 60.
- The projected resulting gradient image shown above is the Normal Gradient. Simultaneously, the tangential gradient could be computed with the ProjectionMode option GRADIENT_NORMAL_TANGENTIAL.
See also
Function Syntax
This function returns a RadialGradientCentered2dOutput structure containing the outputNormalImage and outputTangentImage output parameters.
// Output structure.
struct RadialGradientCentered2dOutput
{
std::shared_ptr< iolink::ImageView > outputNormalImage;
std::shared_ptr< iolink::ImageView > outputTangentImage;
};
// Function prototype.
RadialGradientCentered2dOutput
radialGradientCentered2d( std::shared_ptr< iolink::ImageView > inputImageX,
std::shared_ptr< iolink::ImageView > inputImageY,
iolink::Vector2i32 projectionCenter,
RadialGradientCentered2d::ProjectionMode projectionMode,
std::shared_ptr< iolink::ImageView > outputNormalImage = NULL,
std::shared_ptr< iolink::ImageView > outputTangentImage = NULL );
This function returns a tuple containing the output_normal_image and output_tangent_image output parameters.
// Function prototype.
radial_gradient_centered_2d( input_image_x,
input_image_y,
projection_center = [1, 1],
projection_mode = RadialGradientCentered2d.ProjectionMode.GRADIENT_NORMAL,
output_normal_image = None,
output_tangent_image = None )
This function returns a RadialGradientCentered2dOutput structure containing the outputNormalImage and outputTangentImage output parameters.
/// Output structure of the RadialGradientCentered2d function.
public struct RadialGradientCentered2dOutput
{
public IOLink.ImageView outputNormalImage;
public IOLink.ImageView outputTangentImage;
};
// Function prototype.
public static RadialGradientCentered2dOutput
RadialGradientCentered2d( IOLink.ImageView inputImageX,
IOLink.ImageView inputImageY,
int[] projectionCenter = null,
RadialGradientCentered2d.ProjectionMode projectionMode = ImageDev.RadialGradientCentered2d.ProjectionMode.GRADIENT_NORMAL,
IOLink.ImageView outputNormalImage = null,
IOLink.ImageView outputTangentImage = null );
Class Syntax
Parameters
| Class Name | RadialGradientCentered2d |
|---|
| Parameter Name | Description | Type | Supported Values | Default Value | |||||
|---|---|---|---|---|---|---|---|---|---|
![]() |
inputImageX |
The X-gradient input image. | Image | Grayscale or Multispectral | nullptr | ||||
![]() |
inputImageY |
The Y-gradient input image. | Image | Grayscale or Multispectral | nullptr | ||||
![]() |
projectionCenter |
The center of projection coordinates. | Vector2i32 | >=0 | {1, 1} | ||||
![]() |
projectionMode |
The output images to be computed.
|
Enumeration | GRADIENT_NORMAL | |||||
![]() |
outputNormalImage |
The normal gradient output image. | Image | nullptr | |||||
![]() |
outputTangentImage |
The tangent gradient output image. | Image | nullptr | |||||
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
RadialGradientCentered2d radialGradientCentered2dAlgo;
radialGradientCentered2dAlgo.setInputImageX( polystyrene );
radialGradientCentered2dAlgo.setInputImageY( polystyrene );
radialGradientCentered2dAlgo.setProjectionCenter( {1, 1} );
radialGradientCentered2dAlgo.setProjectionMode( RadialGradientCentered2d::ProjectionMode::GRADIENT_NORMAL );
radialGradientCentered2dAlgo.execute();
std::cout << "outputNormalImage:" << radialGradientCentered2dAlgo.outputNormalImage()->toString();
std::cout << "outputTangentImage:" << radialGradientCentered2dAlgo.outputTangentImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
radial_gradient_centered_2d_algo = imagedev.RadialGradientCentered2d()
radial_gradient_centered_2d_algo.input_image_x = polystyrene
radial_gradient_centered_2d_algo.input_image_y = polystyrene
radial_gradient_centered_2d_algo.projection_center = [1, 1]
radial_gradient_centered_2d_algo.projection_mode = imagedev.RadialGradientCentered2d.GRADIENT_NORMAL
radial_gradient_centered_2d_algo.execute()
print( "output_normal_image:", str( radial_gradient_centered_2d_algo.output_normal_image ) );
print( "output_tangent_image:", str( radial_gradient_centered_2d_algo.output_tangent_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
RadialGradientCentered2d radialGradientCentered2dAlgo = new RadialGradientCentered2d
{
inputImageX = polystyrene,
inputImageY = polystyrene,
projectionCenter = new int[]{1, 1},
projectionMode = RadialGradientCentered2d.ProjectionMode.GRADIENT_NORMAL
};
radialGradientCentered2dAlgo.Execute();
Console.WriteLine( "outputNormalImage:" + radialGradientCentered2dAlgo.outputNormalImage.ToString() );
Console.WriteLine( "outputTangentImage:" + radialGradientCentered2dAlgo.outputTangentImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto result = radialGradientCentered2d( polystyrene, polystyrene, {1, 1}, RadialGradientCentered2d::ProjectionMode::GRADIENT_NORMAL );
std::cout << "outputNormalImage:" << result.outputNormalImage->toString();
std::cout << "outputTangentImage:" << result.outputTangentImage->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
result_output_normal_image, result_output_tangent_image = imagedev.radial_gradient_centered_2d( polystyrene, polystyrene, [1, 1], imagedev.RadialGradientCentered2d.GRADIENT_NORMAL )
print( "output_normal_image:", str( result_output_normal_image ) );
print( "output_tangent_image:", str( result_output_tangent_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
Processing.RadialGradientCentered2dOutput result = Processing.RadialGradientCentered2d( polystyrene, polystyrene, new int[]{1, 1}, RadialGradientCentered2d.ProjectionMode.GRADIENT_NORMAL );
Console.WriteLine( "outputNormalImage:" + result.outputNormalImage.ToString() );
Console.WriteLine( "outputTangentImage:" + result.outputTangentImage.ToString() );

