Transcript Document 7410216
Talha Ansari, Technical Approach/VHDL implementation Heather Garnell, Technical Approach/VHDL implementation Anamika Shams, Testing Requirements/Implementation
• Image morphing is a useful and widely recognized visualization technique. Thus there is interest in and research conducted in this area. • Image morphing techniques can generate compelling 2-D transitions between images and thus will add an element to fun to the entire project development process.
• To implement image morphing on the ML507 test board using both the xilinx FPGA and the PPC 440 • From Iowa State CprE583 Fall 2011 lecture 12
• The final product will include two similar images and a final morphed image similar to the images you see below.
• The concept of Barycentric Coordinates can be used in an image morphing application http://www.cs.washington.edu/homes/ankit/course_projects/files/DIP/A2_web/marked6.jpg
read main write find_bary_coordinate bary compute_ABCts compute_gamma compute_alpha get_tri_area compute_beta
• • • • • • • • • • • • • • • • • • • •
Compute_ABCts
: This function compute time interpolation of ABC_0 and ABC_1 for AtBtCt triangle by looping through 8 triangle, 3 points of each triangle and the 2 coordinate of the each triangle
Get_Tri_Area
: This method is getting the area of the corresponding point P1, P2 and P3 of the new triangle.
Compute_Alpha
: This function compute the new triangle area in regards to ABC triangle and PBC triangle
Compute_Beta
: This function compute the new triangle area in regards to ABC triangle and PAC triangle
Compute_Gamma
: This function compute the new triangle area in regards to ABC triangle and PAB triangle.
Find_Bary_Coordinate
: This function find two coordinate points x and y from the ABC triangle area.
Bary
: This method is computing the morphed triangle at time t where due to the affine invariant property, the corresponding point Po in triangle AoBoCo and PI in triangle A,BICI are Po = atAo + BtBo + YtCO and PI = atA I + BtBI + YtC" respectively. If the colors of Po and PI are I0 and I1, respectively, the color at Pt will be computed same as simply using this function It = (l-t)Io + tIl. Therefore, every pixel of triangle AtBtCt is interpolated from its initial color in triangle AoBoCo and its final color in triangle AIBICI.
Read
: This method open the bmp file and read the header and the color of two images files and then close the file.
Write
: This function open the final morphed image file and write the morphed image.
• • To reuse MP3 architecture as much as possible
Offload PPC with pixel morphing
• • • Load 120 bits (5 pixels) from each picture in two consecutive loads Take average of each pixel element Send modified data back to PPC
Process:
InputReg
Type:
Clock
Description:
Maps all input ports to local signals. Sets default values when entity in reset.
Process:
StateMachineReg
Type:
Clock
Description:
Sets default starting state as well as next state.
Process:
OutputReg
Type:
Clock
Description:
Computation done in this process for Morphing.
Process:
Comp_Nxt_st
Type:
Sgnals
Description:
Depending of input signals, switches between different states of design.
DECLOAD = 1 LDCNT = 10b
INST_TYPE
DECSTORE = 1
WAIT_WBLV
WRITEBACKOK = 1 LOADVALID = 1 DECNONAUTION = 0
WAIT_LV WAIT_WB
WRITEBACKOK = 1 LOADVALID = 1 LDCNT = 01b
LOAD_DATA STORE_DATA
LDCNT: Local signal that counts number of consecutive loads
• • • • • Step 1: Design C code on local computer and test out Step 2: Design VHDL merging function and test out Step 3: Integrate C code on PPC Step 4: Integrate VHDL code by offloading pixel merging to FPGA Step 5: Test system out
• Complete C code implementation alpha = compute_alpha(ABC_t, uv); beta = compute_beta (ABC_t, uv); gamma = compute_gamma(ABC_t, uv); // Let Pt be a point of triangle AtBtCt. // Its barycentric coordinate with respect to triangle AtBtCt, can be found as // Pt = ætAt + ßtBt + YtCt where æt/=0, ßt/=0, Yt/=0, æt+ßt+Yt=1 Pt = find_bary_coordinate(alpha, beta, gamma, ABC_t); // From the coordinate (æt, ßt, Yt) of point Pt, due to the affine // invariant property, the corresponding point // P0 in triangle AøBøCø = ætAø + ßtBø + YtCø // P1 in triangle A1B1C1 = ætA1 + ßtB1 + YtC1 P0 = find_bary_coordinate(alpha, beta, gamma, ABC_0); P1 = find_bary_coordinate(alpha, beta, gamma, ABC_1); // If the colors of P0 and P1 are I0 and I1, respectively, // the color at Pt is simply: It = (1-t)I0 + tI1 // Compute It for red, green, and blue pixels temp_red = (1.0-t)*(float)(I0.red) + t*(float)(I1.red); // Red temp_grn = (1.0-t)*(float)(I0.grn) + t*(float)(I1.grn); // Green temp_blu = (1.0-t)*(float)(I0.blu) + t*(float)(I1.blu); // Blue SINGLE_PIXEL It = { (int)(temp_red), (int)(temp_grn), (int)(temp_blu) };
It is important for images to be the same size and orientation. Source images were chosen because they met this criteria.
• Each of the two input images broken into eight triangles
Final morphed image based on the previous slide
’
s two images
• VHDL implementation complete
• Currently at this step of integration • Minor issues with integration of current c code into out echo.c
kitty.ppm
cat.ppm
Image Data to Morph
Modi fied Echo.c
Morphed Data Back
Morph.c
Monitor
kitty.ppm
• Next step Modi fied Echo.c
Image Data to Morph Morphed Data Back
Morph.c
Pixel Merging cat.ppm
VHDL Monitor
• This is where magic happens!!!
Ching-Kuang Shene. "Barycentric Coordinates and Morphing, ” Department of Computer Science. Michigan Technological University. April 19, 2003.
- This is a practical guide for implementing barycentric coordinates into an image morphing application.
T. Balercia, A. Zitti, H. Francesconi, S. Orcioni and M. Conti. "FPGA Implementations of a Simplified Retinex Image Processing Algorithm." IEEE 2006.
• Resolve issue with final morphing of pixel data within c code • as this the morphing algorithm itself was not the purpose of the project, we chose to resolve this between now and final submission • Complete integration effort • Modify documentation based on any recent changes to project design or implementation • Complete writing the final report
• Set times when the entire group can meet to discuss topics proved to be difficult with work schedules and family issues.
• Use of chat programs was very helpful to keep communication lines open • Use of tools to keep documentation in a common location was helpful (Google docs and Google sites) • Check for integration issues early on is important