From 1194c68af5f0cd61635b52d8a8075963db7e4426 Mon Sep 17 00:00:00 2001 From: William DURAND Date: Tue, 10 Jan 2012 18:27:46 +0100 Subject: [PATCH] Refactored the main function to get the image name as a parameter --- README.md | 2 +- main.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 490fe99..0d34d44 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ Compile in a normal way: Use it: - ./emd + ./emd diff --git a/main.cpp b/main.cpp index 2ebe094..32320c8 100644 --- a/main.cpp +++ b/main.cpp @@ -258,12 +258,17 @@ CImg decompose(const CImg input) /******************************************************************************* Main *******************************************************************************/ -int main() +int main(int argc, char **argv) { + if (argc != 2) { + printf("Usage: ./emd \n"); + return 1; + } + char modeTitle[30], residueTitle[50]; CImgDisplay disp[NB_ITERATIONS * 2 + 1]; - CImg inputImg("lena.bmp"), imgMode; + CImg inputImg(argv[1]), imgMode; disp[0].assign(inputImg, "Source Image"); for (int i = 1; i < NB_ITERATIONS + 1; i++) {