gradient

[ XITE Reference Manual | XITE home ]

Contents


Name

gradient, sobel, prewitt, roberts, grad - gradient like operators

Syntax

 gradient [-angle] [-magnitude] [-pseudo]
          [-xscale <xscale>] [-yscale <yscale>]
          [-title  <title>] [-verbose]
          <inimage> <outimage> <xconvfile> <yconvfile>

 sobel    [-angle] [-magnitude] [-pseudo]
          [-title  <title>] <inimage> <outimage>

 prewitt  [-angle] [-magnitude] [-pseudo]
          [-title  <title>] <inimage> <outimage>

 roberts  [-angle] [-magnitude] [-pseudo]
          [-title  <title>] <inimage> <outimage>

 grad     [-angle] [-magnitude] [-pseudo]
          [-title  <title>] <inimage> <outimage>

Description

gradient performs a gradient operator on the input image inimage and writes the result to outimage.

The convolution kernels are specified by xconvfile and yconvfile.

sobel, roberts, prewitt and grad use standard convolution kernels (see below).

Options

-magnitude
Combine horizontal and vertical contributions by adding the absolute values.
 magnitude = |convx| + |convy|

-angel
Combine horizontal and vertical contributions by calculating the gradient angle.
 angle = atan(convy/convx)

-pseudo
Combine horizontal and vertical contributions by combining the magnitude and angle into a pseudo image.
 pseudo = pseudo combination of magnitude and angle

The pseudo comination of magnitude and pseudo:
 mag level = magnitude / 32;
  Level  First Length
      0      0      4
      1      4     12
      2     16     20
      3     36     28
      4     64     36
      5    100     44
      6    144     52
      7    196     60
 pseudo = first[level] + angle/256*length[level]

The pseudo-image may be displayed with a "gradient" color-table.

-xscale xscale
Scale magnitude data. Default is xscale=0, which gives autoscaling.
 xpix = (xconv. result) * xscale

-yscale yscale
Scale magnitude data. Default is yscale=0, which gives autoscaling.
 ypix = (yconv. result) * yscale;

-title title
Set title of output image to title.

-verbose
Write a message if the convolution sum is less than 0 or greater than 255.

Standard convolution kernels

sobel:


            -1 0 1                 -1 -2 -1
 xconv =    -2 0 2        yconv =   0  0  0
            -1 0 1                  1  2  1

prewitt


            -1 0 1                 -1 -1 -1
 xconv =    -1 0 1        yconv =   0  0  0
            -1 0 1                  1  1  1

roberts


            1  0                  0  1
 xconv =                 yconv =
            0 -1                 -1  0

grad


           -1  1                 -1  0
 xconv =                 yconv =
            0  0                  1  0

See also

convolve(1), conv3x3(1), ascii2biff(1)

Author

Otto Milvang

Id

$Id: gradient_op.c,v 1.34 1997/06/11 09:44:52 svein Exp $