Compare two images and match features

I am trying to match features for two images (files attched) which are developed using two different CAD software but are almost the same. Their resolution is different. I am not able to match the features of the two images using any of the extractfeatures options. How can I approach this problem ? I even tried the scale invariant extractfeatures commands. I am developing a software where I compare these two images and grade them.

댓글 수: 5

Image Analyst
Image Analyst 2017년 6월 30일
What is the feature? The percentage of the way across horizontally each vertical line is? You have to tell us. What features did you extract? Were those the ones you really needed or wanted? What does "grade" mean to you?
sanchit ingale
sanchit ingale 2017년 7월 14일
I need to compare these two images and give a grade accordingly. I use Harris Features and extract them currently. But it is not working. As you can see the above two images are almost the same. The application should recognize this and give the grade accordingly. Here grade means points for a correct answer, the grading rubric for which i have already added to the application.
sanchit ingale
sanchit ingale 2017년 7월 14일
편집: sanchit ingale 2017년 7월 14일
This is what I currently do...
%% Load all possible cases
I2=imread('3_SlideBlock.png'); % Without hatching and features
I3=imread('4_SlideBlock.png');% Without hatching I4=imread('4_SlideBlock_2.png'); % Without features
I5=imread('5_SlideBlock.png'); % Correct drawing
I6=imread('2_SlideBlock.png'); % Wrong View
I7=imread('2_SlideBlock_2.png'); % Wrong View
I8=imread('2_SlideBlock_3.png'); % Wrong View
%% Grayscale conversion
I1_gray=im2bw(I1);
I2_gray=im2bw(I2);
I3_gray=im2bw(I3);
I4_gray=im2bw(I4);
I5_gray=im2bw(I5);
I6_gray=im2bw(I6);
I7_gray=im2bw(I7);
I8_gray=im2bw(I8);
%% Scale Image
I1_gray=imclearborder(I1_gray);
I2_gray=imclearborder(I2_gray);
I3_gray=imclearborder(I3_gray);
I4_gray=imclearborder(I4_gray);
I5_gray=imclearborder(I5_gray);
I6_gray=imclearborder(I6_gray);
I7_gray=imclearborder(I7_gray);
I8_gray=imclearborder(I8_gray);
points1 = detectSURFFeatures(I1_gray);
points2 = detectSURFFeatures(I2_gray);
points3 = detectSURFFeatures(I3_gray);
points4 = detectSURFFeatures(I4_gray);
points5 = detectSURFFeatures(I5_gray);
points6 = detectSURFFeatures(I6_gray);
points7 = detectSURFFeatures(I7_gray);
points8 = detectSURFFeatures(I8_gray);
%% Extract neighbourhood features
[features1,valid_points1] = extractFeatures(I1_gray,points1);
[features2,valid_points2] = extractFeatures(I2_gray,points2);
[features3,valid_points3] = extractFeatures(I3_gray,points3);
[features4,valid_points4] = extractFeatures(I4_gray,points4);
[features5,valid_points5] = extractFeatures(I5_gray,points5);
[features6,valid_points6] = extractFeatures(I6_gray,points6);
[features7,valid_points7] = extractFeatures(I7_gray,points7);
[features8,valid_points8] = extractFeatures(I8_gray,points8);
if valid_points1.Count==valid_points2.Count valid_points1.Count==valid_points12.Count
c=1;
elseif valid_points1.Count==valid_points3.Count valid_points1.Count==valid_points13.Count c=2;
elseif valid_points1.Count==valid_points4.Count valid_points1.Count==valid_points14.Count
c=3;
elseif valid_points1.Count==valid_points5.Count || valid_points1.Count==valid_points15.Count
c=4;
elseif valid_points1.Count==valid_points6.Count valid_points1.Count==valid_points7.Count valid_points1.Count==valid_points8.Count valid_points1.Count==valid_points9.Count valid_points1.Count==valid_points10.Count valid_points1.Count==valid_points11.Count c=6;
else c=5;
end .
.
.
.
.
.
.
So I have basically uploaded all the possible answers to the code. So when I upload a similar image to any of these it should recognise it and give the grade accordingly (using value of 'c').
Image Analyst
Image Analyst 2017년 7월 14일
Sorry, I can't run it because I don't have the Computer Vision System Toolbox. But I think you'd be better off getting some features that mean something to you rather than just a bunch or arbitrary surf or sift salient points, which from what I've seen often give a lot of spurious points.
sanchit ingale
sanchit ingale 2017년 7월 14일
Thanks for the reply. Can you suggest any specific approach to this ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Vinoth Venkatesan
Vinoth Venkatesan 2017년 7월 21일

0 개 추천

I'm assuming your trying to match the features obtained between two sets of images and give scores according to the number of matches. I'm not sure about the count function that is being used, but a better way to compare features obtained from detectors like SURF is to use the descriptors associated with each detected feature that is output by the extractFeatures function ( refer here ).
There are a few ways to make these comparisons. You could use a Sum of Squared Differences (SSD) for example:
SSD = sum(features1(i) - features2(i).^2)
Here, the ith feature from sets 1 and 2 are being compared. If the SSD is below a tolerance value, the features can be matched. Refer to sum for information about array sum.

카테고리

도움말 센터File Exchange에서 Computer Vision Toolbox에 대해 자세히 알아보기

질문:

2017년 6월 30일

답변:

2017년 7월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by