Complete the above given python starter code for a ju

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question

Complete the above given python starter code for a jupyter notebook based off project description.

Generating a World to Camera Transformation
To visualize the 3D body model, we will render it from a desired camera viewpoint, by filling in
the values of a rigid transformation relating camera to world. This transformation task is likely
to be the easiest, because it directly corresponds to a procedure we talked about in class and that
also appears in the textbook in the chapter on Viewing. Choose an eye position (camera location
in world coordinates), a gaze direction (aka look direction vector), and an up direction that in
this case will be the positive Z axis of the world, just follow the procedure that generates the
translation and rotation matrices that form the World to Camera (canonical to frame) change of
basis transformation.
Due to our earlier normalization of the body into a predetermined location and orientation, we are
more easily able to specify a camera viewpoint that is meaningful relative to the body. For example,
if we place the camera on the positive Y axis of the world, looking back along the negative Y axis
towards the origin, we should see a frontal view of the body. Similarly, if the camera is on the
positive X axis of the world looking back along the negative X axis towards the origin, we should
see the right side of the body. And so on.
This is a good time to remind you that we want you to compute the numerical entries of the rotation
and translation matrices yourself, using numpy and linear algebra ideas that we have been going
over in lectures. Pytorch3D has a function called "look_at_view_transform". Do not use that
function. We may use such higher level, more efficient functions in future projects, but the whole
point of this project is to understand how to specify the geometric transformations ourselves, at a
fundamental level of detail.
For that matter, you are cautioned that Pytorch3D represents points as row vectors, and therefore
when it makes a transformation matrix, it is the transpose of how we defined things.
Transcribed Image Text:Generating a World to Camera Transformation To visualize the 3D body model, we will render it from a desired camera viewpoint, by filling in the values of a rigid transformation relating camera to world. This transformation task is likely to be the easiest, because it directly corresponds to a procedure we talked about in class and that also appears in the textbook in the chapter on Viewing. Choose an eye position (camera location in world coordinates), a gaze direction (aka look direction vector), and an up direction that in this case will be the positive Z axis of the world, just follow the procedure that generates the translation and rotation matrices that form the World to Camera (canonical to frame) change of basis transformation. Due to our earlier normalization of the body into a predetermined location and orientation, we are more easily able to specify a camera viewpoint that is meaningful relative to the body. For example, if we place the camera on the positive Y axis of the world, looking back along the negative Y axis towards the origin, we should see a frontal view of the body. Similarly, if the camera is on the positive X axis of the world looking back along the negative X axis towards the origin, we should see the right side of the body. And so on. This is a good time to remind you that we want you to compute the numerical entries of the rotation and translation matrices yourself, using numpy and linear algebra ideas that we have been going over in lectures. Pytorch3D has a function called "look_at_view_transform". Do not use that function. We may use such higher level, more efficient functions in future projects, but the whole point of this project is to understand how to specify the geometric transformations ourselves, at a fundamental level of detail. For that matter, you are cautioned that Pytorch3D represents points as row vectors, and therefore when it makes a transformation matrix, it is the transpose of how we defined things.
# create a default 4x4 homogeneous transform matrix
Mcam = np.zeros((4, 4))
Mcam [0,0] = 1.0
Mcam [1, 2] = 1.0
Mcam [2,1] = -1.0
Mcam [2,3]
30.0;
=
Mcam[3,3] = 1.0
# Your job is to fill matrix Mcam in properly, given an eye position,
# a lookat vector (e.g. looking towards a point on the object), and
# an up vector (in our case, the world +Z axis)
EyeXYZ = []
LookAtXYZ = []
UpVector = np.array ( [0.,0.,1.])
#add your code here
#print out the transformation matrix
print('Mcam transformation matrix is: ')
print (Mcam)
Mcam transformation matrix is:
[[ 1. 0. 0. 0.]
[ 0. 0. 1. 0.]
[ 0. -1.
0. 30.]
[ 0. 0. 0.
1.]]
Transcribed Image Text:# create a default 4x4 homogeneous transform matrix Mcam = np.zeros((4, 4)) Mcam [0,0] = 1.0 Mcam [1, 2] = 1.0 Mcam [2,1] = -1.0 Mcam [2,3] 30.0; = Mcam[3,3] = 1.0 # Your job is to fill matrix Mcam in properly, given an eye position, # a lookat vector (e.g. looking towards a point on the object), and # an up vector (in our case, the world +Z axis) EyeXYZ = [] LookAtXYZ = [] UpVector = np.array ( [0.,0.,1.]) #add your code here #print out the transformation matrix print('Mcam transformation matrix is: ') print (Mcam) Mcam transformation matrix is: [[ 1. 0. 0. 0.] [ 0. 0. 1. 0.] [ 0. -1. 0. 30.] [ 0. 0. 0. 1.]]
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education