Input intensity or binary image, specified as a 2-D, real, nonsparse,
numeric, or logical array.

**Example: **`I = imread('circuit.tif'); BW = edge(I);`

**Data Types: **`single`

| `double`

| `int16`

| `uint8`

| `uint16`

| `logical`

Edge detection method, specified as one of the following strings.

Method | Description |

`'Canny'` | Finds edges by looking for local maxima of the gradient of `I` .
The `edge` function calculates the gradient using
the derivative of a Gaussian filter. This method uses two thresholds
to detect strong and weak edges, including weak edges in the output
if they are connected to strong edges. By using two thresholds, the
Canny method is less likely than the other methods to be fooled by
noise, and more likely to detect true weak edges.Not supported
on a GPU. |

`‘log'` (Laplacian of Gaussian) | Finds edges by looking for zero-crossings after filtering `I` with
a Laplacian of Gaussian filter. |

`'Prewitt` ' | Finds edges using the Prewitt approximation to the derivative.
It returns edges at those points where the gradient of `I` is
maximum. |

`'Roberts'` | Finds edges using the Roberts approximation to the derivative.
It returns edges at those points where the gradient of `I` is
maximum. |

`'Sobel'` | Finds edges using the Sobel approximation to the derivative.
It returns edges at those points where the gradient of I is maximum. |

`'zerocross'` | Finds edges by looking for zero-crossings after filtering I
with a filter that you specify. |

**Example: **`BW = edge(I,'Canny');`

**Data Types: **`char`

Sensitivity threshold, specified as a numeric scalar or, for
the Canny method only, a two-element vector. `edge`

ignores
all edges that are not stronger than `threshold`

.
If you do not specify `threshold`

, or if you specify
an empty array (`[]`

), `edge`

chooses
the value automatically. For information about this parameter, see Tips.

For the `‘log'`

(Laplacian of
Gaussian) and `'zerocross'`

methods, if you specify
the threshold value `0`

, the output image has closed
contours because it includes all of the zero-crossings in the input
image.

**Example: **`BW = edge(I,'Prewitt',3);`

**Data Types: **`single`

| `double`

| `int8`

| `int16`

| `int32`

| `int64`

| `uint8`

| `uint16`

| `uint32`

| `uint64`

Direction of detection, specified as the string `'horizontal'`

, `'vertical'`

,
or `'both'`

. Supported only by the Sobel and Prewitt
methods.

**Example: **`BW = edge(I,'Prewitt',3,'horizontal');`

**Data Types: **`char`

Standard deviation of the filter, specified as a scalar. The
following table describes this option for each method that supports
it.

Method | Description |

Canny | Scalar value that specifies the standard deviation of
the Gaussian filter. The default `sigma` is `sqrt(2)` ;
the size of the filter is chosen automatically, based on `sigma` . |

Laplacian of Gaussian (log) | Scalar value that specifies the standard deviation of
the Laplacian of Gaussian filter. The default `sigma` is
2. The size of the filter is `n` -by-`n` ,
where `n` `=` `ceil(sigma*3)*2+1` . |

Scalar value that specifies the standard deviation of the Gaussian
filter. The default `sigma`

is `sqrt(2)`

.
The size of the filter is chosen automatically, based on `sigma`

.

**Example: **`BW = edge(I,'Canny',3,5);`

**Data Types: **`double`

Input image, specified as a gpuArray.

**Example: **```
gpuarrayI = gpuArray(imread('circuit.tif'));
gpuarrayBW = edge(gpuarrayI,'prewitt');
```