Get from Ico-github-logo

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

» Watch video

Highlights from

  • F_transfer_l(H,l1)
  • P_from_KRt(K,R,t)
    FULL CALIBRATION from camera intrinsics (K) and rigid transformation (R,t)
  • e2h(e)
  • epip_quadrant(e,dim)
    Cartesian space is split into 9 parts as in the image below. This function
  • get_pixel(im,p)
  • h2e(h)
  • im_pixel_points(l,e,dim)
    line equations of image boundaries
  • im_polar_cone(e,dim)
    Consider polar coordinate system with origin at the epipole e; also
  • im_project(im,ps,rr,dim)
  • l_from_theta_p(theta,p)
  • numcols(m)
  • numrows(m)
  • plot_line_in_image(l1)
  • read_and_convert(n)
    read camera parameters and convert into 3 by 4 matrix
  • rect_pollefeys(F,i1,i2)
    function [i1_rect,i2_rect] = rect_pollefeys(i1,i2,F)
  • vgg_F_from_P(P, P2)
    F = vgg_F_from_P(P) Compute fundamental matrix from two camera matrices.
  • xprodmat(a)
    Matrix representation of a cross product
  • rectify_sequence.m
  • View all files
4.0 | 1 rating Rate this file 6 Downloads (last 30 days) File Size: 418 KB File ID: #42209 Version: 1.10




13 Jun 2013 (Updated )

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

| Watch this File

File Information

Polar rectification

MATLAB release MATLAB 7.13 (R2011b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
31 Oct 2013 Adam

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);

Comment only
15 Oct 2013 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.

Comment only
15 Oct 2013 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??

Comment only
08 Jul 2013 Dave

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?


Comment only
30 Jun 2013 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.

Comment only
29 Jun 2013 Dave

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 ?


Comment only
29 Jun 2013 Dave

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.

Comment only
29 Jun 2013 Dave

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.


Comment only
15 Jun 2013 wj

wj (view profile)

17 Aug 2015 1.10

The initial version was buggy, hope this is better

Contact us