Your task is to implement the seam carving algorithm of Avidan & Shamir. This is a very clever algorithm that was developed for resizing images in a manner that is adaptive to the image content. Typical image resizing scales the image uniformly. The Avidan & Shamir algorithm attempts to remove the boring bits of the image while retaining the important bits. The cue that is used for determining what is important is very low-level, so the algorithm does not always produce good results. It is surprising, however, how well it does work. Apart from implementing the algorithm, your job is also to evaluate its utility.
Implement a function that shrinks an image using seam removal:
function [J] = seamRemove(I,n,isVertical)
where n is the number of seams to remove. isVertical=1 if seams are vertical and otherwise 0.
Modify your retarget function from Part I so that in the case of expanding an image. Follow the suggestion in the last paragraph of §4.3.
Implement a content amplification function with the following prototype:
function [J] = seamInsert(I,n,isVertical)
where the arguments of the function are the same as seamRemove.
Write a content removal program to remove a specific region in an image. Use matlab function roipoly to select the region. You can also protect regions that you want to keep.
mov = avifile('movie.avi'); frame.colormap = ; for i = 1:nframes, frame.cdata = someImage; mov = addframe(mov,frame); end mov = close(mov);
Note that the movies that matlab creates are enormous uncompressed AVI files. It is a good idea to transcode them into something like DivX or H.264 using something like Quicktime Pro or mencoder if you want to put them in your writeup or on the web.