This post originated from an RSS feed registered with Ruby Buzz
by Eigen Class.
Original Post: Object removal using seam carving, still fast
Feed Title: Eigenclass
Feed URL: http://feeds.feedburner.com/eigenclass
Feed Description: Ruby stuff --- trying to stay away from triviality.
The content-aware image resizer I presented a few days ago has gotten somewhat popular and triggered some discussion on reddit largely
centered around its speed relative to the LiquidRescale GIMP plugin and whether OCaml can be "as fast as C". Here follows some more information about this particular case, where some OCaml code is outperforming some C code by a 6X margin.
In order to make the comparison meaningful, I implemented the main feature LiquidScale had over my code, energy biasing for object removal and/or preservation.
Apply this energy bias, which indicates that we want the third policeman from the left to be removed
Here's what you get:
Implementation choices, cache efficiency
Both implementations use essentially the same algorithm, the main difference
being the data structure used to represent the image and the energy map.
The governing principle is: if different parts of the structure are accessed at different times, separate them and pack each one as densely as possible.