A native C++ implementation of seam carving as described by Avidan et al. in Seam carving for content-aware image resizing. Learn more about seam carving from this YouTube video.
Credit to George Wang for the GIF
The seam carving library can be built using CMake. The available targets are:
seam_carving
- builds the dylibdemo
- runs the demo at./demo.cpp
carver_unit/energy_unit
- runs the unit tests attests/unit/[carver/energy].test.cpp
respectively
- Configure the CMake project. The code sample below uses Ninja as the generator. There are presets in
CMakePresets.json
available to use. - Build the
demo
target. - Run the demo target with a path to an image (sample images are provided in
samples/
), and the target size
# step 1 - from the root folder of the repo
cmake -B {PATH_TO_BUILD_DIR} -S {PATH_TO_REPO_ROOT} -G Ninja --preset default
# step 2
cmake --build {PATH_TO_BUILD_DIR} --target demo
# step 3
./demo {PATH_TO_IMG} {TARGET COLS} {TARGET ROWS}
The Seam Carving Shell (SCS) is undergoing major reconstruction and is not supported in v2.0.0.