An advanced content-aware, image resizing program utilizing seam carving algorithm in C++ that allows image to be scaled without losing/distorting meaningful image landmarks. This is implemented according to the seam carving algorithm described in Avidan & Shamir, 2007 which finds the path of least energy density for removal by computing a energy matrix mapping to the image.
Clone the repository:
git clone https://github.com/felixlu4725/Content-Aware-Image-Resizer.git
cd Content-Aware-Image-Resizer
Compile the code:
g++ -std=c++11 -o seam_carving main.cpp -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc
Ensure that OpenCV is correctly installed and linked.
./seam_carving <input_image> <output_image> <new_width> <new_height> [display]
<input_image>: Path to the input image file.<output_image>: Path to save the resized image.<new_width>: Desired width of the output image.<new_height>: Desired height of the output image.[display] (optional): Set to 1 to display the seam removal process; defaults to 0../seam_carving input.jpg output.jpg 800 600 1
This command resizes input.jpg to 800x600 pixels and displays the seam removal process.
By Felix Lu felixlu@umich.edu