Software Project: 3D Shape Compression - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Software Project: 3D Shape Compression

Description:

vertices (x,y,z) - floating precision. faces (a,b,c) integer precision. Overview. Compress ... Code should be gracefully parted into files and functions. ... – PowerPoint PPT presentation

Number of Views:56
Avg rating:3.0/5.0
Slides: 36
Provided by: cs189
Category:

less

Transcript and Presenter's Notes

Title: Software Project: 3D Shape Compression


1
Software Project 3D Shape Compression
  • Spring 2006

This presentation is based on the pdf document
2
Introduction
  • 3D Shape compression

3
Introduction
  • 3D Shapes in Computer Science
  • Graphic Library
  • Shape Compression
  • Mathematical (Algebraic) Tools

4
Overview
  • 3D Shapes contain millions of primitives

424,376 triangles
6.8 million triangles
8.2 million triangles
5
Overview
  • 3D Shape representation
  • vertices (x,y,z) - floating precision
  • faces (a,b,c) integer precision

6
Overview
  • Compress reduce amount of data in a lossy way
  • In our case reduce vertices data similar to jpeg
    technique
  • Compute a Laplacian matrix
  • Decompose matrix into a subset of significant
    eigenvectors
  • Represent compressed vertices using eigenvectors
    and a set of coefficients

7
Overview
  • Project suggested stepping stones
  • Parse 3d shape file into 3D shape data
  • Interface with the supplied graphic library
  • Implement the compression algorithm
  • Link whole project and test

8
3D Shape Representation
  • 3D shapes are represented by vertices and faces
  • A vertex holds the 3D coordinates of a point
    x,y,z.
  • A face is a triangle and holds 3 indexes to 3
    different vertices a, b, c (starting at zero)

9
Object File Format (off)
  • OFF n m 0
  • x1 y1 z1
  • x2 y2 z2
  • ...
  • xn yn zn
  • 3 a1 b1 c1
  • 3 a2 b2 c2
  • ...
  • 3 am bm cm
  • write a simple parser that reads off files

10
Off example
  • OFF 4 4 0
  • -0.500000 -0.500000 -0.500000
  • 0.500000 -0.500000 -0.500000
  • -0.500000 -0.500000 0.500000
  • -0.500000 0.500000 0.500000
  • 3 0 1 3
  • 3 0 2 3
  • 3 2 1 3
  • 3 0 1 2

11
Graphic Library Interface
  • Visualization and control of the 3D shapes.
    Functionality
  • left button rotation
  • right button translation
  • middle button zooms
  • 'q' quits program running
  • p' reads a number (number of coeff to use)
    from the user(input) and calls compress
  • 'r' reads a number (compression number k) from
    the user(input) and calls compute
  • 's' saves the screen into an image

12
Graphic Lib. Interface
  • void startLib() - starts the graphic library.
  • Once this function is called, your system steps
    into interactive mode.
  • You should call function at the end of your
    main() function.

13
Graphic Lib. Interface
  • void charge_arrays(float vertexarr, int
    nvertex, int facearr, int nface)
  • This function charges your model into the graphic
    library for display.
  • The only functionality that this function should
    perform, is to fill the parameters sent to this
    function
  • (vertexarr)3i xi, (vertexarr)3i1 yi,
    (vertexarr)3i2 zi
  • (facearr)3i ai, (facearr)3i1 bi,
    (facearr)3i2 ci,

14
Graphic Lib. Interface
  • void compute(int nbasis) computes the
    compression coefficients.
  • When the 'r' key is pressed, the user is prompted
    to enter the number of bases to use in this
    compression (compression number k).
  • After the user enters a number, the system calls
    compute(int nbasis)
  • Note you should call your algorithm
    implementation from this function call.
  • At the end, you should print to the screen the
    algorithm duration in milliseconds

15
Graphic Lib. Interface
  • void compress(int ncoeff) computes the
    compressed vertices.
  • When the p' key is pressed, the user is prompted
    to enter the number of coeff. to use in this
    compression
  • After the user enters a number, the system calls
    compress(int ncoeff)
  • If the user enters a non-valid number of
    coefficients (ncoeff lt 0 or ncoeff gt nbasis), no
    computation should take place and charge_arrays()
    should fill vertexarr with the original vertices
    (default).
  • Otherwise, the new vertices should be charged in
    subsequent calls to charge_arrays() after
    compress() finished.

16
Graphic Lib. Interface
  • void myexit() - performs a clean exit.
  • It is called upon pressing the 'q' key.
  • You should implement this function to make a
    clean and valid exit of your program (most
    important releasing all allocated memory).

17
Shape Compression
  • Compression algorithm
  • Build the Laplacian matrix based on shape
    connectivity (neighborhood between vertices).
  • Decompose Laplacian matrix into first k
    significant eigenvectors.
  • Project vertices on eigenvectors and obtain a set
    of compressing coefficients.

18
Laplacian Matrix
  • Assume a shape of n vertices where edges connect
    neighboring vertices
  • Adjacency matrix A is defined
  • Diagonal matrix D is defined s.t. (di is the
    degree of vi )

19
Laplacian Matrix
  • Laplacian matrix is L I DA

20
Matrix Decomposition
  • Goal given a symmetric matrix Anxn , find its k
    smallest eigenpairs (eigenvectors and
    eigenvalues).
  • Power Method finds the dominant eigenvector
  • Graham Schmidt Orthogonalization finds the first
    k eigenvectors

21
Power Method
  • A method that finds the dominant eigenpair of a
    non-singular matrix A.
  • Basic idea is that multiplication of any random
    vector with a high power of the matrix A, results
    in an approximation of the dominant eigenvector.

22
Power Method
  • Given a symmetric matrix Anxn with ordered
    eigenvalues
  • Any vector Xn can be written as a linear
    combination of n linearly independent eigen
    vectors V1,, Vn

23
Power Method
  • Thus
  • Applying matrix powers
  • Dividing by ?1 we get

24
Power Method
  • To get ?1
  • And the corresponding eigenvector V1
  • Therefore

25
ConvergenceExample
  • Convergence condition
  • Example

26
Matrix Decomposition
  • Overview
  • start with k random vectors and iteratively
    multiply them by the A (power method).
  • at each iteration orthogonalize the k vectors
    using the Graham Schmidt

27
Matrix Shifting
  • Goal obtain the k vectors of the k smallest
    eigenvalues
  • Preconditioning for symmetric matrices
  • invert eigenvalue order (x-1)
  • translate eigenvalues to be positive (A1I)

-1
A1I
28
Graham Schmidt orthog.
  • Start with k random vectors (X1,X2,Xk)
  • At each iteration (AmX) orthogonalize each vector
    with its previous vectors

29
Vertex Compression
  • Goal given a set of eigenvectors of the k
    smallest eigenvalues of the Laplacian matrix L
    compress vertices
  • Project vertices on eigenvectors and obtain a set
    of 3k coefficients.
  • Coefficients together with adjacency matrix
    encode 3D shape

30
Coefficients Computation
  • Denote V1, V2,...,Vk the set of eigenvectors
  • Denote X,Y and Z the vectors of the x,y and z
    coordinates

31
Coefficients Computation
  • Projection of vertices onto the set of
    eigenvectors bases
  • Compressed vertices are obtained by
    multiplication of coefficients x vectors

32
Implementation Requirements
  • Power Method Implementation and Testing
  • Simple Power Method
  • Matrix Decomposition
  • Compress Input/Output
  • Error Handling and Robustness
  • Coding and Compilation

33
Power Method Implementation and Testing
  • Simple Power Method
  • void dominant_eig(float matrix, int size, float
    precision, floateig_vec, float eig_val)
  • dominant_eig_test.exe dim epsilon
  • Matrix decomposition
  • void matrix_decomp(float matrix, int size,
    float precision, float eig_vec, float
    eig_val, int k)
  • matrix_decomp_test.exe dim k epsilon

34
Compression Project
  • compress.exe filename.off
  • You can not assume that the file exists/opens
  • You can assume that the syntax is valid
  • handle all possible errors (memory allocation,
    bad calculation results etc.)

35
Compression Project
  • Your code should be compilable and executable on
    the UNIX machines in CS
  • Your code must comply the ANSI C specification
    and should be compiled using the standard gcc
  • Your code should compile with no errors together
    with the graphics library
  • Code should be gracefully parted into files and
    functions.
  • Code line length should not extend 80 characters.
  • Code should be commented at critical points in
    the code and at function declarations.
  • Programs should reside in different
    subdirectories /dominant_eig/ /matrix_decomp/
    /compress/
Write a Comment
User Comments (0)
About PowerShow.com