CS 5320
Spring Semester 2004

 
Problem 1-3

 
Assigned: 26 August 2004
Due: 9 September 2004
 

Develop a Matlab code to simulate a pinhole camera.  Here is the header:

function [image_pts,image_lines] = CV_pinhole_camera(pts, lines, T, f)
% CV_pinhole_camera - simulate a pinhole camera
% Call:
%     [p1,l1] = CV_pinhole_camera([1 1 1; 1 0 1], [0 0 0 1 0 0; 1 0 0 1 1 0],[1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1],2);
% On input:
%     pts (mx3 array): set of 3D points
%     lines (nx6 array): each row has the 2 endpoints of the line segment
%     T (4x4 array): transformation matrix
%     f (float): z value of image plane (may be positive or negative)
% On output:
%     image_pts (mx3 array): projection of pts onto image plane
%     image_lines (nx6 array): projection of lines onto image plane
% Custom Functions Used:
%      none
% Author:
%     <Name>
%     Fall 2004
% Method
%     See Forsyth and Ponce, Chapter 2
% Testing % CV_pinhole_camera - simulate a pinhole camera
% Call:
%     [p1,l1] = CV_pinhole_camera([1 1 1; 1 0 1], [0 0 0 1 0 0; 1 0 0 1 1 0],[1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1],2);
% On input:
%     pts (mx3 array): set of 3D points
%     lines (nx6 array): each row has the 2 endpoints of the line segment
%     T (4x4 array): transformation matrix
%     f (float): z value of image plane (may be positive or negative)
% On output:
%     image_pts (mx3 array): projection of pts onto image plane
%     image_lines (nx6 array): projection of lines onto image plane
% Custom Functions Used:
%      none
% Author:
%     <Name>
%     Fall 2004
% Method
%     See Forsyth and Ponce, Chapter 2
% Testing
% >> [p1,l1] = CV_pinhole_camera([10,10,-10; 9 9 -10], [1 0 -3 1 1 -3], ...
% [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1], 1)
%  p1 =        -1.00         -1.00
%              -0.90         -0.90
%  l1 =     -0.33             0         -0.33         -0.33
% >>