Image registration, manual control point, FAIL

10 views (last 30 days)
Karl
Karl on 22 Jul 2013
We are trying to use manual selection of control points to align two images. It failed for our image dramatically, while the demo works very well. In order to test it we placed four crosses on our image (using an image editor), then moved the four crosses and resaved as a second image. Then we load the two images into matlab, use the cpselect tool to place four control points (one on each cross). We then use cp2tform to construct a transform structure (it does not return any 'bad' points), finally we use imtransform to transform the second image. When we compare the reuslt is not aligned.
x = rgb2gray(imread('t1.jpg', 'JPG'));
y = rgb2gray(imread('t2.jpg', 'JPG'));
figure;
imshowpair(x,y,'ColorChannels','red-cyan')
cpselect(y,x);
inPtsCorr = cpcorr(y_points,x_points,y,x);
[tForm, input_points, base_points, input_points_bad, base_points_bad] = cp2tform (inPtsCorr, x_points, 'similarity');
tY = imtransform(y, tForm);
figure;
imshowpair(x,y,'ColorChannels','red-cyan')
figure;
imshowpair(x,tY,'ColorChannels','red-cyan')
Any suggestions? We are new to image processing and pretty stuck.
Thanks!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!