DOC PREVIEW
MIT 6 111 - Virtual Ping Pong

This preview shows page 1-2-3-4-5-6-7-8-9-10-11-12-13-90-91-92-93-94-95-96-97-98-99-100-101-180-181-182-183-184-185-186-187-188-189-190-191-192 out of 192 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 192 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Virtual Ping PongZachary Clifford and Mark StevensDecember 15, 20071 OverviewThe Virtual Ping Pong game uses a Xilinx Virtex-II FPGA chip to implement a virtual ping ponggame with a video camera and a physical paddle. The user stands in front of the system cameraand holds a bright red ping pong paddle. The screen s hows a fake three dimensional playfield witha ball bouncing in it. The user then hits the ball back into the screen to play against himself oranother player. In its multiplayer configuration the project utilizes two labkits to allow two playersto hit the ball back and forth.Figure 1: Project Overview12 Vision Overview (M. Stevens)Figure 2: Vision SystemEach labkit in the game uses a camera to capture the image of a player and his paddle. Inmultiplayer mode, this is the opponent’s paddle, while in single player mode, it is the user’s paddle.All such distinctions are handled by the multiplayer module; the vision modules process the datathe same in either case. Data from the camera arrives in serial YCrCb at roughly 27MHz. In orderto play the game, the following processing must be done with the incoming data stream:• Conversion of serial stream into 30 bits of YCrCb data• Conversion from YCrCb to RGB• Storage of RGB pixels into a ZBT memory• Reading RBG pixels back out of the ZBT to be displayed on screen• Detection of red pixels (in YCrCb) that denote the paddle• Filtering of red pixels to remove noise• Calculation of edges and corners of the paddle• Calculation of the X, Y, and Z velocity of the paddle• Calculation of paddle tilt• Coordinate conversion of paddle edges and velocities to be sent to game logic• Optional display of debugging modeTo achieve this functionality, three different groups of modules are used: preprocessing and storage,image procesing, and debugging.23 Vision - Preprocessing and StorageFigure 3: Vision Preprocessing and Storage3.1 Data PreprocessingThe first two modules that preprocess the data are adv7185init and ntsc decode. These moduleswere taken directly from previous years. adv7185init initializes the camera; ntsc decode translatesNTSC serial data into much more useful YCrCb data. It also outputs when the vertical and hori-zontal syncs happen on the camera.Next, YCrCb data is converted into RGB data. Again, the module to do this, YCrCb2RGB,came from a previous year.3.2 Data StorageOnce RGB data is available, it can be stored to the ZBT memory. This process uses the wrapperblock for the ZBT, zbt 6111. In order to use the memory to read and write at the same time, twopixels must be stored for each address in the ZBT. This allows the memory to alternate betweenreading and writing; it reads and writes every other cycle, getting two pixels of information at eachtime, so that full information can be transmitted.The key module in doing this conversion is ntsc to zbt center, which is based on the 2005 codentsc to zbt. However, our module stores two pixels per address, instead of four (allowing 18 bits perpixel), and it rescales the locations in memory. The purpose of this data is to be able to render theopponent in the center of the screen, so pixels are stored in memory pixels that map to coordinatesin the center of the scree n. This image is also scaled by a factor of two, so the ntsc to zbt centermodule stores every other pixel into memory. On the other end, the image is displayed below any ofthe game objects. Display uses code from 2005, again altered to use two 18 bit pixels per memory3address instead of four 9 bit pixels.The ntsc to zbt module, which is similar and will be discussed in the debugging se ction, alsooutputs X and Y coordinates for each pixel produced by the camera.4 Vision - Image ProcessingFigure 4: Vision Preprocessing and Storage4.1 Paddle Pixel DetectionThe first stage of image processing is determining which of the pixels are part of the paddle. Thisprocess is done with two m odules. First, the isPaddle module determines whether or not a pixel iswithin the proper threshold of Y, Cr, and Cb values to be red. These are adjustable by switcheson the labkit, but good values are preloaded.A boolean value of whether or not the pixel was the right color, along with the coordinates ofthat pixel, is then passed on to the low pass filter module, lpf. This module looks for a certainpercentage of recent pixels (those to the left of the current pixel) to also be red, based on valuesstored in a shift register. It also checks values above; this is done by using a small block RAM torecord whether or not the past few pixels in each column were red, and then shifting these valuesafter they are used to determine whether the current pixel is part of the paddle.While the data coming out of the color detection is very noisy, the final filtered result detectsonly relatively large red/orange blobs.4.2 Paddle CalculationsOnce pixels are determined to be part of the paddle, they can be used to perform a number ofcalculations:4• Calculate the edges of the paddle, which is done by get extrema within paddle boundaries.The module keeps track of the max/min of the value passed in, and returns the result afterevery camera frame. The module is instantiated four times, using generics to change betweentracking max and min.• Calculate the corners of the paddle, which is done by get extrema signed within paddle boundaries.The corners can be find by maximizing/minimizing the sum of X and Y values; for instance,the bottom right corner will have the greatest X + Y value, and the top right corner will havethe greatest X − Y value.• Calculate paddle velocity, which is done by the lateral velocity and forward velocity. Forlateral velocity, the midpoint of the paddle is calculated, and a simple difference equationis used to approximate the velocity. For forward velocity, the change in calculated paddlearea, as calculated by multiplying the height and width of the paddle, is used to approximatevelocity in the Z direction.• Calculate paddle tilt, which is done by using the height/width ratio of the paddle in thetilt calculation module. This ratio is fed into a ROM I generated, which outputs an angle indegrees. The angle is then made positive or negative by whether the top or bottom of thepaddle is wider (as determined by corners). For instance, if the top of the paddle is fartheraway, the width observed between the top corners is shorter, so the paddle tilt is positive.• Adjust the paddle velocities to take into account the paddle


View Full Document

MIT 6 111 - Virtual Ping Pong

Documents in this Course
Verilog

Verilog

21 pages

Video

Video

28 pages

Bass Hero

Bass Hero

17 pages

Deep 3D

Deep 3D

12 pages

SERPENT

SERPENT

8 pages

Vertex

Vertex

92 pages

Vertex

Vertex

4 pages

Snapshot

Snapshot

15 pages

Memories

Memories

42 pages

Deep3D

Deep3D

60 pages

Design

Design

2 pages

Frogger

Frogger

11 pages

SkiFree

SkiFree

81 pages

Vertex

Vertex

10 pages

EXPRESS

EXPRESS

2 pages

Labyrinth

Labyrinth

81 pages

Load more
Download Virtual Ping Pong
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Virtual Ping Pong and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Virtual Ping Pong 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?