Chapter 6. Seam Carving

In this chapter, we are going to learn about content-aware image resizing, which is also known as seam carving. We will discuss how to detect "interesting" parts in an image and how to use that information to resize a given image without deteriorating those interesting parts.

By the end of this chapter, you will know:

  • What is content awareness
  • How to quantify "interesting" parts in an image
  • How to use dynamic programming for image content analysis
  • How to increase and decrease the width of an image without deteriorating the interesting regions while keeping the height constant
  • How to make an object disappear from an image

Why do we care about seam carving?

Before we start our discussion about seam carving, we need to understand why it is needed in the first place. Why should we care about the image content? Why can't we just resize the given image and move on with our lives? Well, to answer that question, let's consider the following image:

Why do we care about seam carving?

Now, let's say we want to reduce the width of this image while keeping the height constant. If you do that, it will look something like this:

Why do we care about seam carving?

As you can see, the ducks in the image look skewed, and there's degradation in the overall quality of the image. Intuitively speaking, we can say that the ducks are the "interesting" parts in the image. So when we resize it, we want the ducks to be intact. This is where seam carving comes into the picture. Using seam carving, we can detect these interesting regions and make sure they don't get degraded.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset