Refactored the main function to get the image name as a parameter

This commit is contained in:
William DURAND 2012-01-10 18:27:46 +01:00
parent 5ddb5dc39f
commit 1194c68af5
2 changed files with 8 additions and 3 deletions

View File

@ -16,4 +16,4 @@ Compile in a normal way:
Use it:
./emd
./emd <image>

View File

@ -258,12 +258,17 @@ CImg<float> decompose(const CImg<float> input)
/*******************************************************************************
Main
*******************************************************************************/
int main()
int main(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: ./emd <image>\n");
return 1;
}
char modeTitle[30], residueTitle[50];
CImgDisplay disp[NB_ITERATIONS * 2 + 1];
CImg<float> inputImg("lena.bmp"), imgMode;
CImg<float> inputImg(argv[1]), imgMode;
disp[0].assign(inputImg, "Source Image");
for (int i = 1; i < NB_ITERATIONS + 1; i++) {