First Project Final Document Cody Robson cjrobson@wisc.edu March 3rd, 2006 1) Results My final result is the collage.py program which implements a greedy image placement algorithm and creates a collage out of the images specified in the collage.cfg file. It shrinks the canvas as much as it can once the images are placed, perserving the 4:3 ratio if cropping is turned off, and with no regard for aspect ratio if cropping is enabled. It has two wallpaper options. The first is to use one image stretched to the size of the canvas. The second is to repeat images underneath the collage where the program detects holes of whitespace. These background images are not reflected on the pygame preview window, so the user can evaluate the original image placment results. This program is limited to images that are of a 4:3 aspect ratio. Each time it creates a collage it sums all the total white space remaining and divides it by the forced length specified in the collage.cfg file. This score is displaeyd in the console as soon as it is finished with the algorithm and uses it to determine which of its collages is the best. The number of collage instances to consider is also specified in the collage.cfg file. Additional documentation and details about hte format of collage.cfg file can be found in collage.README file 2) Work - The first thing I did was implement a program capable of displaying a collage. This included the data structures, config parser, and pyopengl window code. - The original image placement algorithm used a 2d quicksort to do its placement. I spent a lot of time trying to allow it to place new images above the collage or below the collage depending on whichever allowed its hotspot to grow the most. Unfortunetely, the results of this implementation and the nuances it presented were unsatisfactory, and it had to be abandoned. - The next implementation I tried was a simple greedy image placement algorithm that divided the canvas into four quadrants and tried to place new images as close to the origin as possible. Two of these quadrants had their images rotated 90 degrees and the result was a diamond shape that was rotated 45 degrees before it was saved, resulting in a square shaped blob of images. The intention behind this was to reduce the number of internal whitespace holes to zero, at the cost of the wierd looking collage that resulted. I eventually abandoned this for a more standard greedy algorithm that worked in a single quadrant. - The final implementation was a greedy placement algorithm that used a pixel map to ensure accuracy. It supported wallpaper or duplicate background images that would fill gaps in the collage. It also allowed the user to specify a theta value that the image would be rotated some random amount up to that value. The slightly tilted images looked a lot nicer than the regular perpendicular collage, and the background image placement element also improved the collage's look significantly. 3) Lessons Learned - The biggest thing I learned was to start with the simplest solution to the problem as possible. I wasted a lot of time on more elaborate algorithms that didn't produce results on par with the most basic of greedy algorithms. If I were to start with the greedy algorithm I didn't develope until that last two weeks, I could have added a lot more functionality to it than I was able to after implementing it so late. - Another thing I learned was to use the resource that is the grad students. Michael Wallick gave me some great suggestions for my program and I should have went to him sooner. - Having done this project completely in python I feel a bit more comfortable with the langauge. I didn't get into any new complex features of the langauge but I had my share of nuances that I learned of along the way. - I learned not to underestimate the time it would take to develope the project's central algorithm. I have to recognize the fact my first few ideas and implementations probably won't work, and therefore I should not put as much stock in my early ideas. Instead, I should start as simple as possible and expand from there. 4) Self Evaluation - I feel lukewarm with my project. I am pleased with how well it does what it does but I was hoping for a more robust solution than the one I came up with. I felt like my solution was more of a two week project than a five week project because of the time I wasted with implementations that did not work well and were abandoned. I feel I have a much better understanding of how a five week project works, how much I should expect to get done week to week, and what I should spend lots of time trying to fix and when I should determine its time to move on if it's not producing adequate results. - Next time I would definitely start with the simplest solution I can conceive of in the first couple weeks. Doing that this time around would have allowed me to have a much more elaborate final product.