From the course: Fundamentals of Dynamic Programming
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Solution: Removing low-energy seams - Python Tutorial
From the course: Fundamentals of Dynamic Programming
Solution: Removing low-energy seams
- [Instructor] Let's look at how you would remove seams in Python. We're going to focus on the file, carve.py. First up was the remove seam from image function, the implementation simply copies over the input grid of colors. Omitting the color, if it's X coordinate matches the corresponding X coordinate in seam Xs. Next up is the remove and lowest seams from image function. We're going to loop N times, where N is the number of seams to remove. In my implementation, I've chosen to print out some helpful output to know what iteration is currently executing and what step is running. The actual calculation entails calling the compute energy function, calling the compute vertical seam V2 function, visualizing the current lowest energy seam and saving the result in an intermediate file, and finally calling remove seam from image. At this point, the output of this iteration becomes the input for the next iteration. Now you can…
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
-
-
-