Image Processing Toolbox User's Guide Previous page   Next Page
cpcorr

Tune control-point locations using cross correlation

Syntax

Description

input_points = cpcorr(input_points_in,base_points_in,input,base) uses normalized cross-correlation to adjust each pair of control points specified in input_points_in and base_points_in.

input_points_in must be an M-by-2 double matrix containing the coordinates of control points in the input image. base_points_in is an M-by-2 double matrix containing the coordinates of control points in the base image.

cpcorr returns the adjusted control points in input_points, a double matrix the same size as input_points_in. If cpcorr cannot correlate a pair of control points, input_points contains the same coordinates as input_points_in for that pair.

cpcorr only moves the position of a control point by up to four pixels. Adjusted coordinates are accurate to one-tenth of a pixel. cpcorr is designed to get subpixel accuracy from the image content and coarse control-point selection.

cpcorr cannot adjust a point if any of the following occur:

Class Support

The images input and base can be numeric and must contain finite values. The control-point pairs are of class double.

Algorithm

cpcorr uses the following general procedure.

For each control-point pair,

  1. Extract an 11-by-11 template around the input control point and a 21-by-21 region around the base control point.
  2. Calculate the normalized cross-correlation of the template with the region.
  3. Find the absolute peak of the cross-correlation matrix.
  4. Use the position of the peak to adjust the coordinates of the input control point.

Example

This example uses cpcorr to fine-tune control points selected in an image. Note the difference in the values of the input_points matrix and the input_points_adj matrix.

See Also

cp2tform, cpselect, imtransform, normxcorr2


Previous page  cp2tform cpselect Next page

© 1994-2005 The MathWorks, Inc.