Merge pull request #1798 from kevin-keraudren/seamcarving-typos

DOC: Fix typos in seam carving example
This commit is contained in:
Josh Warner
2015-12-05 11:49:53 -06:00
+9 -8
View File
@@ -39,29 +39,28 @@ plt.figure()
plt.title('Resized Image')
plt.imshow(resized)
"""
.. image:: PLOT2RST.current_figure
"""
out = transform.seam_carve(img, eimg, 'vertical', 200)
plt.figure()
plt.title('Resized using Seam-Carving')
plt.title('Resized using Seam Carving')
plt.imshow(out)
"""
.. image:: PLOT2RST.current_figure
As you can see, resizing as distorted the rocket and the objects around,
whereas seam carving has reszied by removing the empty spaces in between.
Resizing distorts the rocket and surrounding objects, whereas seam carving
removes empty spaces and preserves object proportions.
Object Removal
--------------
Seam Carving can also be used to remove atrifacts from images. To do that, we
have to ensure that pixels to be removes get less importance. In the following
code I approximately mark the rocket with a mask, and then decrease the
importance of those pixels
Seam carving can also be used to remove artifacts from images.
This requires weighting the artifact with low values. Recall lower weights are
preferentially removed in seam carving. The following code masks the rocket's
region with low weights, indicating it should be removed.
"""
@@ -78,6 +77,7 @@ plt.figure()
plt.title('Object Marked')
plt.imshow(masked_img)
"""
.. image:: PLOT2RST.current_figure
"""
@@ -90,6 +90,7 @@ out = transform.seam_carve(img, eimg, 'vertical', 90)
resized = transform.resize(img, out.shape)
plt.imshow(out)
plt.show()
"""
.. image:: PLOT2RST.current_figure
"""