# Using the Offset Gray Character Option

I came across this example on how to call a function`graycomatrix`

```
>I = imread('circuit.tif');
>GLCM2 = graycomatrix(I,'Offset',[2 0;0 2]);
>stats = GLCM_features1(GLCM2,0)
```

but I don't understand the effect of the second parameter in `graycomatrix`

. I have read the Matlab documentation , but the explanation is difficult to understand.

source to share

The second and third parameters `graycomatrix`

are a combined name-value pair. The value ( `[2 0; 0 2]`

) in this case is a matrix that defines the relative distance (i.e. offset, parameter name) of pixels that are considered to get the match of the number of each pair of values.

Each row in this matrix `p-by-2`

defines a single relative position in the format `[row column]`

. The first row of the matrix `[2 0]`

. This means that each pixel is compared to a pixel 2 rows down, 0 columns (i.e. in one column). The second row `[0 2]`

indicates that each pixel is **also** compared to pixel 0 rows (i.e. in the same row) and 2 columns.

So each pixel is compared to two neighboring pixels: pixel 2 columns to the right, and pixel 2 rows down. The pair formed by both of these ratios is used to magnify the corresponding pixels in the output image.

source to share