From the course: Fundamentals of Dynamic Programming
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Solution: Using backpointers to reconstruct seams - Python Tutorial
From the course: Fundamentals of Dynamic Programming
Solution: Using backpointers to reconstruct seams
- [Instructor] Let's look at how you would use back pointers in Python. We're going to focus on the file, seam_v2.py. First we needed a way to store back pointers in the seam energy with back point of class. I've chosen to store the seam energy and the X coordinate of the destination pixel. Notice that the second value defaults to none, which will be the case for the values in the first row. And that's it, just storing these two values is enough. Next up is compute vertical seam v2. Like before we start by creating a grid to store the values of the m function. The grid has the same size and shape as the input grid of energy values. But we can initialize all the values as none. Next, we extract the height and width of the image based on the grid of energy values. Filling out the top row is straightforward, here we could just use the energy values from the top row or we wrapped them in instances of seam energy with back…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
What is content-aware image resizing?3m 26s
-
(Locked)
Preprocessing: Defining the energy of an image2m 31s
-
(Locked)
Project: Calculating the energy of an image3m 41s
-
(Locked)
Solution: Calculating the energy of an image2m 20s
-
(Locked)
Using dynamic programming to find low-energy seams3m 31s
-
(Locked)
Project: Finding low-energy seams3m 26s
-
(Locked)
Solution: Finding low-energy seams2m 42s
-
(Locked)
Project: Using backpointers to reconstruct seams3m 50s
-
(Locked)
Solution: Using backpointers to reconstruct seams3m 9s
-
(Locked)
Project: Removing low-energy seams2m 12s
-
(Locked)
Solution: Removing low-energy seams2m 13s
-
-
-