Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Directional gradients of an image

```
[Gx,Gy]
= imgradientxy(I)
```

```
[Gx,Gy]
= imgradientxy(I,method)
```

```
[gpuarrayGx,gpuarrayGy]
= imgradientxy(gpuarrayI,___)
```

`[`

performs
the operation on a GPU. The input image and the return values are
gpuArrays. This syntax requires the Parallel
Computing Toolbox™`gpuarrayGx`

,`gpuarrayGy`

]
= imgradientxy(`gpuarrayI`

,___)

When applying the gradient operator at the boundaries of the image, values outside the bounds of the image are assumed to equal the nearest image border value.

The algorithmic approach is to compute directional gradients
with respect to the *x*-axis and *y*-axis.
The *x*-axis is defined along the columns going right
and the *y*-axis is defined along the rows going
down.

`imgradientxy`

does not normalize the gradient
output. If the range of the gradient output image has to match the
range of the input image, consider normalizing the gradient image,
depending on the `method`

argument used. For example,
with a Sobel kernel, the normalization factor is 1/8, and for Prewitt,
it is 1/6.

`edge`

| `fspecial`

| `gpuArray`

| `imgradient`

| `imgradient3`

| `imgradientxyz`

Was this topic helpful?