示例#1
0
static int process_input(const char* input, const SkString* outputDir,
                         sk_tools::PictureRenderer& renderer,
                         sk_tools::ImageResultsSummary *jsonSummaryPtr) {
    SkOSFile::Iter iter(input, "skp");
    SkString inputFilename;
    int failures = 0;
    SkDebugf("process_input, %s\n", input);
    if (iter.next(&inputFilename)) {
        do {
            SkString inputPath;
            SkString inputAsSkString(input);
            sk_tools::make_filepath(&inputPath, inputAsSkString, inputFilename);
            if (!render_picture(inputPath, outputDir, renderer, jsonSummaryPtr)) {
                ++failures;
            }
        } while(iter.next(&inputFilename));
    } else if (SkStrEndsWith(input, ".skp")) {
        SkString inputPath(input);
        if (!render_picture(inputPath, outputDir, renderer, jsonSummaryPtr)) {
            ++failures;
        }
    } else {
        SkString warning;
        warning.printf("Warning: skipping %s\n", input);
        SkDebugf(warning.c_str());
    }
    return failures;
}
示例#2
0
static int process_input(const SkString& input, const SkString* outputDir,
                         sk_tools::PictureRenderer& renderer,
                         bool validate, bool writeWholeImage, int clones) {
    SkOSFile::Iter iter(input.c_str(), "skp");
    SkString inputFilename;
    int failures = 0;
    SkDebugf("process_input, %s\n", input.c_str());
    if (iter.next(&inputFilename)) {
        do {
            SkString inputPath;
            sk_tools::make_filepath(&inputPath, input, inputFilename);
            if (!render_picture(inputPath, outputDir, renderer,
                                validate, writeWholeImage, clones)) {
                ++failures;
            }
        } while(iter.next(&inputFilename));
    } else if (SkStrEndsWith(input.c_str(), ".skp")) {
        SkString inputPath(input);
        if (!render_picture(inputPath, outputDir, renderer,
                            validate, writeWholeImage, clones)) {
            ++failures;
        }
    } else {
        SkString warning;
        warning.printf("Warning: skipping %s\n", input.c_str());
        SkDebugf(warning.c_str());
    }
    return failures;
}
示例#3
0
std::string mui::Helpers::muiPath( std::string path ){
	// pretty much copy&pasted from OF
	Poco::Path outputPath;
	Poco::Path inputPath(path);
	string strippedDataPath = mui::MuiConfig::dataPath.toString();
	strippedDataPath = ofFilePath::removeTrailingSlash(strippedDataPath);
	if (inputPath.toString().find(strippedDataPath) != 0) {
		outputPath = mui::MuiConfig::dataPath;
		outputPath.resolve(inputPath);
	} else {
		outputPath = inputPath;
	}
	
	if( !ofFile(outputPath.absolute().toString(), ofFile::Reference).exists() ){
		// maybe in the data dir?
		string dataFile = ofToDataPath(path, true);
		if( ofFile(dataFile,ofFile::Reference).exists() ){
			outputPath = Poco::Path(dataFile);
		}
	}
	
	if( mui::MuiConfig::logLevel <= OF_LOG_NOTICE ){
		cout << "loading path: " << outputPath.toString() << " || " << outputPath.absolute().toString() << " || " << path << endl;
	}
	return outputPath.absolute().toString();
}
示例#4
0
static int process_input(const char* input, const SkString* writePath,
                         const SkString* mismatchPath, sk_tools::PictureRenderer& renderer,
                         sk_tools::ImageResultsAndExpectations *jsonSummaryPtr) {
    SkOSFile::Iter iter(input, "skp");
    SkString inputFilename;
    int failures = 0;
    SkDebugf("process_input, %s\n", input);
    if (iter.next(&inputFilename)) {
        do {
            SkString inputPath = SkOSPath::Join(input, inputFilename.c_str());
            if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) {
                ++failures;
            }
        } while(iter.next(&inputFilename));
    } else if (SkStrEndsWith(input, ".skp")) {
        SkString inputPath(input);
        if (!render_picture(inputPath, writePath, mismatchPath, renderer, jsonSummaryPtr)) {
            ++failures;
        }
    } else {
        SkString warning;
        warning.printf("Warning: skipping %s\n", input);
        SkDebugf("%s", warning.c_str());
    }
    return failures;
}
示例#5
0
bool Limoo::startViewMode() const
{
    const QString & path = inputPath();
    if( path.isEmpty() )
        return false;

    return QFileInfo(path).isFile();
}
示例#6
0
QString StandardStrings::relativeFileName(const QString &fullFileName){
	//get the input directory and return the relative path, if the input directory is not specified, 
	//project-settings = 4 io-settings = 2 input-directory = 1
	//the current directory is always the input directory...
	if(!QFileInfo(fullFileName).isAbsolute()){
		return fullFileName;
	}
	return QDir(inputPath()).relativeFilePath(fullFileName);
}
示例#7
0
int main(int argc, const char *argv[]) {
    TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
    TCLAP::ValueArg<std::string> inputPath("i", "input", "Input file", false, "", "string", cmd);
    TCLAP::ValueArg<std::string> outputpath("o", "output", "Output file", false, "", "string", cmd);
    cmd.parse(argc, argv);


    return EXIT_SUCCESS;
}
示例#8
0
bool StandardStrings::fileExists(const QString &fileName){
	//this will be a relative path, so the current directory of the GUI always have to be set to the input directory.
	if(fileName.isEmpty()){
		return true;
	}
	/*if(!QFileInfo(fullFileName).isAbsolute()){
		return QFile::exists(fileName);
	}*/
	return QFile::exists(QDir(inputPath()).absoluteFilePath(fileName));
}
示例#9
0
/*!
  Performs the import operation. That is to say, it takes all files from input
  path and puts them into output path according to formatting tags that have
  been used.

  For example, if you want to copy your newly taken photographs onto your local
  foto archive/ gallery, you can use this output path:

  /some/path/<yyyy>/<MM>/<yyyy-MM-dd>*

  This will copy the files into a well-organized folder structure. Later, when
  you take more pictures, you can run import() again, and the archive will be
  updated.

  \sa setOutputPath
 */
bool SpdrImport::import() const
{
    Q_D(const SpdrImport);

    bool result = true;

    if (inputPath().isEmpty() || outputPath().isEmpty()) {
        emit finished(false);
        return false;
    }

    result = d->importDirectory(inputPath());

    if (result) {
        log(tr("DONE: Directory import successful"), Spdr::MildLogging);
    }

    emit finished(result);
    return result;
}
示例#10
0
UNITY_NATIVE_EXPORT bool LoadMeshSet( const char * searchPath, const char * searchString )
{
	MeshDataset * result = new MeshDataset( );

	WIN32_FIND_DATAA ffd;
	LARGE_INTEGER filesize;
	size_t length_of_arg;
	HANDLE hFind = INVALID_HANDLE_VALUE;
	DWORD dwError = 0;

	std::string inputPath( searchPath );
	if( inputPath.back( ) != '\\' && inputPath.back( ) != '/' )
		inputPath += '\\';
	inputPath += searchString;


	hFind = FindFirstFileA( inputPath.c_str( ), &ffd );

	if( INVALID_HANDLE_VALUE == hFind )
		return false;

	// List all the files in the directory with some info about them.

	do
	{
		if( !( ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) )
		{
			std::string foundPath = std::string( searchPath ) + ffd.cFileName;
			ParsedMeshStructure * mesh;
			mesh = LoadBinaryMesh( foundPath.c_str( ) );

#ifdef _DEBUG
			if( mesh == nullptr )
				__debugbreak( );
#endif
			result->meshes.push_back( mesh );

			filesize.LowPart = ffd.nFileSizeLow;
			filesize.HighPart = ffd.nFileSizeHigh;
			printf( "  %s   %ld bytes\n", ffd.cFileName, filesize.QuadPart );
		}
	} while( FindNextFileA( hFind, &ffd ) != 0 );

	dwError = GetLastError( );
	if( dwError != ERROR_NO_MORE_FILES )
		return false;

	FindClose( hFind );
	
	g_LoadedDataset = result;
	return true;
}
std::string ReflectionParser::GetFileID(std::string const & fileName)
{
  boost::filesystem::path inputPath(fileName);
  std::string res = inputPath.filename().string();

  for (std::string::iterator it = res.begin(); it != res.end(); ++it)
  {
    if (*it == ' ' || *it == '-' || *it == '.')
    {
      *it = '_';
    }
  }

  return res;
}
示例#12
0
/** For each file in the directory or for the file passed in input, call
 * parse_pdf.
 * @param input A directory or an pdf file.
 * @param outputDir Output dir.
 */
static int process_input(const char* input, const SkString& outputDir) {
    int failures = 0;
    if (sk_isdir(input)) {
        SkOSFile::Iter iter(input, PDF_FILE_EXTENSION);
        SkString inputFilename;
        while (iter.next(&inputFilename)) {
            SkString inputPath = SkOSPath::SkPathJoin(input, inputFilename.c_str());
            if (!process_pdf(inputPath, outputDir)) {
                ++failures;
            }
        }
    } else {
        SkString inputPath(input);
        if (!process_pdf(inputPath, outputDir)) {
            ++failures;
        }
    }
    return failures;
}
示例#13
0
/** For each file in the directory or for the file passed in input, call
 * render_pdf.
 * @param input A directory or an skp file.
 * @param outputDir Output dir.
 * @param renderer The object responsible to render the skp object into pdf.
 */
static int process_input(const SkString& input, const SkString& outputDir,
                         sk_tools::PdfRenderer& renderer) {
    int failures = 0;
    if (sk_isdir(input.c_str())) {
        SkOSFile::Iter iter(input.c_str(), SKP_FILE_EXTENSION);
        SkString inputFilename;
        while (iter.next(&inputFilename)) {
            SkString inputPath;
            sk_tools::make_filepath(&inputPath, input, inputFilename);
            if (!render_pdf(inputPath, outputDir, renderer)) {
                ++failures;
            }
        }
    } else {
        SkString inputPath(input);
        if (!render_pdf(inputPath, outputDir, renderer)) {
            ++failures;
        }
    }
    return failures;
}
示例#14
0
TestResult::EOutcome TTLInitializeFromBufferTest2(Test& test)
{
    TestResult::EOutcome result = TestResult::eFailed;

    boost::filesystem::path inputPath(test.environment().getTestDataDirectory() / "TTLInitializeFromBufferTest2.bin");
    char buffer[512];
    int r = Ishiko::FileSystem::Utilities::readFile(inputPath.string().c_str(), buffer, 512);
    if (r > 0)
    {
        Ishiko::DNS::TTL ttl(56);
        const char* currentPos = buffer;
        if (ttl.initializeFromBuffer(buffer, buffer + r, &currentPos).failed())
        {
            if (ttl.asUInt32() == 56)
            {
                result = TestResult::ePassed;
            }
        }
    }

    return result;
}
示例#15
0
// Make sure we return an error if the size of the text is incorrect
TestResult::EOutcome TextRecordInitializeFromBufferTest2(Test& test)
{
    TestResult::EOutcome result = TestResult::eFailed;

    boost::filesystem::path inputPath(test.environment().getTestDataDirectory() / "TextRecordInitializeFromBufferTest2.bin");
    char buffer[512];
    int r = Ishiko::FileSystem::Utilities::readFile(inputPath.string().c_str(), buffer, 512);
    if (r > 0)
    {
        Ishiko::DNS::TextRecord textRecord("example.org.", 86400, "data2");
        const char* currentPos = buffer;
        if (textRecord.initializeFromBuffer(buffer, buffer + r, &currentPos).failed())
        {
            if (textRecord.text() == "data2")
            {
                result = TestResult::ePassed;
            }
        }
    }

    return result;
}
示例#16
0
// Make sure we return an error if the data is truncated
TestResult::EOutcome MailExchangeRecordInitializeFromBufferTest3(Test& test)
{
    TestResult::EOutcome result = TestResult::eFailed;

    boost::filesystem::path inputPath(test.environment().getTestDataDirectory() / "MailExchangeRecordInitializeFromBufferTest3.bin");
    char buffer[512];
    int r = Ishiko::FileSystem::Utilities::readFile(inputPath.string().c_str(), buffer, 512);
    if (r > 0)
    {
        Ishiko::DNS::MailExchangeRecord mailExchangeRecord("example.org.", 86400, 10, "mx2.example.org.");
        const char* currentPos = buffer;
        if (mailExchangeRecord.initializeFromBuffer(buffer, buffer + r, &currentPos).failed())
        {
            if ((mailExchangeRecord.preference() == 10) &&
                (mailExchangeRecord.exchange() == "mx2.example.org."))
            {
                result = TestResult::ePassed;
            }
        }
    }

    return result;
}
示例#17
0
void MainWindow::startPatching()
{
    Q_D(MainWindow);

    d->bytes = 0;
    d->maxBytes = 0;
    d->files = 0;
    d->maxFiles = 0;

    d->progressBar->setMaximum(0);
    d->progressBar->setValue(0);
    d->detailsLbl->clear();

    d->state = MainWindowPrivate::Patching;
    updateWidgetsVisibility();

    QString romId;
    if (d->instLocSel->currentIndex() == d->instLocs.size()) {
        romId = QStringLiteral("data-slot-%1").arg(d->instLocLe->text());
    } else if (d->instLocSel->currentIndex() == d->instLocs.size() + 1) {
        romId = QStringLiteral("extsd-slot-%1").arg(d->instLocLe->text());
    } else {
        romId = d->instLocs[d->instLocSel->currentIndex()].id;
    }


    QStringList suffixes;
    suffixes << QStringLiteral(".tar.md5");
    suffixes << QStringLiteral(".tar.md5.gz");
    suffixes << QStringLiteral(".tar.md5.xz");
    suffixes << QStringLiteral(".zip");

    QFileInfo qFileInfo(d->fileName);
    QString suffix;
    QString outputName;
    bool isOdin = false;

    for (const QString &suffix : suffixes) {
        if (d->fileName.endsWith(suffix)) {
            // Input name: <parent path>/<base name>.<suffix>
            // Output name: <parent path>/<base name>_<rom id>.zip
            outputName = d->fileName.left(d->fileName.size() - suffix.size())
                    % QStringLiteral("_")
                    % romId
                    % QStringLiteral(".zip");
            isOdin = suffix.contains(QStringLiteral(".tar.md5"));
            break;
        }
    }
    if (outputName.isEmpty()) {
        outputName = qFileInfo.completeBaseName()
                % QStringLiteral("_")
                % romId
                % QStringLiteral(".")
                % qFileInfo.suffix();
    }

    QString inputPath(QDir::toNativeSeparators(qFileInfo.filePath()));
    QString outputPath(QDir::toNativeSeparators(
            qFileInfo.dir().filePath(outputName)));

    FileInfoPtr fileInfo = new mbp::FileInfo();
    fileInfo->setInputPath(inputPath.toUtf8().constData());
    fileInfo->setOutputPath(outputPath.toUtf8().constData());
    fileInfo->setDevice(d->device);
    fileInfo->setRomId(romId.toUtf8().constData());

    if (isOdin) {
        d->patcher = d->pc->createPatcher("OdinPatcher");
    } else {
        d->patcher = d->pc->createPatcher("MultiBootPatcher");
    }

    emit runThread(d->patcher, fileInfo);
}
示例#18
0
//funzione principale
unsigned initAesCuda(std::string myKeyFile, unsigned char myKeyBuffer[], const unsigned int myKeyBitsSize, std::string myInputFile, char inputArray[], const unsigned inputArraySize){
	
	path inputPath(myInputFile.c_str());
	path keyPath(myKeyFile.c_str());
	
	if ( !exists(keyPath) )
		throw std::string("file "+keyPath.string()+" doesn't exist");

	if ( !exists(inputPath) )
		throw std::string("file "+inputPath.string()+" doesn't exist");
	
	if ( myKeyBitsSize!=256 && myKeyBitsSize!=128)
		throw std::string("cannot use a key dimension different from 256 or 128");

	if ( !myKeyBuffer )
		throw std::string("key array not allocated");

	if ( !inputArray )
		throw std::string("input array not allocated");

	boost::intmax_t inputFileSize	= getFileSize(inputPath);
	boost::intmax_t keyFileSize		= getFileSize(keyPath);

	if ( keyFileSize==0 ) 
		throw std::string("cannot use an empty input file");

	if ( inputFileSize==0 ) 
		throw std::string("cannot use an empty key file");

	if ( inputFileSize > inputArraySize - 1 && MODE) 
		throw std::string("cannot encrypt a file bigger than 34.603.007 bytes");

	if ( inputFileSize > inputArraySize && !MODE) 
		throw std::string("cannot decrypt a file bigger than 33MB");

	//legge l'input
	readFromFileNotForm(inputPath, inputArray, inputFileSize);
	
	std::vector<unsigned> keyArray(myKeyBitsSize/8);
	
	unsigned ekSize = (myKeyBitsSize != 256) ? 176 : 240;

	std::vector<unsigned> expKeyArray(ekSize);
	std::vector<unsigned> invExpKeyArray(ekSize);
	
	//legge la chiave
	readFromFileForm(keyPath, keyArray);

	std::cout << "\n###############################################################\n\n";
	std::cout << "AES - CUDA by Svetlin Manavski)\n\n";
	std::cout << "AES " << myKeyBitsSize << " is running...." << std::endl << std::endl;
	std::cout << "Input file size: " << inputFileSize << " Bytes" << std::endl << std::endl;
	std::cout << "Key: ";
	for (unsigned cnt=0; cnt<keyArray.size(); ++cnt)
		std::cout << std::hex << keyArray[cnt];

	if (MODE){
		//ENCRYPTION MODE

		//PADDING MANAGEMENT FOLLOWING THE PKCS STANDARD
		unsigned mod16 = inputFileSize % 16;
		unsigned div16 = inputFileSize / 16;

		unsigned padElem;
		if ( mod16 != 0 )
			padElem =  16 - mod16;
		else 
			padElem =  16;

		for (unsigned cnt = 0; cnt < padElem; ++cnt)
				inputArray[div16*16 + mod16 + cnt] = padElem;

		inputFileSize = inputFileSize + padElem;
		
		//IN THE ENCRYPTION MODE I NEED THE EXPANDED KEY
		expFunc(keyArray, expKeyArray);
		for (unsigned cnt=0; cnt<expKeyArray.size(); ++cnt){
			unsigned val = expKeyArray[cnt];
			unsigned char *pc = reinterpret_cast<unsigned char *>(&val);
			myKeyBuffer[cnt] = *(pc);
		}
	} else {
		//DECRYPTION MODE 

		//IN THE ENCRYPTION MODE I NEED THE INVERSE EXPANDED KEY
		expFunc(keyArray, expKeyArray);
		invExpFunc(expKeyArray, invExpKeyArray);
		for (unsigned cnt=0; cnt<invExpKeyArray.size(); ++cnt){
			unsigned val = invExpKeyArray[cnt];
			unsigned char *pc = reinterpret_cast<unsigned char *>(&val);
			myKeyBuffer[cnt] = *(pc);
		}
	}
	std::cout << std::endl;

	return inputFileSize;
}
示例#19
0
文件: main_dp.cpp 项目: ikmski/train
int main(int argc, char* argv[])
{
    if (2 != argc) {
        printf("arg[1] = inputFileName\n");
        return -1;
    }

    char* inputFileName = argv[1];
    FILE* infp;
    FILE* outfp;

    // 入力ファイル
    infp = fopen(inputFileName, "r");
    if (!infp) {
        printf("file not open.\n");
        return -1;
    }

    // 入力
    // X, Y
    int maxX = 0;
    int maxY = 0;
    fscanf(infp, "%d,%d", &maxX, &maxY);
    printf("(X, Y) = (%d, %d)\n", maxX, maxY);

    // 領域確保
    int** data = new int*[maxX+1];
    for (int i = 0; i <= maxX; ++i) {
        data[i] = new int[maxY+1];
    }

    // 初期化
    for (int i = 0; i <= maxX; ++i) {
        for (int j = 0; j <= maxY; ++j) {
            data[i][j] = 1;
        }
    }

    // Num of Blocked
    int numOfBlocked = 0;
    fscanf(infp, "%d", &numOfBlocked);
    printf("numOfBlocked = %d\n", numOfBlocked);

    // Blocked point
    for (int i = 0; i < numOfBlocked; ++i) {
        int tmpX = 0;
        int tmpY = 0;
        fscanf(infp, "%d,%d", &tmpX, &tmpY);
        data[tmpX][tmpY] = 0;
    }
    fclose(infp); // 入力ファイル

    for (int i = 0; i <= maxX; ++i) {
        for (int j = 0; j <= maxY; ++j) {
            printf("%d ", data[i][j]);
        }
        printf("\n");
    }

    RouteSearch* routeSearch = new RouteSearch(data, maxX, maxY);

    timeval startTime;     // 開始時刻
    timeval endTime;       // 終了時刻

    // 時間計測開始
    gettimeofday(&startTime, NULL);

    int result =  routeSearch->calc();
//printf("result = %d\n", result);

    // 時間計測終了
    gettimeofday(&endTime, NULL);
    double timeDiff = static_cast<double>(endTime.tv_sec  - startTime.tv_sec);
    double usecDiff = static_cast<double>(endTime.tv_usec - startTime.tv_usec);
    timeDiff += (usecDiff/1000000.0);

    delete routeSearch;

    // 出力ファイル
    std::string inputPath(inputFileName);
    int l = inputPath.length();
    std::string outputFileName(inputPath.substr(l-6));
    std::string indexStr(inputPath.substr(l-2));

    outfp = fopen(outputFileName.c_str(), "w");
    if (!outfp) {
        printf("file not open.");
        return -1;
    }

    fprintf(outfp, "Case #%s: %4d  %.3f[msec]\n", indexStr.c_str(), result, timeDiff*1000.0);
    printf("Case #%s: %4d  %.3f[msec]\n", indexStr.c_str(), result, timeDiff*1000.0);

    // 解放
    for (int i = 0; i <= maxX; ++i) {
        delete[] data[i];
    }
    delete[] data;


    return 0;
}
int main( int argc, char* argv[] )
{
    if ( argc != 4 )
    {
        Mojo::Core::Printf( "Usage: OpticalFlowCalculator.exe source_directory forward_destination_directory backward_destination_directory\n\nPress any key to exit." );
        getchar();
        return -1;
    }

    try
    {
        boost::filesystem::path inputPath( boost::filesystem::complete( argv[ 1 ] ) );
        boost::filesystem::path outputForwardPath( boost::filesystem::complete( argv[ 2 ] ) );
        boost::filesystem::path outputBackwardPath( boost::filesystem::complete( argv[ 3 ] ) );
        boost::filesystem::path outputPath;
        boost::filesystem::path opticalFlowColorMapPath;
        boost::filesystem::directory_iterator prevFile;
        boost::filesystem::directory_iterator nextFile;

        RELEASE_ASSERT( boost::filesystem::exists( "OpticalFlowColorMap.png" ) );

        cv::Mat opticalFlowColorMap = cv::imread( "OpticalFlowColorMap.png" );

        RELEASE_ASSERT( boost::filesystem::exists( inputPath ) );
        RELEASE_ASSERT( boost::filesystem::is_directory( inputPath ) );
        RELEASE_ASSERT( !boost::filesystem::exists( outputForwardPath ) || boost::filesystem::is_directory( outputForwardPath ) );
        RELEASE_ASSERT( !boost::filesystem::exists( outputBackwardPath ) || boost::filesystem::is_directory( outputBackwardPath ) );

        Mojo::Core::Printf( "Calculating optical flow for all consecutive image pairs in:\n\n    ", inputPath.native_directory_string(), "\n" );
        Mojo::Core::Printf( "Storing forward optical flow output in:\n\n    ", outputForwardPath.native_directory_string(), "\n" );
        outputPath                  = outputForwardPath;
        opticalFlowColorMapPath     = boost::filesystem::complete( outputPath / "OpticalFlowColorMap.png" );

        if ( !boost::filesystem::exists( outputPath ) )
        {
            boost::filesystem::create_directory( outputPath );
        }

        if ( !boost::filesystem::exists( opticalFlowColorMapPath ) )
        {
            boost::filesystem::copy_file( "OpticalFlowColorMap.png", opticalFlowColorMapPath );
        }

        prevFile = boost::filesystem::directory_iterator( inputPath );
        nextFile = boost::filesystem::directory_iterator( inputPath );

        ++nextFile;

        for (; nextFile != boost::filesystem::directory_iterator(); )
        {
            boost::filesystem::path prevFilePath( prevFile->path() );
            boost::filesystem::path nextFilePath( nextFile->path() );

            if ( boost::filesystem::is_regular_file( prevFilePath ) && boost::filesystem::is_regular_file( nextFilePath ) )
            {
                Mojo::Core::Printf( "Calculating optical flow from ", prevFilePath.filename(), " to ", nextFilePath.filename() );

                boost::filesystem::path opticalFlowMapPath           = outputPath / boost::filesystem::path( prevFilePath.stem() + "-to-"         + nextFilePath.stem() + ".raw" );
                boost::filesystem::path opticalFlowVisualizationPath = outputPath / boost::filesystem::path( prevFilePath.stem() + "-to-"         + nextFilePath.stem() + ".png" );
                boost::filesystem::path alignedImagePath             = outputPath / boost::filesystem::path( prevFilePath.stem() + "-aligned-to-" + nextFilePath.stem() + ".png" );

                cv::Mat prevImage                = cv::imread( prevFilePath.native_file_string() );
                cv::Mat nextImage                = cv::imread( nextFilePath.native_file_string() );
                cv::Mat opticalFlowMap           = CalculateOpticalFlowMap( prevImage, nextImage );
                cv::Mat opticalFlowVisualization = CalculateOpticalFlowVisualization( opticalFlowColorMap, opticalFlowMap );
                cv::Mat alignedImage             = CalculateAlignedImage( prevImage, opticalFlowMap );

                SaveOpticalFlowMap( opticalFlowMapPath, opticalFlowMap );
                SaveImage( opticalFlowVisualizationPath, opticalFlowVisualization );
                SaveImage( alignedImagePath, alignedImage );
            }

            ++prevFile;
            ++nextFile;
        }

        Mojo::Core::Printf( "\nStoring backward optical flow output in:\n\n    ", outputBackwardPath.native_directory_string(), "\n" );
        outputPath = outputBackwardPath;
        opticalFlowColorMapPath = boost::filesystem::complete( outputPath / "OpticalFlowColorMap.png" );


        if ( !boost::filesystem::exists( outputPath ) )
        {
            boost::filesystem::create_directory( outputPath );
        }

        if ( !boost::filesystem::exists( opticalFlowColorMapPath ) )
        {
            boost::filesystem::path opticalFlowColorMapPath( boost::filesystem::complete( outputPath / "OpticalFlowColorMap.png" ) );
            boost::filesystem::copy_file( "OpticalFlowColorMap.png", opticalFlowColorMapPath );
        }

        prevFile = boost::filesystem::directory_iterator( inputPath );
        nextFile = boost::filesystem::directory_iterator( inputPath );

        ++nextFile;

        for (; nextFile != boost::filesystem::directory_iterator(); )
        {
            boost::filesystem::path prevFilePath( prevFile->path() );
            boost::filesystem::path nextFilePath( nextFile->path() );

            if ( boost::filesystem::is_regular_file( prevFilePath ) && boost::filesystem::is_regular_file( nextFilePath ) )
            {
                Mojo::Core::Printf( "Calculating optical flow from ", nextFilePath.filename(), " to ", prevFilePath.filename() );

                boost::filesystem::path opticalFlowMapPath           = outputPath / boost::filesystem::path( nextFilePath.stem() + "-to-"         + prevFilePath.stem() + ".raw" );
                boost::filesystem::path opticalFlowVisualizationPath = outputPath / boost::filesystem::path( nextFilePath.stem() + "-to-"         + prevFilePath.stem() + ".png" );
                boost::filesystem::path alignedImagePath             = outputPath / boost::filesystem::path( nextFilePath.stem() + "-aligned-to-" + prevFilePath.stem() + ".png" );

                cv::Mat prevImage                = cv::imread( prevFilePath.native_file_string() );
                cv::Mat nextImage                = cv::imread( nextFilePath.native_file_string() );
                cv::Mat opticalFlowMap           = CalculateOpticalFlowMap( nextImage, prevImage );
                cv::Mat opticalFlowVisualization = CalculateOpticalFlowVisualization( opticalFlowColorMap, opticalFlowMap );
                cv::Mat alignedImage             = CalculateAlignedImage( nextImage, opticalFlowMap );

                SaveOpticalFlowMap( opticalFlowMapPath, opticalFlowMap );
                SaveImage( opticalFlowVisualizationPath, opticalFlowVisualization );
                SaveImage( alignedImagePath, alignedImage );
            }

            ++prevFile;
            ++nextFile;
        }
    }
    catch( std::exception e )
    {
        Mojo::Core::Printf( "Exception: ", e.what(), "\nPress any key to exit." );
        getchar();
        return -1;
    }

    Mojo::Core::Printf( "\nPress any key to exit." );
    getchar();
    return 0;
}