diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f1c2246 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +IN_IMGS := imgs +OUT_IMGS := out-imgs +BIN := build/seam-carving --silent + +images: images-ign images-birds + + +images-dir: + mkdir -p $(OUT_IMGS) + +images-birds: build/seam-carving + $(BIN) -s $(IN_IMGS)/birds.jpg -m $(IN_IMGS)/birds-mask.jpg -o $(OUT_IMGS)/vertical-birds.jpg -u --vertical + $(BIN) -s $(IN_IMGS)/birds.jpg -m $(IN_IMGS)/birds-mask.jpg -o $(OUT_IMGS)/horizontal-birds.jpg -u + +images-ign: build/seam-carving + $(BIN) -s $(IN_IMGS)/ign-circled.png -m $(IN_IMGS)/ign-mask.jpg -o $(OUT_IMGS)/ign-maxstep3-seams.jpg -u --max-step 3 --show-seams + $(BIN) -s $(IN_IMGS)/ign-circled.png -m $(IN_IMGS)/ign-mask.jpg -o $(OUT_IMGS)/ign-maxstep3.jpg -u --max-step 3 + $(BIN) -s $(IN_IMGS)/ign-circled.png -m $(IN_IMGS)/ign-mask.jpg -o $(OUT_IMGS)/ign-maxstep15.jpg -u --max-step 15 + +images-boat: build/seam-carving + $(BIN) -s $(IN_IMGS)/boat.jpg -o $(OUT_IMGS)/boat-seams.jpg -n 350 --show-seams + $(BIN) -s $(IN_IMGS)/boat.jpg -o $(OUT_IMGS)/boat.jpg -n 350 + +build/seam-carving: src/seam-carving.cpp src/utils.cpp src/utils.hpp + mkdir -p build + cd build && cmake .. -DCMAKE_BUILD_TYPE=Release; make -j7 + +clean: + rm $(OUT_IMGS) -rf + rm build -rf \ No newline at end of file diff --git a/imgs/boat.jpg b/imgs/boat.jpg new file mode 100644 index 0000000..a0332cf Binary files /dev/null and b/imgs/boat.jpg differ diff --git a/src/seam-carving.cpp b/src/seam-carving.cpp index 88522ed..750310b 100644 --- a/src/seam-carving.cpp +++ b/src/seam-carving.cpp @@ -436,7 +436,7 @@ auto seam_carving(unsigned char *source, int width, int height, int nbChannels, } SimpleProgressBar::ProgressBar bar(until_mask_removal ? dim_large : nbSeams); - bar.print(); + if (!silent) bar.print(); auto seam_index = 0; while (seam_index++ < nbSeams || until_mask_removal) { @@ -485,9 +485,10 @@ auto seam_carving(unsigned char *source, int width, int height, int nbChannels, } } bar.increment(); - bar.print(); + if (!silent) bar.print(); } - std::cout << std::endl; // Add newline after ProgressBar + // Add newline after ProgressBar + if (!silent) std::cout << std::endl; if (show_seams) { return std::make_tuple(test_energy_output, width, height, nbChannels);