Image Morphing Project - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Image Morphing Project

Description:

Identify control points for each picture. Place them in mesh matrices ... Courser grain, parallelize the regions. Turns out it helps load balancing also ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 28
Provided by: mohamma45
Category:

less

Transcript and Presenter's Notes

Title: Image Morphing Project


1
Image Morphing Project
  • Parallel Computing
  • Mohammad S Rahim
  • shahed_at_ece.gatech.edu
  • March 18,2002.

2
Introduction
  • Matt
  • Paul
  • They are 2 ECE graduate students I am image
    morphing.

3
Mesh Warping Steps
  • Identify control points for each picture
  • Place them in mesh matrices
  • Iterate through each intermediary frame
  • Find intermediary mesh for each frame
  • Get the color mappings for this new mesh from
    each picture
  • Do a weighted average of the 2 new pictures
    formed
  • That is the new image for this intermediary frame

4
Mesh Warping Steps
  • Identify control points for each picture
  • Place them in mesh matrices
  • Iterate through each intermediary frame
  • Find intermediary mesh for each frame
  • Get the color mappings for this new mesh from
    each picture
  • Do a weighted average of the 2 new pictures
    formed
  • That is the new image for this intermediary frame

5
Control Points
  • Wrote the files into bitmaps
  • Placed white dots where the control points should
    be
  • Searched for differences from original picture
  • Formed a matrix of the positions of the
    differences

6
Mesh Warping Steps
  • Identify control points for each picture
  • Place them in mesh matrices
  • Iterate through each intermediary frame
  • Find intermediary mesh for each frame
  • Get the color mappings for this new mesh from
    each picture
  • Do a weighted average of the 2 new pictures
    formed
  • That is the new image for this intermediary frame

7
Mesh Matrices
  • 9x9 matrix of the control points is created
  • Lines between adjacent points in the matrix are
    shown here

8
Mesh Warping Steps
  • Identify control points for each picture
  • Place them in mesh matrices
  • Iterate through each intermediary frame
  • Find intermediary mesh for each frame
  • Get the color mappings for this new mesh from
    each picture
  • Do a weighted average of the 2 new pictures
    formed
  • That is the new image for this intermediary frame

9
Intermediary Mesh Calculation
10
Mesh Warping Steps
  • Identify control points for each picture
  • Place them in mesh matrices
  • Iterate through each intermediary frame
  • Find intermediary mesh for each frame
  • Get the color mappings for this new mesh from
    each picture
  • Do a weighted average of the 2 new pictures
    formed
  • That is the new image for this intermediary frame

11
Intermediary Mesh Calculation
12
Warp Individual Pictures
  • The first picture shows the middle frame from
    Matt
  • The second picture shows the middle frame from
    Paul

13
Middle Frame
  • Here is the weighted average of the two images.

14
Compare
15
The Movie
16
Parallelizing
  • Each frame can be computed on a different MPI
    machine like in a master-worker level system.
  • But use OpenMP for the bulk of the computation
    within the frame.
  • The main for loop in the problem is getting the
    color mappings for new mesh from each picture,
    (OpenMP should be used to handle that).
  • The above loop is repeated at least 64 times,
    once for each mesh region. (It may be good idea
    to assign each region to a different processor)
    ltload balancing!?!gt

17
Serial Optimizations
  • Matrixop.H
  • 4x4, 4x2, 2x2 matrix multiplication
  • 4x4 matrix inversion
  • Of course addition and subtraction
  • Computing regions in one loop run
  • Very smart inpolygon function
  • Not accessing disk in the calculation intensive
    process
  • Pipe image saves to a separate BMP writer process
  • 5 minutes (?) to 39.1136 sec for serial code
  • Most of this is initialization time

18
OpenMP code
  • Initialization is completely serial, but it has
    to be done only once
  • Main portion of the code is the computation of
    the color maps region by region 64 regions
    (8x8)
  • Many ways to parallelize this
  • Parallelize the matrix calculations (not
    efficient enough)
  • Courser grain, parallelize the regions
  • Turns out it helps load balancing also
  • Fairly linear speedup curve

19
(No Transcript)
20
SMP times
  • Since initialization was not repeated
  • Serial time 13.4s
  • 8 proc time 2.59s
  • So if we had 2.6 sec buffering time, we could
    display the morph real-time at a frame rate of
    1/2.6s 0.385fps!

21
Next Step
  • Use distributed memory clusters JEDI.
  • That potentially gives us 16x8 processors.
  • MPI controls the application so it does not get
    in the way of others work.
  • So dont get mad!
  • Master- worker architecture.

22
(No Transcript)
23
Time
  • Sysinfo gives load3. Number of busy
    msec/minute in the last 1 minute, 5 minutes, and
    15 minutes.
  • It is easy to calculated load avg from there.
  • I cut off work at 4.0 or higher.

24
Problems faced
  • Mpicc does not accept mp argument.
  • I could not find the omp libraries to link them.

25
My Solution
  • So I compiled the MPI code and OpenMP code
    separately, and communicated between them using 2
    named pipes (FIFO).
  • Communication cost of a named pipe is minimal.
  • And since my OpenMP code was more or less
    untouched, my through-put is the same.

26
Result
  • (0.385 (lt16)) lt 6.15 fps.
  • We can actually see something without falling
    asleep.

27
I love seeing this video!
Write a Comment
User Comments (0)
About PowerShow.com