Help for DIFNEAR

PURPOSE:
difnear compares a pixel in the first image with a window of
pixels in the second image.  The minimum of the dif's over
the window is output.  So if two images are slightly misregistered
this program will do a better job of eliminating a lot of "noise"
in the dif image.  It is also possible that "signal" will be wiped
out by a nearby pixel that accidentally has the same value as the
signal.  

The dif value is the closest value.  So the dif of 5 with the values
4 and 7 is 1.  The dif of 5 with 3 and 6 is -1

difnear has an option for refining the window to half step values
and options for taking absolute value of the diff or adding 128.
EXECUTION:

Example

difnear (A,B) C      will dif A and B starting naming the result C.
                               
OPERATION:
Because of the window, the program uses a "rolling barrel" of input
lines to avoid rereading a line more than once in the second input.


TIMING: 

About the same speed as convolution filter.  

 ORIGINAL PROGRAMMER:    A. Zobrist          27 Jun 2002
 COGNIZANT PROGRAMMER:   A. Zobrist          27 Jun 2002
 
 REVISION HISTORY
  2002-06-27 AZ  Initial version
  2008-01-02 WLB Switched to USES_ANSI_C AND LIB_CARTO; misc cleanup  
  2015-11-24 WLB Migrated to MIPL
  2022-07-14 B. Crocco afids to opensource
  

PARAMETERS:


INP

STRING - Input image files

OUT

STRING - Output image file

SIZE

INTEGER - Region of input files to be diffed

SL

INTEGER - Starting line

SS

INTEGER - Starting sample

NL

INTEGER - Number of lines

NS

INTEGER - Number of samples

WINDOW

Size of the diff window, must be odd

HALFPIX

Will calculate the half steps between each neighbor pixel

ADD128

Add 128 to the result to get rid of negative numbers

ABSVAL

Abs() the result to get rid of negative numbers

See Examples:


Cognizant Programmer: