I have to use control points to improve finding the same part of an image in another one.
by using this code, the control points coordinate determined but I want to display matched area in Image2.
Indead I want to crop a part of Image1, then finding that in Image2 by control points.
how can I find coordinate to crop this founded area?
My code:
- scale = 1;
- J = imresize(Image1, scale); % Try varying the scale factor.
- theta = 90;
- distorted = imrotate(J,theta); % Try varying the angle, theta.
- ptsOriginal = detectSURFFeatures(Image2);
- ptsDistorted = detectSURFFeatures(distorted);
- [featuresOriginal, validPtsOriginal] = extractFeatures(Image2, ptsOriginal);
- [featuresDistorted, validPtsDistorted] = extractFeatures(distorted, ptsDistorted);
- indexPairs = matchFeatures(featuresOriginal, featuresDistorted);
- matchedOriginal = validPtsOriginal(indexPairs(:,1));
- matchedDistorted = validPtsDistorted(indexPairs(:,2));
- x1 = matchedDistorted.Location(1,1)
- y1 = matchedDistorted.Location(1,2)
- DisplayMatchArea=imcrop(B,[x1 y1 size(distorted,2)-1 size(distorted,1)-1]);