background preloader

Image_processing

Facebook Twitter

Terrain Geomorphing in the Vertex Shader. The following article is an excerpt from ShaderX2 - Shader Programming Tips and Tricks, published by Wordware presumably in August 2003 (see www.shaderx2.com for more information).

Terrain Geomorphing in the Vertex Shader

Introduction Terrain rendering has heretofore been computed by a CPU and rendered by a combination of CPU and GPU. It is possible to implement a fast terrain renderer which works optimally with current 3D hardware. This is done by using geo-mipmapping which splits the terrain into a set of smaller meshes called patches. Each patch is triangulated view-dependently into one single triangle strip. Why geomorphing? Terrain rendering has been an active research area for quite a long time.

The solution to these problems is to introduce some kind of terrain-LOD (level of detail). Previous Work A lot of work has already been done on rendering terrain meshes. Today the absolute number of triangles is not as important. The work in this article is based on the idea of geo-mipmapping de Boer by [Boe00]. Ruby 1.9 Internals: Ordered Hash. By Ilya Grigorik on February 04, 2009 With the first stable release of Ruby 1.9 out the door (1.9.1) it is time to start thinking about migrating your code to the newer runtime.

Ruby 1.9 Internals: Ordered Hash

Performance is much improved, and plenty of new features are waiting to be taken advantage of. One of these is the new ordered Hash which unlike Ruby 1.8.x preserves the insertion order: # Ruby 1.8.7irb(main):001:0> {:a=>"a", :c=>"c", :b=>"b"}=> {:a=>"a", :b=>"b", :c=>"c"} # Ruby 1.9.1 (in insertion order)irb(main):001:0> {:a=>"a", :c=>"c", :b=>"b"}=> {:a=>"a", :c=>"c", :b=>"b"} Of course, the question you're asking is, how does it do that? The C behind the Ruby For a good, albeit incomplete and now somewhat outdated primer on Ruby internals, make sure to read through the Ruby Hacking Guide (I hope we'll get a full English version for Ruby 1.9). It turns out in Ruby 1.9, a Hash is also a doubly-circular linked list!

Project 2: Image Resizing by Seam Carving. William Wedler 15-463 Fall 2007 Overview Digital images are often viewed in many different display devices with a variety of resolutions.

Project 2: Image Resizing by Seam Carving

Variation of resolution makes viewing images difficult because they usually are resized to accommodate limited space. Simple attempts at resizing include scaling and cropping. Scaling reduces perceivable detail and cropping can not be done automatically. Seam carving allows a change in size of the image by modifying the least noticeable pixels in an image. Process Reducing the size of an image is accomplished by removing pixels that will go unnoticed.

Approach The resizing process involves assigning energy to each pixel and then finding the path across the image that minimizes total energy. Assigning energy to each pixel Each pixel has energy based on the sum of the x and y derivatives at that point. The x and y derivatives where taken using the MATLAB conv2 function to convolve the approximated derivative of a 9x9 Gaussian with the image. Brainrecall: cair. NOTE: Most of this needs a update.

brainrecall: cair

For latest news and releases please go here: For a good (slightly outdated) GUI showing off CAIR, go here: What is CAIR? It's a little project I started based on the works of Shai Avidan and Ariel Shair. Their paper, described here, shows a rather easy way one can do non-linear image resizing. The Basics Lets take this image from the Space Station (courtesy NASA): For edge detection, each pixel is converted to grayscale. The next part is to determine the energy cost of a getting to a pixel from the top row. Energy_map[x][y] = minimum( energy_map[x-1][y-1], energy_map[x][y-1], energy_map[x+1][y-1] ) + edge[x][y] When you scale the values down to grayscale, you get an image something like this: From here, you can then find the least energy path by starting at the pixel with the smallest energy in the bottom row and working your way up.

The next step is to either remove those paths, or to add next to those paths. Weights Adding Paths. Computer Programming Algorithms Directory. Jeff Erickson's Algorithms Course Materials.