File Exchange

image thumbnail


version 1.10 (418 KB) by

M. Pollefeys, R. Koch and L. Van Gool, A simple and efficient rectification method for general motio

1 Download


Polar rectification

Comments and Ratings (9)


Adam (view profile)

I would like to try your implementation. Unfortunately, if I call main method returns me an error (bellow). Could you please give me some hint what I am doing wrong.

i1 = rgb2gray(imread('left.JPG'));
i2 = rgb2gray(imread('right.JPG'));

blobs1 = detectSURFFeatures(i1, 'MetricThreshold', 2000);
blobs2 = detectSURFFeatures(i2, 'MetricThreshold', 2000);

[features1, validBlobs1] = extractFeatures(i1, blobs1);
[features2, validBlobs2] = extractFeatures(i2, blobs2);

indexPairs = matchFeatures(features1, features2, 'Metric', 'SAD', 'MatchThreshold', 5);

P1 = validBlobs1(indexPairs(:,1),:);
P2 = validBlobs2(indexPairs(:,2),:);

[F] = estimateFundamentalMatrix(P1,P2);

[i1_rect,i2_rect] = rect_pollefeys(i1,i2,F);

Undefined function 'svd' for input arguments of type 'uint8'.

Error in null (line 67)
[~,S,V] = svd(A,0);

Error in rect_pollefeys (line 23)
e1 = null(F);

Alex Kreimer

Please ask your question on and send me the link to alex.kreimer at gmail. You'd probably need to provide more detail than you just did.

vipil vinod

hey alex i need to find the depth map of roated and translated image.i have found out the epipolar line..since its not parrellel i cant find the corresponding points..can u pls help me??


Dave (view profile)

Hi Alex,
Thanks for the update. I downloaded again but still can't see the get_ps( ) function. Which file is it meant to be in?


Alex Kreimer

Hi Dave, I've updated the submission with the missing file. I will take a look at the issue you're having, probably within a week or so.


Dave (view profile)

Also seems to be missing a function get_ps which is invoked from rect_pollefeys at lines 54 and 55. Where can I find this one ?



Dave (view profile)

The issue seems to be with handling the epipole when it's in the image bounds, i.e. in quadrant 5. The error comes at the end of epip_quadrant when the bounding vertices are assigned to P.

It should be possible (in terms of the algorithm) to assign both bounds to the same vertex but not sure if the remainder of the code will handle this.


Dave (view profile)

Hi Alex,

Thanks for posting this, I've built a C implementation of this code and have been looking for something to benchmark against for some time.

I'm having issues running the code at the moment and am about to try debugging but on the off chance you have already found the problem, I'm getting:

??? Attempted to access ii_c(1); index out of bounds because numel(ii_c)=0.

Error in ==> epip_quadrant at 62
p(:,1) = im_corners(:,ii_c(1));

Error in ==> get_theta at 8
p = epip_quadrant(e,dim);

Error in ==> get_theta_bounds at 3
[theta1,~] = get_theta(e1,dim);

Error in ==> rect_pollefeys at 29
thetas = get_theta_bounds(e1,e2,F,[w,h]);

My F is:
0.0000 -0.0001 0.0090
0.0001 0.0000 -0.0121
-0.0123 0.0094 0.4394

and image sizes are 320 rows x 180 columns

Will let you know if I find a fix.



wj (view profile)



The initial version was buggy, hope this is better

MATLAB Release
MATLAB 7.13 (R2011b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video