ImageDev

CannyEdgeDetector3d

Performs Canny's computational approach to edge detection on a three-dimensional grayscale image.

Access to parameter description

This algorithm extracts the local maxima of a smoothed gradient image by applying the following steps: The output image is a grayscale image representing the detected contours with one pixel thickness.

To complete the Canny edge detector method, a thresholding by hysteresis must be applied on this output image afterward.
A second output provides an estimation of the two threshold values necessary to perform this step.

Reference: J.F.Canny. "A computational approach to edge detection." IEEE Transactions on Pattern Analysis and Machine Intelligence, vol.8, No 6, pp. 679-698, Nov. 1986.

See also

Function Syntax

This function returns a CannyEdgeDetector3dOutput structure containing the outputImage and outputMeasurement output parameters.
// Output structure.
struct CannyEdgeDetector3dOutput
{
    std::shared_ptr< iolink::ImageView > outputImage;
    CannyEdgeDetectorMsr::Ptr outputMeasurement;
};

// Function prototype.
CannyEdgeDetector3dOutput
cannyEdgeDetector3d( std::shared_ptr< iolink::ImageView > inputImage,
                     iolink::Vector3d standardDeviation,
                     std::shared_ptr< iolink::ImageView > outputImage = NULL,
                     CannyEdgeDetectorMsr::Ptr outputMeasurement = NULL );
This function returns a tuple containing the output_image and output_measurement output parameters.
// Function prototype.
canny_edge_detector_3d( input_image,
                        standard_deviation = [1, 1, 1],
                        output_image = None,
                        output_measurement = None )
This function returns a CannyEdgeDetector3dOutput structure containing the outputImage and outputMeasurement output parameters.
/// Output structure of the CannyEdgeDetector3d function.
public struct CannyEdgeDetector3dOutput
{
    public IOLink.ImageView outputImage;
    public CannyEdgeDetectorMsr outputMeasurement;
};

// Function prototype.
public static CannyEdgeDetector3dOutput
CannyEdgeDetector3d( IOLink.ImageView inputImage,
                     double[] standardDeviation = null,
                     IOLink.ImageView outputImage = null,
                     CannyEdgeDetectorMsr outputMeasurement = null );

Class Syntax

Parameters

Class Name CannyEdgeDetector3d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input grayscale image. Image Binary, Label, Grayscale or Multispectral nullptr
input
standardDeviation
The gaussian filter standard deviation value. Vector3d >=0.1 {1.f, 1.f, 1.f}
output
outputImage
The output grayscale image representing the detected edges.
Its dimensions are forced to the same values as the input. Its data type is forced to floating point.
Image nullptr
output
outputMeasurement
The output measurement provides the estimated parameters of the threshold values used by the hysteresis. CannyEdgeDetectorMsr nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

CannyEdgeDetector3d cannyEdgeDetector3dAlgo;
cannyEdgeDetector3dAlgo.setInputImage( foam );
cannyEdgeDetector3dAlgo.setStandardDeviation( {1, 1, 1} );
cannyEdgeDetector3dAlgo.execute();

std::cout << "outputImage:" << cannyEdgeDetector3dAlgo.outputImage()->toString();
std::cout << "thresholdHigh: " << cannyEdgeDetector3dAlgo.outputMeasurement()->thresholdHigh( 0 ) ;
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

canny_edge_detector_3d_algo = imagedev.CannyEdgeDetector3d()
canny_edge_detector_3d_algo.input_image = foam
canny_edge_detector_3d_algo.standard_deviation = [1, 1, 1]
canny_edge_detector_3d_algo.execute()

print( "output_image:", str( canny_edge_detector_3d_algo.output_image ) );
print( 
print("thresholdHigh: ", canny_edge_detector_3d_algo.output_measurement.threshold_high( 0 ) ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

CannyEdgeDetector3d cannyEdgeDetector3dAlgo = new CannyEdgeDetector3d
{
    inputImage = foam,
    standardDeviation = new double[]{1, 1, 1}
};
cannyEdgeDetector3dAlgo.Execute();

Console.WriteLine( "outputImage:" + cannyEdgeDetector3dAlgo.outputImage.ToString() );
Console.WriteLine( "thresholdHigh: " + cannyEdgeDetector3dAlgo.outputMeasurement.thresholdHigh( 0 ) );

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );

auto result = cannyEdgeDetector3d( foam, {1, 1, 1} );

std::cout << "outputImage:" << result.outputImage->toString();
std::cout << "thresholdHigh: " << result.outputMeasurement->thresholdHigh( 0 ) ;
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))

result_output_image, result_output_measurement = imagedev.canny_edge_detector_3d( foam, [1, 1, 1] )

print( "output_image:", str( result_output_image ) );
print( "thresholdHigh: ", result_output_measurement.threshold_high( 0 ) );
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );

Processing.CannyEdgeDetector3dOutput result = Processing.CannyEdgeDetector3d( foam, new double[]{1, 1, 1} );

Console.WriteLine( "outputImage:" + result.outputImage.ToString() );
Console.WriteLine(  "thresholdHigh: " + result.outputMeasurement.thresholdHigh( 0 )  );