| Image Processing Toolbox™ | ![]() |
input_points = cpcorr(input_points_in,
base_points_in, input,base)
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.
Note input and base images must have the same scale for cpcorr to be effective. |
cpcorr cannot adjust a point if any of the following occur:
Points are too near the edge of either image.
Regions of images around points contain Inf or NaN.
Region around a point in input image has zero standard deviation.
Regions of images around points are poorly correlated.
The images input and base can be numeric and must contain finite values. The control-point pairs are of class double.
cpcorr uses the following general procedure.
For each control-point pair,
Extract an 11-by-11 template around the input control point and a 21-by-21 region around the base control point.
Calculate the normalized cross-correlation of the template with the region.
Find the absolute peak of the cross-correlation matrix.
Use the position of the peak to adjust the coordinates of the input control point.
Use 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.6000cp2tform, cpselect, imtransform, normxcorr2
![]() | cp2tform | cpselect | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |