The concept of content aware image resizing is to resize an image whilst preserving the important parts of the image. A very simple and neat method to do this was presented in a paper at this years SIGGRAPH, the superb results of which can also be seen in this YouTube video.
The trick involves removing least cost seams through the image instead of the evenly spaced columns or rows that scaling removes. All the details are in the very readable and clear paper. Unfortunately the idea was simply too neat to avoid tinkering with. Thus we arrive here. I’ve implemented the basics of the paper pretty much as is, using directional Sobel filters to calculate the cost of removing pixels.
The photo below is a good example of a photo that works with this technique.
This resizes horizontally to:
(content-aware vs. standard scaling)
and vertically to:
The content aware resizing creates much clearer shrunk images of the origninal preserving the houses on the right. Unfortunately this resizing doesn’t work well for most images, it works best for images with areas of detail and flat areas. Download it, give it a go and see what it can do. The application and source code (BSD Licence) are available for anyone to tinker with and improve.
There are obviously lots more possible things that could be done to this app. Including: suitability estimate based on the variance of the seam costs, image expanding, different weighting algorithms to choose for different images, pre-calculation and live resizing, and weight painting for areas of interest/disinterest.
If you find any nice examples or find a use for the source code let me know.