Problem with image registration on images with simple patterns
Show older comments
I have trouble matching features on images with simple patterns like shown in two attached pictures. SURF, BRISK and other feature detection functions in CV toolbox work well with images rich in features but fail at these -see the attached result of automatic image registration. I tried every feature detection function the toolbox offers and tried changing various input parameters like thresholds, quality, contrast, octaves, filter sizes, etc without any luck. I also tried binarizing the images and separately HOG feature extractor. The script below that I used is straight from Matlab examples.
Can anyone (@Image Analyst @Walter Roberson) advise?
Thanks!
original = rgb2gray(imread('A0.png'));
ptsOriginal = detectSURFFeatures(original,'NumOctaves',1,'NumScaleLevels',5,'MetricThreshold',10);
[featuresOriginal,validPtsOriginal] = extractFeatures(original,ptsOriginal);
figure
distorted = rgb2gray(imread(sprintf('A2.png',k)));
subplot(121), imshowpair(original,distorted,'m'),
ptsDistorted = detectSURFFeatures(distorted,'NumOctaves',1,'NumScaleLevels',5,'MetricThreshold',5);
[featuresDistorted,validPtsDistorted] = extractFeatures(distorted,ptsDistorted);
indexPairs = matchFeatures(featuresOriginal,featuresDistorted);
matchedOriginal = validPtsOriginal(indexPairs(:,1));
matchedDistorted = validPtsDistorted(indexPairs(:,2));
[tform, inlierDistorted,inlierOriginal] = ...
estimateGeometricTransform(matchedDistorted,...
matchedOriginal,'similarity');
outputView = imref2d(size(original));
recovered = imwarp(distorted,tform,'OutputView',outputView);
subplot(122), imshowpair(original,recovered)

Accepted Answer
More Answers (1)
Image Analyst
on 19 Aug 2020
1 vote
I think the periodicity and enormous translations and rotations may be causing problem. You might try imregcorr().
Otherwise try segmenting out the rectangle using tradtional methods:
- Threshold the image
- call regionprops asking for centroids.
- fit a line with polyfit through the centroids to determine the angle
- Call imrotate
- threshold again and call regionprops
- call imtranslate to align with other, reference image.
or:
- Threshold the image
- call bwconvhull(mask, 'union')
- call regionprops asking for orientation
- call imrotate
- threshold again and call regionprops
- call imtranslate
2 Comments
Image Analyst
on 19 Aug 2020
Categories
Find more on Computer Vision with Simulink in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
