Skip to content

plojyon/seam-carving

Repository files navigation

Seam carving

Content-aware image scaling as described by [1].

Usage example: python carve.py broadway_tower.jpg output/broadway_tower --iteration_count=300

To see the carving animated, use the make_gif.py script.
Usage example: python make_gif.py output/broadway_tower

Original image:
before

Energy function (e.g. gradient magnitude):
energy

Lowest energy seam (e.g. using Dijkstra's algo):
during

Shrunk image (297 iterations):
shrunk

More examples

width=3440px
spring_lake

width=2440px
spring_lake_small

width=3440px
snowy_mountains_big

width=2440px
snowy_mountains_small

width=1440px
snowy_mountains_smaller

Supported energy functions:

  • gradient magnitude
  • spectral residual saliency
  • fine grained saliency
  • spectral saliency + gradient magnitude
  • entropy (3-channel or grayscale)

Entropy tends to be the slowest, spectral saliency is the fastest. Gradient usually perform the best. Due to the overhead in conversion, 3-channel entropy is faster than grayscale.

[1] Avidan, Shai; Shamir, Ariel (July 2007). "Seam carving for content-aware image resizing | ACM SIGGRAPH 2007 papers". Siggraph 2007: 10. doi:10.1145/1275808.1276390

About

Seam carving algorithm for shrinking images.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages