|
|
|
Instructor: |
Irfan Essa Office Hours: After Class |
|
Location: |
CoCB 102 |
|
TA: |
James
Vanderhyde Office Hours: Wed/Thu 10:15a-11:45a in DML |
Day/Time: |
Tuesday - Thursday 12:05pm-1:25pm |
|
|
TA: |
Jarsolav Tyman
Jr. Tues, Wed, Thurs: 3:30p-4:30p in DML or by appointment |
Labs: |
Digital Media Lab (DML) (IntelPCs) (CCB
104a), & |
Main Menu
Previous Classes
![]()
|
PS2b: Match Moving, Details.(By Gabriel Brostow, TA for DVFX 1999-2002).] Sections: [ Out from PS2a | Mapping to MAYA | Calibration Pattern | Modeling in MAYA | Rendering | Submission ] 1. Output from PS2a:If all is well you will have submitted something like the following for
PS2: Adding CG to live, VIDEO, part a, following
PS2a: Camera Calibration Specifics.
2. Mapping to MAYA:Hand-calculations for mapping the above
intrinsics to Maya-compatible form.
4. Modeling in MAYA: Now we'll start modeling our pattern and our cameras in Maya, with the goal of rendering a replica from two angles which looks like the raw footage. Perform the following actions:
Create->Polygon Primitives->Plane (now a plane appears, centered at the origin). Beware: Some Maya sessions may be not be set to create planes in the z=0 plane by default. If your plane isn’t purely in the xy plane, create a new one, and use the “custom” box at the right of the menu entry for ->Plane so you can specify the Z-plane radio button. Hit Ctr-A to view its attributes Go to the PolyPlane tab, and adjust the settings for the overall width/height of the plane, as well as the number of subdivisions (should be same as # of squares in your pattern). While you're here, change the Texture setting to "Preserve Aspect Ratio." Go to the pPlane settings tab and type into the Translate (x and y) fields amounts that will move the plane so it fits wholly in the positive_x and positive_y quadrant. That will be half of the pattern's width and height (in cm). Go to the pPlaneShape tab and the settings for Mesh Component Display: here you'll want the backface culling to be off, since we'll be looking at the underside of the plane. To make the pattern look pretty, you'll want to do:
Now select the plane in the scene and right-click on the checker material's icon to "Assign Texture's Material to Selection." You now have a calibration pattern which should be the same size and look as the one you used to calibrate the extrinsics of your scene. Create->Lights->Point Light will be needed at some point so your nice checker model isn't pitch black. Move it around after you perform the steps below to add the camera. So far, this was the easy part. 5. Render:Save your file now, and as frequently as you can remember.
In main Maya app, pick a window, and Panel->Perspective->Camera1 Note: If you only have one panel on the screen and want to have more, use Window->View Arrangement->Four In the same window, pick Shading->"Smooth Shade All" Also under Shading, switch on Hardware Texturing if possible. Fine time to save your work. You should still not be seeing much in the camera's panel. I like to peek at the state of the world by using a different panel and switching it to a perspective view, which I can move around: Panels->Perspective->persp. Alt-Shift middle-mouse-button and Alt-shift left button allow you to translate and rotate the scene, which should currently contain a camera and a pattern both sitting at the origin. If you've saved your work, you might want to play with translating and rotating the camera to make the CG "model" line-up with the image of the model. Alt-r and Alt-t reveal rotation and translation handles you can mouse around with to manipulate the camera or the model. Leave the model alone, but do your best by moving the camera. This is hard, and once you're done wasting your time, you'll proceed to the following instructions, because you'll realize that a little math is easier than ALOT of clicking and dragging. It's important that you realize that what follows IS part of the assignment, but, strictly speaking, isn't necessary for rendering CG to go with your footage. Why? Your virtual camera now projects 3D objects in almost the same way as your real camera did (more later on why not 100%). That means the two cameras' intrinsics match. Since the camera didn't move, you could (theoretically) start inserting CG flying elephants and they would enter and leave the field of view in the right fashion, assuming you modeled them to scale (using cm units as we specified earlier). This means that you could theoretically get by without extrinsic calibration at all. So who needs the external parameters of the camera (rotation and translation)? Doing a match-move certainly requires it, and actually needs the R and t for each frame of footage. But even when the camera is static, it's nice to do the following steps, because then you can line-up the ground-planes (or wall planes if that's where you put the calibration pattern) with the cardinal directions within Maya. You can texture and place new CG objects in the scene, and they should line-up in each camera for which you calculate the extrinsic parameters. That's more than just a little useful if you intend to replace walls or match up foot-falls. It's especially handy if you've calibrated multiple cameras and want them all in the same CG scene. To remove ambiguity about rotation order pre/post multiplication, we're just going to enter our transformation matrices directly. Note that Maya matrices are transposed versions of the Foley et al. notation, so, for example, translation in the x directions would go in the bottom left of a 4x4 matrix. Window->General Editor->Script Editor Note: type the following commands in the bottom panel, and use Edit->Execute or Ctrl-Enter to execute them. The help contains more on MEL-scripting, but all you'll need is given below. Click-select the camera. type:
setAttr "camera1.rotateX" 3.1415926; <execute the above calls> (-m stands for matrix) What just happened? The camera was sent back to the origin, and back to pointing in the default direction: -Z. Our calibration was done with the model origin in the upper left and assumed the camera was looking toward +Z, so the second call just rotated the camera about the x axis to make that true for the virtual camera too: we're still sitting at (0,0,0), but facing +Z. Notice that the panel showing the view through the camera has color-axes in the lower left, and x and y are pointing to the right and down respectively. Now dust off the inverted version of the camera's extrinsic transformation matrix. Transpose it, and perform the following relative (hence the "-r") xform: type (substituting your own matrix in place of my 4x4):
Save your work. You should be seeing a CG model (possibly with a checker-texture) sitting almost precisely on top of the part of the image where the real calibration model projected onto. If it's not perfect, don't get upset: the calibration optimized the camera extrinsics after modeling lens-distortion (kc in the intrinsic results). That's the one part of the calibration we can't get Maya to reproduce. The absence of lens-distortion means that your CG object may be SLIGHTLY off, but with the DV cameras we're using, won't explain gross mismatches, so at this point, you really should be seeing a rather good match. Render this out (using Render->Render to New Window, and File-Save Image).
Figure 2: Alignment is off because the extrinsics were estimated to include lens distortion, which is absent in this rendering. Now select your camera, and make a 2nd camera by doing Edit->Duplicate. This camera has all the same parameters (intrinsic and extrinsic) as the first, but you’ll reposition it to the other “home” camera position:
Then apply the other set of extrinsics:
To get it perfect, render out a second pair of images after translating (ONLY!) very slightly in the x and y directions (that's the dimension affected by distortion). The hand-adjusted offset should be less than a cm for either axis. Render these images out also: both are part of your submission for this part of the assignment.
Figure 3: Minor (< 1cm) hand adjustment of the camera
position (not rotation!) has compensated for the lack of lens distortion.
Lighting has also been adjusted slightly, and now the scene is ready for new
CG elements/action. Now model and render whatever you like, and render out a movie. Insert a simple CG object (like torus or cone) into the scene so it “belongs”: on floor or wall etc. Light and render to output a still/movie seen from both cameras, and submit it to the HW2 directory. For Maya help in general, hit F1 or look through the help-menu at the top right. The section on rendering (especially Ch.10) will help you through rendering out a sequence of images. Doing a search in the help on "background" will reveal a nice section which lays out how to composite and texture 3D objects on top of live-action images (like the home image) and image sequences (including movie files).
6. Submission:
|
|
Portions of the GT's CS4480/DVFX Web may be reprinted
or adapted for academic nonprofit purposes, providing the source is accurately
quoted and duly credited. The CS4480 Web © 1999-2004, College of Computing,
Georgia Institute of Technology. Last updated: January 21, 2004 04:19:09 PM. |