#include #include #include #include "Matrix.h" #include "BackGround.h" #include "GaussMatrix.h" #include "Bitmap.h" #include "PMImage.h" #include "OpticalFlow.h" #include "Vector.h" #include "ImagePyramid.h" #include "OFPyramid.h" #include "Algorithm.h" int main(int argc, char *argv[]){ CAlgorithm *alg; CPMImage *ForBg; //You must give the first and the last sequence //the name is ssipxxxx.pgm //fn first seq last seq int i; int first, last; char tmp[100]; char Filename1[100]; char Filename2[100]; char OutFilename[100]; char OutColorFilename[100]; char OutFGName[100]; //hp CBackGround *bg; bg = new CBackGround(atoi(argv[3]), atoi(argv[4])); //hp if (argc == 5){ first = atoi(argv[1]); last = atoi(argv[2]); for (i= first; i< last; i++){ itoa(i, tmp, 10); if (i<10){ strcpy(Filename1, "ssip-"); strcat(Filename1, tmp); strcat(Filename1, ".pgm"); } else if (i< 100){ strcpy(Filename1, "ssip-"); strcat(Filename1, tmp); strcat(Filename1, ".pgm"); }else if (i<1000){ strcpy(Filename1, "ssip-"); strcat(Filename1, tmp); strcat(Filename1, ".pgm"); }else{ strcpy(Filename1, "ssip-"); strcat(Filename1, tmp); strcat(Filename1, ".pgm"); } itoa(i+1, tmp, 10); if ((i+1)<10){ strcpy(Filename2, "ssip-"); strcat(Filename2, tmp); strcat(Filename2, ".pgm"); } else if ((i+1)< 100){ strcpy(Filename2, "ssip-"); strcat(Filename2, tmp); strcat(Filename2, ".pgm"); }else if ((i+1)<1000){ strcpy(Filename2, "ssip-"); strcat(Filename2, tmp); strcat(Filename2, ".pgm"); }else{ strcpy(Filename2, "ssip-"); strcat(Filename2, tmp); strcat(Filename2, ".pgm"); } itoa(i, tmp, 10); if (i<10){ strcpy(OutFilename, "out000"); strcat(OutFilename, tmp); strcpy(OutFGName, "outFG000"); strcat(OutFGName, tmp); strcpy(OutColorFilename, OutFilename); strcat(OutFGName, ".pgm"); strcat(OutColorFilename, ".ppm"); strcat(OutFilename, ".pgm"); } else if (i< 100){ strcpy(OutFilename, "out00"); strcat(OutFilename, tmp); strcpy(OutFGName, "outFG00"); strcat(OutFGName, tmp); strcpy(OutColorFilename, OutFilename); strcat(OutFGName, ".pgm"); strcat(OutColorFilename, ".ppm"); strcat(OutFilename, ".pgm"); }else if (i<1000){ strcpy(OutFilename, "out0"); strcat(OutFilename, tmp); strcpy(OutFGName, "outFG0"); strcat(OutFGName, tmp); strcpy(OutColorFilename, OutFilename); strcat(OutFGName, ".pgm"); strcat(OutColorFilename, ".ppm"); strcat(OutFilename, ".pgm"); }else{ strcpy(OutFilename, "out"); strcat(OutFilename, tmp); strcpy(OutFGName, "outFG"); strcat(OutFGName, tmp); strcpy(OutColorFilename, OutFilename); strcat(OutFGName, ".pgm"); strcat(OutColorFilename, ".ppm"); strcat(OutFilename, ".pgm"); } ForBg = new CPMImage(Filename1); ForBg->Smooth(0); ForBg->MakeDifference("bg.pgm", 30, OutFGName); // printf("%s %s\n", Filename1, Filename2); alg = new CAlgorithm(Filename2, Filename1, OutFilename,OutColorFilename, 3, 5, 2, 6); } } else { printf("Arguments error"); } /* if (argc == 1){ printf("Optical flow help!!!\n\n"); printf("Use: wincommand> main - see this help. \n\n"); printf(" wincommand> main in1 in2 out\n"); printf(" -in1: first image sequence (pgm or ppm).\n"); printf(" -in2: second image sequence (pgm or ppm).\n"); printf(" -out: out file name (pgm or ppm).\n"); printf(" (size of in1 and in2 must be 2^n x 2^n)\n\n"); printf(" wincommand> main in1 in2 out depth gms min rate\n"); printf(" -in1: first image sequence (pgm or ppm).\n"); printf(" -in2: second image sequence (pgm or ppm).\n"); printf(" -out: out file name (pgm or ppm).\n"); printf(" (size of in1 and in2 must be 2^n x 2^n)\n"); printf(" -depth: size of the pyramid, 2^depth is the max motion (default = 4)\n"); printf(" -gms: size of the Gaussian matrix to make image pyramids (default = 5)\n"); printf(" -min: set the minimal motion in out file (default = 0)\n"); printf(" -rate: ilyen kozonkent irja ki a vektorokat (default = 10)\n\n"); printf("Don't worry, be happy! Just for friends!! ;) hp\n\n"); } else if (argc == 4){ alg = new CAlgorithm(argv[2], argv[1], argv[3], 4, 5, 0, 10); } else if (argc == 8){ alg = new CAlgorithm(argv[2], argv[1], argv[3], atoi(argv[4]), atoi(argv[5]), atoi(argv[6]), atoi(argv[7])); }else { return 0; }*/ return 1; }