Image Processing Toolbox User's Guide |
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:
Inf
or NaN.
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.
input
control point and a 21-by-21 region around the base
control point.
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.
input = imread('onion.png'); base = imread('peppers.png'); input_points = [127 93; 74 59]; base_points = [323 195; 269 161]; input_points_adj = cpcorr(input_points,base_points,... input(:,:,1),base(:,:,1)) input_points_adj = 127.0000 93.0000 71.0000 59.6000
See Also
cp2tform
, cpselect
, imtransform
, normxcorr2
cp2tform | cpselect |
© 1994-2005 The MathWorks, Inc.