This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Control Point Selection Tool


h = cpselect(moving,fixed,___)
cpselect(___,param1, val1,___)


cpselect(moving,fixed) starts the Control Point Selection Tool, a graphical user interface that enables you to select control points in two related images. moving is the image that needs to be warped to bring it into the coordinate system of the fixed image. moving and fixed can be either variables that contain grayscale, truecolor, or binary images, or the names of files containing these images. The Control Point Selection Tool returns the control points in a CPSTRUCT structure. (For more information, see Control Point Selection Procedure.)

cpselect(moving,fixed,CPSTRUCT_IN) starts cpselect with an initial set of control points that are stored in CPSTRUCT_IN. This syntax allows you to restart cpselect with the state of control points previously saved in CPSTRUCT_IN.

cpselect(moving,fixed,movingPoints,fixedPoints) starts cpselect with a set of initial pairs of control points. movingPoints and fixedPoints are m-by-2 matrices that store the moving and fixed coordinates, respectively.

h = cpselect(moving,fixed,___) returns a handle h to the tool. You can use the close(h) syntax to close the tool from the command line.

cpselect(___,param1, val1,___) starts cpselect, specifying parameters and corresponding values that control various aspects of the tool. Parameter names can be abbreviated, and case does not matter. Parameters include:

Parameter Description

Logical scalar that controls whether cpselect waits for the user to finish the task of selecting points. If set to false (the default), you can run cpselect at the same time as you run other programs in MATLAB®. If set to true, you must finish the task of selecting points before doing anything else in MATLAB.

The value affects the output arguments:

h = cpselect(...,'Wait',false) returns a handle h to the tool. close(h) closes the tool.

[moving_out,fixed_out] = cpselect(...,'Wait', true) returns the selected pairs of points. moving_out and fixed_out are P-by-2 matrices that store the moving and fixed image coordinates, respectively.

Class Support

The images can be grayscale, truecolor, or binary. A grayscale image can be uint8, uint16, int16, single, or double. A truecolor image can be uint8, uint16, single, or double. A binary image is of class logical.


Start Control Point Selection tool with saved images.


Start Control Point Selection tool with images and control points stored in variables in the workspace.

I = checkerboard;
J = imrotate(I,30);
fixedPoints = [11 11; 41 71];
movingPoints = [14 44; 70 81];

Register an aerial photo to an orthophoto. Specify the 'wait' parameter to block until control point selection is complete.

aerial = imread('westconcordaerial.png');
figure, imshow(aerial)
ortho = imread('westconcordorthophoto.png');
figure, imshow(ortho)
load westconcordpoints % load some points that were already picked     
% Ask cpselect to wait for you to pick some more points
[aerial_points,ortho_points] = ...
t_concord = fitgeotrans(aerial_points,ortho_points,'projective');
Rortho = imref2d(size(ortho));
aerial_registered = imwarp(aerial,t_concord,'OutputView',Rortho);
figure, imshowpair(aerial_registered,ortho,'blend')                

More About

collapse all


cpselect uses the following general procedure for control-point prediction.

  1. Find all valid pairs of control points.

  2. Infer a spatial transformation between moving and fixed control points using method that depends on the number of valid pairs, as follows:

    2 pairs

    Nonreflective similarity

    3 pairs


    4 or more pairs


  3. Apply spatial transformation to the new point to generate the predicted point.

  4. Display predicted point.

Introduced before R2006a

Was this topic helpful?