I don't know what to do when I call this function.

surf_main img1 = imread('1.jpg'); img2 = imread('2.jpg');
pts1 = detectSURFFeatures(rgb2gray(img1)); pts2 = detectSURFFeatures(rgb2gray(img2));
[features1, valid_points1] = extractFeatures(rgb2gray(img1), pts1); [features2, valid_points2] = extractFeatures(rgb2gray(img2), pts2);
match = match_surf(img1, img2. features1, features2, valid_points1, valid_points2);
match_surf function match = match_surf(img1, img2, features1, features2, valid_points1, valid_points2) s1 = size(valid_points1); s2 = size(valid_points2); points1 = []; points2 = [];
for(i=1:s1(1)) points1 = [points1; valid_points1(i).Location]; end
for(i=1:s2(1)) points2 = [points2; valid_points2(i).Location]; end
th = 0.6; match = [];
for i=1:s1(1) min = 100; for j=1:s2(1) d = norm(features1(i,:)-features2(j,:)); if(d<min) min2 = min; min = d; min_index = j; end end if(min/min2 < th) %matching = [matching; valid_point1(i).Location %valid_point2(j).Location]; match = [match; [points1(i,:) points2(min_index,:)]]; end end
end
--> If I write the contents of the match_surf function in surf_main, it works. But if I use the match_surf function in surf_main, like the one written in the upper code, surf_main, it doesn't work. What sholud I do? What's the problem?

Answers (0)

Categories

Tags

Asked:

on 9 Jul 2015

Community Treasure Hunt

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

Start Hunting!