EdgeDetect - Maple Help

# Online Help

###### All Products    Maple    MapleSim

ImageTools

 EdgeDetect
 detect edge of an image

 Calling Sequence EdgeDetect(img)

Parameters

 img - Image; the image

Options

 • method = Sobel, Robert, Prewitt3 or Prewitt4
 Specifies which convolution mask should be used. The default mask is Sobel. The convolution masks used are as follows:
 • Sobel: $\left[\begin{array}{ccc}-1& 0& 1\\ -2& 0& 2\\ -1& 0& 1\end{array}\right]$  and $\left[\begin{array}{ccc}1& 2& 1\\ 0& 0& 0\\ -1& -2& -1\end{array}\right]$
 • Robert: $\left[\begin{array}{cc}0& 1\\ -1& 0\end{array}\right]$  and $\left[\begin{array}{cc}1& 0\\ 0& -1\end{array}\right]$
 • Prewitt3: $\left[\begin{array}{ccc}-1& 0& 1\\ -1& 0& 1\\ -1& 0& 1\end{array}\right]$  and $\left[\begin{array}{ccc}1& 1& 1\\ 0& 0& 0\\ -1& -1& -1\end{array}\right]$
 • Prewitt4: $\left[\begin{array}{cccc}-3& -1& 1& 3\\ -3& -1& 1& 3\\ -3& -1& 1& 3\\ -3& -1& 1& 3\end{array}\right]$ and $\left[\begin{array}{cccc}3& 3& 3& 3\\ 1& 1& 1& 1\\ -1& -1& -1& -1\\ -3& -3& -3& -3\end{array}\right]$

Description

 • The EdgeDetect(img) command extracts the horizontal and vertical edges by using the mask specified by method and then combines them to extract the edges of an image.
 • The Threshold command can be applied after calling EdgeDetect(img), for example to have the edges show up as black on white instead of the reverse (see below). This Threshold Example shows another way to use it.

Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{img}≔\mathrm{Read}\left(\mathrm{cat}\left(\mathrm{kernelopts}\left(\mathrm{datadir}\right),"/images/phone.jpg"\right)\right):$
 > $\mathrm{Embed}\left(\mathrm{FitIntensity}\left(\mathrm{img}\right)\right)$

 > $\mathrm{edge1}≔\mathrm{EdgeDetect}\left(\mathrm{img}\right)$
 ${{\mathrm{_rtable}}}_{{36893628004164571972}}$ (5.1)
 > $\mathrm{Embed}\left(\mathrm{FitIntensity}\left(\mathrm{edge1}\right)\right)$

 > $\mathrm{edge2}≔\mathrm{EdgeDetect}\left(\mathrm{img},\mathrm{method}=\mathrm{Robert}\right):$
 > $\mathrm{Embed}\left(\mathrm{FitIntensity}\left(\mathrm{edge2}\right)\right)$

 > $\mathrm{Embed}\left(\mathrm{Threshold}\left(\mathrm{edge2},0.6\right)\right)$

 > $\mathrm{Embed}\left(\mathrm{Threshold}\left(\mathrm{edge2},0.6,'\mathrm{high}'=0,'\mathrm{low}'=1\right)\right)$

Compatibility

 • The ImageTools[EdgeDetect] command was introduced in Maple 2019.
 • For more information on Maple 2019 changes, see Updates in Maple 2019.

 See Also