Main Content

step

System object: visionhdl.EdgeDetector
Package: visionhdl

Detect edges at an image pixel

Syntax

[edge,ctrlOut] = step(detect_edges,pixelIn,ctrlIn)
[G1,G2,ctrlOut] = step(detect_edges,pixelIn,ctrlIn)
[edge,ctrlOut] = step(detect_edges,pixelIn,ctrlIn,thresh)

Description

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

[edge,ctrlOut] = step(detect_edges,pixelIn,ctrlIn) detects edges in the neighborhood of pixelIn by computing the gradient in two orthogonal directions. The edge output argument is a binary value indicating whether the sum of the squares of the gradients for the input pixel is above the threshold indicating an edge.

[G1,G2,ctrlOut] = step(detect_edges,pixelIn,ctrlIn) detects edges in the neighborhood of pixelIn by computing the gradient in two orthogonal directions. Use this syntax when you set GradientComponentOutputPorts property to true. The G1 and G2 output arguments are the gradients calculated in the two orthogonal directions. When you set the Method property to 'Sobel' or 'Prewitt', the first argument is the vertical gradient, and the second argument is the horizontal gradient. When you set the Method property to 'Roberts', the first argument is the 45 degree gradient, and the second argument is the 135 degree gradient.

[edge,ctrlOut] = step(detect_edges,pixelIn,ctrlIn,thresh) detects edges in the neighborhood of pixelIn by computing the gradient in two orthogonal directions. Use this syntax when you set ThresholdSource property to 'InputPort'. The edge output argument is a binary value indicating whether the sum of the squares of the gradients was above the threshold, thresh, squared.

You can use any combination of the optional port syntaxes.

This object uses a streaming pixel interface with a structure for frame control signals. This interface enables the object to operate independently of image size and format and to connect with other Vision HDL Toolbox™ objects. The object accepts and returns a scalar pixel value and control signals as a structure containing five signals. The control signals indicate the validity of each pixel and its location in the frame. To convert a pixel matrix into a pixel stream and control signals, use the visionhdl.FrameToPixels object. For a description of the interface, see Streaming Pixel Interface.

Note

The System object performs an initialization the first time you call the step method. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the object issues an error. To change nontunable properties or inputs, first call the release method to unlock the object.

Input Arguments

expand all

Specify a visionhdl.EdgeDetector System object that you created and configured.

Intensity of a single pixel, specified as a scalar value.

Supported data types:

  • uint or int

  • fixdt()

  • double and single data types are supported for simulation, but not for HDL code generation.

You can simulate System objects with a multipixel streaming interface, but you cannot generate HDL code for System objects that use multipixel streams. To generate HDL code for multipixel algorithms, use the equivalent Simulink® blocks.

Control signals accompanying the input pixel stream, specified as a pixelcontrol structure containing five logical data type signals. The signals describe the validity of the pixel and its location in the frame. For more details, see Pixel Control Structure.

Data Types: struct

Gradient threshold value that indicates an edge, specified as a scalar numeric value.

The object compares this value squared to the sum of the squares of the gradients. This argument is accepted when you set ThresholdSource property to 'InputPort'.

Output Arguments

expand all

Pixel value indicating an edge at this pixel, returned as a scalar binary value.

Gradient calculated in the first direction, returned as a scalar value.

This argument is returned when you set GradientComponentOutputPorts property to true. If you set the Method property to 'Sobel' or 'Prewitt', this argument is the vertical gradient. When you set the Method property to 'Roberts', this argument is the 45 degree gradient.

Configure the data type of the gradients by using the GradientComponentDataType and CustomGradientComponent properties.

Gradient calculated in the second direction, returned as a scalar value.

This argument is returned when you set GradientComponentOutputPorts property to true. If you set the Method property to 'Sobel' or 'Prewitt', this argument is the horizontal gradient. When you set the Method property to 'Roberts', this argument is the 135 degree gradient.

Configure the data type of the gradients by using the GradientComponentDataType and CustomGradientComponent properties.

Control signals accompanying the output pixel stream, returned as a pixelcontrol structure containing five logical data type signals. The signals describe the validity of the pixel and its location in the frame. For more details, see Pixel Control Structure.

Data Types: struct

Version History

Introduced in R2015a