cpstruct2pairs
Extract valid control point pairs from cpstruct
structure
Description
[
extracts
the valid control point pairs from movingPoints
,fixedPoints
]
= cpstruct2pairs(cpstruct_in
)cpstruct_in
,
returning two arrays movingPoints
and fixedPoints
.
Examples
Convert cpstruct to Sets of Control Point Pairs
Read an aerial photograph and an orthoregistered image into the workspace.
aerial = imread('westconcordaerial.png'); ortho = imread('westconcordorthophoto.png');
Load some preselected control points for these images.
load westconcordpoints
whos
Name Size Bytes Class Attributes aerial 394x369x3 436158 uint8 fixedPoints 4x2 64 double movingPoints 4x2 64 double ortho 366x364 133224 uint8
Open the Control Point Selection tool, specifying the two images along with the predefined control points.
cpselect(aerial,ortho,movingPoints,fixedPoints);
Create the cpstruct
structure. Using the Control Point Selection
tool, select Export Points to Workspace from the File menu to save the points to the workspace. On the Export Points to Workspace dialog box, check the Structure with all points check box, and clear Moving points of valid pairs and Fixed
points of valid pairs. Click OK. Close the Control
Point Selection tool.
Use cpstruct2pairs
to extract the moving
and fixed points from the cpstruct
.
[mPoints,fPoints] = cpstruct2pairs(cpstruct);
Compare the stored set of points with the set of points you exported.
fixedPoints, fpoints
fixedPoints = 164.5639 113.2890 353.5325 130.0798 143.4046 284.8935 353.5325 311.9810 fpoints = 164.5639 113.2890 353.5325 130.0798 143.4046 284.8935 353.5325 311.9810
The two sets of points are identical, which indicates that all points in the stored set of points belong to valid control point pairs.
Input Arguments
cpstruct_in
— Preselected control points
structure
Preselected control points, specified as a structure (cpstruct
). cpstruct_in
contains
information about the x- and y-coordinates
of all control points in the moving and fixed images, including unpaired
and predicted control points. cpstruct2pairs
eliminates
unmatched and predicted control points, and returns the set of valid
control point pairs.
cpstruct_in
is a structure produced by
the Control Point Selection tool (cpselect
)
when you choose the Export Points to Workspace option.
For more information, see Export Control Points to the Workspace.
Data Types: struct
Output Arguments
movingPoints
— Control point pairs from moving image being aligned
m-by-2 numeric array
Control point pairs from image being aligned, returned as an m-by-2 numeric array. The two columns represent the x- and y-coordinates of the control points, respectively, in the intrinsic coordinate system of the image.
Data Types: double
fixedPoints
— Control point pairs from reference image
m-by-2 numeric array
Control point pairs from reference image, returned as an m-by-2 numeric array. The two columns represent the x- and y-coordinates of the control points, respectively, in the intrinsic coordinate system of the image.
Data Types: double
Extended Capabilities
Thread-Based Environment
Run code in the background using MATLAB® backgroundPool
or accelerate code with Parallel Computing Toolbox™ ThreadPool
.
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Version History
Introduced before R2006aR2021b: Support for thread-based environments
cpstruct2pairs
now supports thread-based
environments.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)