Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.86 KB

README.md

File metadata and controls

39 lines (27 loc) · 1.86 KB

seam-carver

Work in progress!

OpenCV4 based utility for efficient multi-threaded content-aware scaling. Includes a basic wrapper for user control but the main focus is on the underlying Carver class which is used for the actual image processing. Feel free to add any GUI bindings or an advanced CLI for easy usage.

Basic usage:

carver -m <mode> -o <output_path> <input_path>

How does it work?

Wikipedia includes a decent explanation on the topic. The basic idea is to pick a method to assign an importance value to each pixel and then locate the least important seams through the image. This solution uses gradient magnitude (energy) as the importance value. Energies are updated each time a seam has been cut from the image to achieve best possible quality.

Asynchronous C++ processing and threading is used for performance gains. The effect of these really comes to shine when carving larger images in both directions.

Processing reasonably sized images is quite swift but bear in mind that the actual complexity of this algorithm by image width and height is in the range of O(W × H + W + H).

How to get it?

cmake is the recommended workflow for building this project. The premade cmake definitions include diretives for building both a standalone app as well as a static library.

If you do not feel like building, some premade binaries will be attached to releases. Dynamic OpenCV dependencies are:

libopencv_imgcodecs.so.4.3
libopencv_imgproc.so.4.3
libopencv_core.so.4.3

Example output when running in vertical mode

image image