Bobby Anguelov's Blog

A day in the life of a wannabe game developer

DPT Code and Pseudocode

okay here’s the code and the pseudocode of the DPT implementation, any comments on style, performance and so on are more than welcome…

 It’s been a few weeks of work to get this done, the algorithm has changed significantly since i first received, from speed optimizations to the removal of redundant code, merging of function to reduce complexity and so on. I for one am happy with the current state.

matlab_src.zip – original matlab source, if you’re interested in the before

pseudocode.zip  – basic pseudocode overview of current implementation

DPT_initial.zip - c++ implementation and visual studio project file

21 December 2007 Posted by Bobby | Computer Vision, Image Processing, Programming | | No Comments Yet

DPT initial implementation complete!

OH MY GOD! its finally done! You have no idea how happy i am right now… (and pretty drained)

 I’ve spent the last three days debugging the conversion i did from matlab to c++. The problem was that the program would complete but the image wouldnt have been totally cleared (ie. be a fixed value throughout). Okay i’m getting ahead of myself. Basically the DPT algorithm (which we still have to name) seperates an image according to the contrast grouping. Its basically an intense smoother.

 It starts out by identifying all the local minimum and maximum pixel groupings, it does this by recursively finding all pixel groupings and each groupings adjacent pixels (border pixels), it then compares the pixel groups color value to its adjacent pixels, if it is larger or smaller than all these values, then the group is a maximum or minimum respectively.

This seems to be the most intensive operation in the algorithm , i havent had time to slap it through a profiler yet so i cant be sure of this.

Once this initial “search” is complete, we start extracting “pulses”/pixel groups of a certain size. We start at size 1 and continue until there is only one group left (ie, the entire image has been smoothed down to a single color). When we extract the group, we check if it is a max or a min group, if so then we set the value of the pixels in that group to the max or min value of the adjacent pixels, and then we “grow” to see if it will now expand to the neighboring pixel, it may even overlap with another grouping, if this occurs we simply merge the two groups. By setting the groups pixel to a value neighbouring it we’re always guaranteed that the group will grow, so we are always guaranteed to full smooth an image.

Max groups are called “up pulses” and min groups are “down pulses”, once the image has been cleared we can then use these extracted “pulses” and reconstruct the image from the pulses, either full or partially. I’ve provided sample output of the program below, i entered in an image and then did several partial reconstructions with the extracted pulses.

full.png
Original Image

partial200to350.png
Partial Reconstruction: Grouping size 200 – 350

partial350to800.png
Partial Reconstruction: Grouping size 350 – 800

partial1000to2000.png
Partial Reconstruction: Grouping size 1000 – 2000

partial2000to35000.png
Partial Reconstruction: Grouping size 2000 – 35000

partial35000to60000.png
Partial Reconstruction: Grouping size 35000 – 60000

partial35000to85000.png
Partial Reconstruction: Grouping size 35000 – 85000

Kinda cool huh? Anyways the really funny thing is now that the algorithm is complete, we need to figure out the application for the algorithm. Kinda like developing a cure for a disease that hasnt been discovered yet. Should prove fun…

The next step for me know is to develop a win32 application that will function as a work bench for this algorithm so that we can easily see the results, i honestly have no idea how complicated it will be to embed my ANSI c++ code into a visual c++ program and so that will be my next challenge. Keep an eye out.

Also since this is now complete (i was envisioning debugging code for most of the weekend) I can now spend a large chunk of the weekend working on the design document for our mod. That’s gonna be a lot of work but work that i’m looking forward to.

*bobby is now off to shower and collapse

14 December 2007 Posted by Bobby | Computer Vision, General, Image Processing, Programming | | 3 Comments

DPT and Mod Progress…

Okay, its been a really busy week, i’ve been working on the DPT stuff during the day and my evenings have been working on the design doc for our game mod. I’ve completed a rough version of the dpt program but there are still some issues with it, i think the problem is with the algorithm and not the implementation. I need to have it completed before friday so i’ll stressing a little bit… I’m gonna meet with my dad tomorrow and discuss it and hopefully we can figure out whats going on…

As for my game mod, i’ve finally started on the design document for it, it a very rough badly written version but its enough to give to the writer and have her strat on an actual little episode storyline, once that is done we can actually start implementing it. I’ve got a rough idea for the game rule system but the control scheme we had envisioned would probably prove troublesome, so i’ll need to work out some of the kinks. Hopefully i can provide something a bit more solid soon.

 I’m going put the link to the design document here so you see what i’ve done so far…

here it is: Game Design Document Initial pre-alpha Version (please be gently with it, haha)

 anyways i’ve been working for over 8 hours straight now and i’m starting to lose it so i’m off home to pass out…

12 December 2007 Posted by Bobby | Game Design, Game Development, Gaming, General, Hardware | | No Comments Yet