Help for PICMATCH

PURPOSE

     "picmatch"  is a batch oriented image correlation routine 
     which incorporates the following features.

     1. Correlation  of  image  to image.

     2. Sampling  of one image to match the geometry of  the 
        other  image (e.g.  one image could be at  different 
        scale or rotation).

     3. Regular or phase correlation in the FFT domain.
     4. Specification of a magnification factor to correlate 
        a larger area without increasing computation.

     5. Use  of  a geometric model to estimate the  matching 
        locations  and  feedback of matches  to  refine  the 
        geometric model.

     6. Matching of images along a polygonal contour.

     7. Use  of  standard  data formats for  all  input  and 
        output data sets.

     TAE COMMAND LINE FORMAT

     picmatch INP=(A,B)   OUT=P      PARAMS
     or
     picmatch INP=(A,B,C) OUT=P      PARAMS

     where

     A                   is the first image to be correlated.

     B                   is   the   second   image   to   be 
                         correlated.

     C                   is  an optional file in graphics-1
			 format containing polygonal contours.

     P                   is an output IBIS tabular file that 
                         contains  the  pairs  of   matching  
                         coordinate locations together  with
                         editing information  such as corre-
			 lation value.  


OPERATION

     First,  "picmatch" sets up a geometric model relating the 
     two images using the ITIE-OTIE parameters.   The points 
     originally  given  are supplemented  by  matches  which 
     exceed  the  value given by the parameter MINCORR  or  its 
     default.   The  geometric  model is used to estimate  a 
     search  location  and to specify a  resampling  of  the 
     first  image to match the raster gridding of the second 
     image.   The model is a linear least squares fit to the 
     control  points.   For normal image to image  matching, 
     only  ITIE-OTIE  points  are  needed.   Their  accuracy 
     should be sufficient to yield a match within the search 
     area  specified  by parameters SEARCH and  MSEARCH  taking 
     into account nonlinearities in the data.

     The  second step is to set up the correlation point set 
     in  the second image by one of three methods.   If  the 
     parameters MINL,  MINS, MAXL, MAXS, NAH, NAV are given, 
     then a grid of points will be used.   If a third  input 
     (a contour or point set) and the parameter CONTOUR is used 
     then the correlation point set will be spaced along the 
     contour  (see  the CONTOUR parameter).   By  specifying  a 
     large spacing, the input can be regarded as a point set 
     and  matching  will  only  occur at the  nodes  of  the 
     contour.

     The  iteration  over  the  correlation  point  set  now 
     proceeds.   At the requested point in the second input, 
     a  32x32  sub-image is extracted.   If the point  is  a 
     fractional pixel location,  the center of extraction is 
     moved   to   align   with  pixel   spacing   to   avoid 
     interpolation.   In fact, interpolation will occur only 
     if  the keyword MAGNIFY is used with a nonintegral  value.  
     The  geometric  model  is used to  calculate  a  search 
     location in the first input.   If this is a  fractional 
     pixel  location,  then  it is also aligned  with  pixel 
     spacing  to minimize interpolation near the center.   A 
     sub-image is extracted of size WxW where W is somewhere 
     between  the values given by the parameters SEARCH  and 
     MSEARCH.  This  sub-image  is  extracted  by   bilinear 
     interpolation at a rotation and pixel size to match the 
     second  input  geometry as specified by  the  geometric 
     model discussed earlier.

     Correlation is performed on 32x32 subwindows of the WxW 
     window.   The  32x32 pieces of the two inputs are  each 
     subjected   to  a  complex  valued  DFT  via  the   FFT 
     algorithm.  One of the DFT arrays has its low frequency 
     terms  set  to  zero by zeroing the first row  and  the 
     first  column unless the parameter NOHPF is  specified.  
     Then  the DFT's are multiplied element by element  (one 
     DFT is conjugated).  If PHASE=1 is specified each
     product is divided  by the  absolute value of its multi-
     plicands (to give phase correlation,  see  reference  1).   
     ("picmatch" divides each element of the FFT of the 
     cross-correlation by the amplitude of the element raised 
     to the PHASE power.  See under the PHASE parameter.)
     Except for phase correlation the power in each FFT is calculated
     for use in the normalization.  An inverse  FFT  is applied  
     to  this  result and the peak  and  its  eight neighbors 
     are saved.   The correlation value for both methods is 
     normalized so that the maximum possible correlation value 
     is 1.0 .   The subwindow is moved over  the search  
     area  with an increment of at most  12  pixels.   When  
     the  entire search area is covered,  the  largest peak is 
     taken to be the correlation point.  A final FFT correlation 
     is performed at the correlation peak to get a refined 
     correlation.   Unless NOSUBPIX is specified a subpixel 
     match is  obtained by  fitting a quadratic  to the peak  
     and  its  eight neighbors.     The match point is transformed 
     back to  the original image location  via  the  inverse  
     of   the geometric  model  and  incorporating  alignment  
     shifts performed in both images.  

     The results are written to an IBIS interface (tabular)
     file with one row for each tiepoint.  The following 
     column format is used:

     Column       Description			   Format

        1     First input matching line            real*4
        2     First input matching sample          real*4
        3     Second input line                    real*4
        4     Second input sample                  real*4
	5     First input estimated line           real*4
	6     First input estimated sample         real*4
        7     First input Z value                  real*4
        8     Second input Z value                 real*4
        9     Correlation value                    real*4
       10     Sequence number                      real*4

       11,12  Latitude of chip                     real*8
       13,14  Longitude of chip                    real*8

    The last four columns are only output if the ground control 
    chip set option is invoked; if so the second input line and 
    sample refer to the reference point in the ground control chip.




    Information about each matching point is printed out unless 
    the NOPRINT keyword is specified.   The printed information
    is as follows:

        1   SEQ			Sequence number
	2   SECOND LOCATION	Tiepoint location in second image
	3   ESTIMATED LOCATION	Estimated location in first image
	4   FIRST LOCATION	Matching location in first image
				    (from correlation search)
	5   CORREL		Correlation value (between 0 and 1)
	6   WIN			Current search window size
	7   RESID		Residual distance (between estimated 
				    location and correlation location)
	8   FN			Failure number

     If correlation  fails,  nothing  is written into the  disk 
     file  but  a failure number is given  in  the  printout 
     under the column heading FN.  The failure numbers are:

              1             point on edge of second image 
				(more than ten percent of chip off image)
              2             failure of RETRY option to exceed threshold
              4             correlation peak unreliable
              5             subpixel correlation failure


     Points  completely outside of either image are  ignored 
     completely.




PRECISION

Due to the iterative nature of the subroutine llsq, the programs results will
vary from machine to machine.  When prnt in llsq's test program was temporarily
changed to a write statement, it was observed that the resulting output varied
from machine to machine.  The following table will provide some idea of the
differential between machines.

                PORTED VMS  ALPHA &     SUN        SGI        SOLARIS
                            UNPORT VAX
FINAL FIT: LINE -81.20914   -81.20914   -81.20908  -81.20908  -81.20908
FINAL FIT: SAMP  15.19182    15.19181    15.19191   15.19190   15.19191



RESTRICTIONS

     The ground control chip file option (use of IBIS graphics-2 
     files)  is not currently supported.


REFERENCES

     C.  D.  Kuglin and D.  C. Hines, "The phase correlation 
     image alignment method," Proc.  IEEE 1975 International 
     Conference on Cybernetics and Society, September, 1975, 
     pp. 163-165.

     Original Programmer:  A. L. Zobrist    12 October 1981
     Current Cognizant Programmer: B. A. McGuffie
     Revision:  5	June 1987
                6       May  1995  (CRI) Made portable for UNIX
                7       September 1996


PARAMETERS:


INP

Input images(2) and contour(1) Optionally, Input files 3,4 are binary masks.

OUT

Out file (matching coord pairs)

ITIE

Control points in first image

OTIE

Control points in second image

MAGNIFY

Magnification of sampling

SEARCH

Search area size (s X s)

MSEARCH

Minimum of the search area

MINCORR

Minimum acceptable corr value

ZWIND

Window for brightness calculation

ZREJECT

Rejection threshold for Z value

MINL

Set of grid locations for corr

MINS

Set of grid locations for corr

MAXL

Set of grid locations for corr

MAXS

Set of grid locations for corr

NAH

Set of grid locations for corr

NAV

Set of grid locations for corr

CONTOUR

Specifies contour/point data set

STOP

Parameters for stopping program

RETRY

Parameters for retrying of corr

PHASE

REAL - Specifies the amount of phase correlation.

FILTER

The power of the FFT filter

NOPRINT

To suppress messages

NOSUBPIX

For no subpixel determination of matching point

NOCORR

To not do correlations

NOHPF

To turn off high pass filter in correlations

See Examples:


Cognizant Programmer: