Fred's ImageMagick Scripts



 

 

DOG


Creates an edge extracted image using the difference of two gaussian blurs.

Download Script

last modified: November 27, 2011



USAGE: dog [-s smallfilt] [-l largefilt] [-m mode] [-t thresh] [-b brighten] infile outfile
USAGE: dog [-h or -help]

-s .... smallfilt .... size of small gaussian filter; float>0; default=1
-l .... largefilt .... size of large gaussian filter; float>0; default=2
-m .... mode ......... mode of subtraction; choices are 1 (larger-smaller)
...................... and 2 (smaller - larger); default=1
-t .... thresh ....... edge tresholding value; 0<=integer<=100; The default
...................... is no thresholding; a value=0 is all edges thresholded
-b .... brighten ..... edge brightening factor; float>=1; default=1 is
...................... no brightening

PURPOSE: To create an edge extracted image using the difference of two gaussian blurs.

DESCRIPTION: DOG creates an edge extracted image using the difference of two gaussian blurs of different sizes.

ARGUMENTS:

-s smallfilt ... SMALLFILT is the size of the smaller gaussian blur filter. Values are floats>0. The default=1

-l largefilt ... LARGEFILT is the size of the larger gaussian blur filter. Values are floats>0. The default=1

-m mode ... MODE determines the order of the subtraction. Choices are: 1 for (larger - smaller) or 2 for (smaller - larger). The default=1.

-t thresh ... THRESH is the optional thresholding applied to the edge image to make the edges binary white on a black background. Values are 0<=integer<=100. The default indicates no thresholding. A value of 0 means threshold to get all edges.

-b brighten ... BRIGHTEN is the brightening factor for the edges. Values are floats>=1. The default=1 indicates no brightening.

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Example 1

Original

Arguments:
(defaults)

Arguments:
-b 2

Arguments:
-b 2 -t 10

Arguments:
-b 2 -t 20



Example 2
(original image: http://www.codeproject.com/KB/GDI-plus/Image_Processing_Lab.aspx)

Original

Arguments:
-s 1 -l 2
(defaults)

Arguments:
-s 1 -l 5

Arguments:
-s 3 -l 7



Example 3 -- Variation In Mode

Arguments:
-s 1 -l 2 -m 1

Arguments:
-s 1 -l 2 -m 2

Arguments:
-s 3 -l 7 -m 1

Arguments:
-s 3 -l 7 -m 2



What the script does is as follows:

  • Creates two different size gaussian blurred images
    and subtracts them

This is equivalent to the following IM commands

  • convert $infile \
    \( -clone 0 -blur 0x$largefilt \) \
    \( -clone 0 -blur 0x$smallfilt \) \
    -delete 0 +swap -compose minus -composite \
    -autolevel -evaluate multiply $brighten \
    -threshold $thresh% $outfile