RadialGradientContour2d
Performs a two-dimensional gradient projection with a directional vector defined by a set of contour points of a binary image.
Access to parameter description
For an introduction:
Notices:
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.
Function Syntax
This function returns a RadialGradientContour2dOutput structure containing outputNormalImage and outputTangentImage.
// Output structure of the radialGradientContour2d function. struct RadialGradientContour2dOutput { /// The normal gradient output image. std::shared_ptr< iolink::ImageView > outputNormalImage; /// The tangent gradient output image. std::shared_ptr< iolink::ImageView > outputTangentImage; }; // Function prototype
RadialGradientContour2dOutput radialGradientContour2d( std::shared_ptr< iolink::ImageView > inputImageX, std::shared_ptr< iolink::ImageView > inputImageY, std::shared_ptr< iolink::ImageView > inputMarkerImage, RadialGradientContour2d::ProjectionMode projectionMode, std::shared_ptr< iolink::ImageView > outputNormalImage = NULL, std::shared_ptr< iolink::ImageView > outputTangentImage = NULL );
This function returns a tuple containing output_normal_image and output_tangent_image.
// Function prototype. radial_gradient_contour_2d( input_image_x, input_image_y, input_marker_image, projection_mode = RadialGradientContour2d.ProjectionMode.GRADIENT_NORMAL, output_normal_image = None, output_tangent_image = None )
This function returns a RadialGradientContour2dOutput structure containing outputNormalImage and outputTangentImage.
/// Output structure of the RadialGradientContour2d function. public struct RadialGradientContour2dOutput { /// The normal gradient output image. public IOLink.ImageView outputNormalImage; /// The tangent gradient output image. public IOLink.ImageView outputTangentImage; }; // Function prototype. public static RadialGradientContour2dOutput RadialGradientContour2d( IOLink.ImageView inputImageX, IOLink.ImageView inputImageY, IOLink.ImageView inputMarkerImage, RadialGradientContour2d.ProjectionMode projectionMode = ImageDev.RadialGradientContour2d.ProjectionMode.GRADIENT_NORMAL, IOLink.ImageView outputNormalImage = null, IOLink.ImageView outputTangentImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImageX |
The X-gradient input image. | Image | Grayscale | nullptr | |||||
inputImageY |
The Y-gradient input image. | Image | Grayscale | nullptr | |||||
inputMarkerImage |
The marker input image from which the binary contours are considered as centers. | Image | Binary | nullptr | |||||
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 |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
input_image_x |
The X-gradient input image. | image | Grayscale | None | |||||
input_image_y |
The Y-gradient input image. | image | Grayscale | None | |||||
input_marker_image |
The marker input image from which the binary contours are considered as centers. | image | Binary | None | |||||
projection_mode |
The output images to be computed.
|
enumeration | GRADIENT_NORMAL | ||||||
output_normal_image |
The normal gradient output image. | image | None | ||||||
output_tangent_image |
The tangent gradient output image. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||
---|---|---|---|---|---|---|---|---|---|
inputImageX |
The X-gradient input image. | Image | Grayscale | null | |||||
inputImageY |
The Y-gradient input image. | Image | Grayscale | null | |||||
inputMarkerImage |
The marker input image from which the binary contours are considered as centers. | Image | Binary | null | |||||
projectionMode |
The output images to be computed.
|
Enumeration | GRADIENT_NORMAL | ||||||
outputNormalImage |
The normal gradient output image. | Image | null | ||||||
outputTangentImage |
The tangent gradient output image. | Image | null |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); RadialGradientContour2d radialGradientContour2dAlgo; radialGradientContour2dAlgo.setInputImageX( polystyrene ); radialGradientContour2dAlgo.setInputImageY( polystyrene ); radialGradientContour2dAlgo.setInputMarkerImage( polystyrene_sep ); radialGradientContour2dAlgo.setProjectionMode( RadialGradientContour2d::ProjectionMode::GRADIENT_NORMAL ); radialGradientContour2dAlgo.execute(); std::cout << "outputNormalImage:" << radialGradientContour2dAlgo.outputNormalImage()->toString(); std::cout << "outputTangentImage:" << radialGradientContour2dAlgo.outputTangentImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) radial_gradient_contour_2d_algo = imagedev.RadialGradientContour2d() radial_gradient_contour_2d_algo.input_image_x = polystyrene radial_gradient_contour_2d_algo.input_image_y = polystyrene radial_gradient_contour_2d_algo.input_marker_image = polystyrene_sep radial_gradient_contour_2d_algo.projection_mode = imagedev.RadialGradientContour2d.GRADIENT_NORMAL radial_gradient_contour_2d_algo.execute() print( "output_normal_image:", str( radial_gradient_contour_2d_algo.output_normal_image ) ) print( "output_tangent_image:", str( radial_gradient_contour_2d_algo.output_tangent_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); RadialGradientContour2d radialGradientContour2dAlgo = new RadialGradientContour2d { inputImageX = polystyrene, inputImageY = polystyrene, inputMarkerImage = polystyrene_sep, projectionMode = RadialGradientContour2d.ProjectionMode.GRADIENT_NORMAL }; radialGradientContour2dAlgo.Execute(); Console.WriteLine( "outputNormalImage:" + radialGradientContour2dAlgo.outputNormalImage.ToString() ); Console.WriteLine( "outputTangentImage:" + radialGradientContour2dAlgo.outputTangentImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" ); auto result = radialGradientContour2d( polystyrene, polystyrene, polystyrene_sep, RadialGradientContour2d::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")) polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip")) result_output_normal_image, result_output_tangent_image = imagedev.radial_gradient_contour_2d( polystyrene, polystyrene, polystyrene_sep, imagedev.RadialGradientContour2d.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" ); ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" ); Processing.RadialGradientContour2dOutput result = Processing.RadialGradientContour2d( polystyrene, polystyrene, polystyrene_sep, RadialGradientContour2d.ProjectionMode.GRADIENT_NORMAL ); Console.WriteLine( "outputNormalImage:" + result.outputNormalImage.ToString() ); Console.WriteLine( "outputTangentImage:" + result.outputTangentImage.ToString() );