Finding Transformation for Image registration with stereo Images
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello I am running tests right now trying to take a pair of stereo images and compute a transformation matrix that transforms one of the images directly on top of the other image. My problem is when I run my code below the matrix that it spits out when applied to one of the images sends back a black image of all 0's. I need to be able to use the canny edge detection match points and then create a transformation from those matched points. Please I need help and suggestions, look below to see what i have tried. function [f] = imginterp( img1, img2 )
tic %%%%% Canny Edge Detection
color1=img1; %Save color image
gray1= im2double(rgb2gray(img1)); % make image a grayscale image Canny1=vision.EdgeDetector('Method','Canny','GaussianFilterStandardDeviation',2,... 'NonEdgePixelsPercentage',94); % create the canny matrix
binaryimg1= step(Canny1,gray1);% apply canny matrix to image
[x1 y1]=find(binaryimg1==1); % find coordinates of 1 values
img1coor(:,1)=x1; %store x values in variable first column
img1coor(:,2)=y1; %store y values in variable second column [features1, valid_points1] = extractFeatures(gray1, img1coor);% Stores features I am going to match
%Repeat for second image
color2=img2; %Save color image
gray2= im2double(rgb2gray(img2)); % make image a grayscale image Canny2=vision.EdgeDetector('Method','Canny','GaussianFilterStandardDeviation',2,... 'NonEdgePixelsPercentage',94); % create the canny matrix binaryimg2= step(Canny2,gray2);% apply canny matrix to image
[x2 y2]=find(binaryimg2==1);% find coordinates of 1 values
img2coor(:,1)=x2; %store x values in variable first column
img2coor(:,2)=y2; %store y values in variable second column
[features2, valid_points2] = extractFeatures(gray2, img2coor);% Stores features I am going to match
index_pairs = matchFeatures(features1, features2); % Indexed Matched features
matched_points1 = valid_points1(index_pairs(:, 1), :); % Select the features that were matched
matched_points2 = valid_points2(index_pairs(:, 2), :);% Select the features that were matched
[F Inliers_Index] = estimateFundamentalMatrix(matched_points1,matched_points2, 'Method','RANSAC','NumTrials',1000,... 'DistanceType', 'Sampson','DistanceThreshold', .00001); % Use Ransac to get rid of outliers and then estimate a transformation % between left over points.
end
0 Kommentare
Antworten (2)
Matt J
am 23 Nov. 2012
Did you examine the intermediate quantities produced by the code? Does the edge map look reasonable? Do the matched_points look reasonable?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!