Finding Transformation for Image registration with stereo Images

9 次查看(过去 30 天)
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

回答(2 个)

Matt J
Matt J 2012-11-23
Did you examine the intermediate quantities produced by the code? Does the edge map look reasonable? Do the matched_points look reasonable?
Use the debugger to step through the code and examine these things.

Ryan
Ryan 2012-11-23
Yea I have tried that, I mean the edge map does look reasonable, There are still outliers here and there. I can't seem to get rid of all the outliers though, no matter how I manipulate the estimateFundamentalMatrix Function. So i guess I take back my first statement. I just looked over everything again and I have 600+ matches and about 100+ are still outliers even after manipulating the estimateFundamentalMatrix function to the full extent to get rid of outliers. I've tried all the methods such as Ransac and LTS along with w.e other methods are available.

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by