edgen - A general Edge detection package.

NAME

edgen,

SYNOPSIS

edgen [ -help ] [ -i file ] [ -o file ] [ -pgmout file ] [ -g1 file ] [ -g2 file ] [ -g3 file ] [ -rofi integer integer integer integer [ -f x ] [ -f d ] [ -f s ] [ -f g ] [ -f p ] [ -f o ] [ -f n ] [ -f i ] [ -len integer ] [ -s real ] [ -alpha real ] [ -omega real ] [ -tau real ] [ -scale ] [ -nmax integer ] [ -F ] [ -lt real ] [ -hyl real ] [ -hyu real ] [ -global ] [ -noautothr ] [ -seg integer ] [ -nodir ] [ -mag ] [ -strnum ] [ -impdir ] [ -t ] [ -nousage ] [ -start integer ] [ -end integer ]

DESCRIPTION

edgen is an edge detection routine which can use a variety of different filters to obtain the output edge map. It takes as input an image in .pgm (P5) format and outputs the edge data in .gf format. Output of this routine can also be obtained optionally in .pgm format. A libray of various functions is alos available.

OPTIONS

-help
Gives the usage page.
-i file
specifies the input pgm file to be used. This is a compulsory option. If followed by '-' standard input is assumed.
-o file
specifies the output gf file to be written to. This is a compulsory option. If followed by '-' standard output is assumed.
-pgmout file
specifies the output pgm file to be written to. If no option is specified then no pgm file will be written to. If -pgmout - is used then output will be written to standard output. Note this can only used with -pgmout file option otherwise both outputs will be written to the same file.
-g1 file
this option write in .pgm format the gradient values after convolution and differencing.
-g2 file
this option write in .pgm format the gradient values after scale option if used.
-g3 file
this option write in .pgm format the values after non-maximum suppression has been used.
-rofi startx endx starty endy
this option specifies the region of interest to be used. If the region of interest lies outside the image, a mirror reflection is performed.` This is not advisable since invalid information may be created. The format of this option is to give the starting point of the x coordinate, followed by the last x coordinate and similarly for the y.
-f x
specifies that optimal 1D filter will be used for smoothing. If no option is specified then this option will be used.
-f d
specifies that Deriche filter will be used for smoothing.
-f s
specifies that Sobel filter will be used for smoothing.
-f g
specifies that Gaussian filter will be used for smoothing.
-f p
specifies that optimal 2D filter will be used for smoothing.
-f o
specifies that Separable optimal filter will be used for smoothing.
-f n
specifies that no smoothing filter will be used but only differencing.
-len integer
specifies the length of the mask to be used. Default is set at 7. This option can not be used with Sobel, Differencing or Deriche.
-s real
this parameter is only used when designing the following filters: Optimal 1D, Separable Optimal and Optimal 2D. It specifies the edge steepness. Default value is set to 1.0 which is close to a ramp. A value close to 3.0 implies a step edge.
-alpha real
this parameter is used when designing Deriche filter. Its default value is set to 2.0.
-omega
this parameter is used when designing Deriche filter. Its default value is set to 0.001.
-tau
this parameter specifies the decay value reached by the Gaussian filter.
-scale
this option is useful for images in which edges are in dark regions and harder to detect.
-nmax integer
the edge detection routine caters for three options that could be used for non-max suppression. -nmax 1 (default) works out the statistics on whole gradient image and performs low thresholding before non-maximum suppression is performed. -nmax 2 does non-maximum suppression on whole gradient image. nmax 3 performs sub-pixel accuracy non-maximum suppression on low thresholded gradient image.
-F
if switched on this option will perform 4-connectivity non-max suppression.
-lt real
lower threshold used when nmax 1 has been specified to remove any gradient magnitude above the threshold. The threshold is set to k*mean where k is the threshold specified and mean is the mean of the gradient magnitudes. default value for k is set to 0.2.
-hyl real
specifies the low hysteresis threshold used. k*mean is used where k is varied by the option. default is 0.2*mean.
-hyu real
specifies the high hysteresis threshold used. k*mean is used where k is varied by the option. default is 1.5*mean.
-global
this option will ignore hysteresis thresholding. It will do straight forward thresholding on whole gradient image and output the result.
-noautothr
if switched on set hyl and hyu to absolute values rather than a function of the mean.
-noautolowthr
if switched sets lt to absolute value rather than a function odf the mean.
-seg integer
specifies the number of edge strings below which the edge will be removed. default is set to 0.
-nodir
if specified this switch disables direction info. to be written to gf file.
-mag
if specified, this option enables gradient magnitudes to be written to gf file.
-strnum
if specified, this switch enables string numbers to be written to gf file.
-impdir
if specified, this switch enables an improvement on the edge orientation. This option can only be used if optimal 2D filter was specified.
-t
if specified, this switch enables timing info. to be written to gf file.
-nousage
if specified, this switch disables option usage info to be written to gf file.
-start integer
this option specifies the input stage. The integer can be: 1 (start at beginning which is default), 2 (start after convolutions have been performed or 3 (start after non max suppression has been performed). The files must be in ARY format. These can be generated using -end option.
-end integer
this option specifies the exit stage. The integer can be: 1 (exit after convolutions have been performed), 2 (exit after non max suppression has been performed) or 3 (exit at end which is default). The format is ARY# where # is the number of bytes per point (4 in our case for float), followed by information the image dimensions. If you exit at first stage three files are written to: outfile_dx.ary, outfile_dy.ary and outfile_grad.ary. 'outfile' is specified with -o option. If end 2 is specified the _dx.ary, _dy.ary files are written as well as _nonmax.ary.

Package Facilities

edgen allows the user to output each stage in .pgm P5 format using -g1 (output gradient magnitudes), -g2 (output grad. mags after scaling if scale option was used) and -g3 (output non maximum suppressed image). edgen also allows users to exit and enter at any stage. There are 3 main stages in the package: filtering, non maximum suppression and hysteresis threholding and linking. When exiting at any stage the package will automatically output the files that will be required for trhe next stage. These will have the appropiate suffixes and end with .ary. The .ary ary format consists of a simple header followed by the data written as binary floats. The header consists of the ary type (mostly 4 for FLOATMATRIX) followed by the starting column, last column , first row and last row. To be able to inspect each stage an ary to viff conversion program is available called arytoviff. To view the .viff format use editimage -i .viff file. If exited after convolutions the following files will be written: (outFile), (outFile)_grad.ary, (outFile_dx.ary) and (outFile_dy.ary). If exited after non maximum suppression the following files will be written: (outFile), (outFile)_nonmax.ary, (outFile_dx.ary) and (outFile.ary). If user wants to enter at second you need only specify (with the -i option) the previous stage output (specified with the -o option) excluding the suffixes since those will be done automatically within the program.
As an example to illustrate the above here is what to do: 

 
edgen -i pgmP5file -o ed.g -end 1 /* exit after convolutions */ 

 
edgen -i ed.gf -o ed.gf -start 2 /* enter after convolutions */ 

 

OUTPUT FORMAT

The output gf format for the edge map is as follows: The .gf format consists of two sets: a description set containning all the relevant information (including timing info if specified with the -t option) followed by the data set containning all the edge strings.

SEE ALSO

Ary , LL , gfLL , OptionGM

BUGS

It is impossible to predict the default thresholds for any image. In some cases no strings are output. The solution to this problem would be to decrease the values for the lower and upper threshold using the -hyl, -hyu command line options.

AUTHOR

Homam Dabis, University of Surrey, h.dabis@ee.surrey.ac.uk
18-Oct-94. Automatically converted by man2html, written by G.Matas (g.matas@ee.surrey.ac.uk)