Beispiel #1
0
    void testEntryRetrievalAppendLargeToFirstFileAndAppendSmallToSecond()
    {
        long const blocks = 2048;
        boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
        teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);

        {
            std::string testString(createLargeStringToWrite());
            teasafe::TeaSafeFile entry = folder.getTeaSafeFile("picture.jpg", teasafe::OpenDisposition::buildAppendDisposition());
            std::vector<uint8_t> vec(testString.begin(), testString.end());
            entry.write((char*)&vec.front(), testString.length());
            entry.flush();
            entry.seek(0); // seek to start since retrieving from folder automatically seeks to end
            vec.resize(entry.fileSize());
            entry.read((char*)&vec.front(), entry.fileSize());
            std::string result(vec.begin(), vec.end());
        }
        {
            std::string testData("some test data!");
            teasafe::TeaSafeFile entry = folder.getTeaSafeFile("some.log", teasafe::OpenDisposition::buildAppendDisposition());
            std::vector<uint8_t> vec(testData.begin(), testData.end());
            entry.write((char*)&vec.front(), testData.length());
            entry.flush();
            entry.seek(0); // seek to start since retrieving from folder automatically seeks to end
            vec.resize(entry.fileSize());
            entry.read((char*)&vec.front(), entry.fileSize());
            std::string result(vec.begin(), vec.end());
            ASSERT_EQUAL(result, testData, "testEntryRetrievalAppendLargeToFirstFileAndAppendSmallToSecond");
        }
    }
Beispiel #2
0
    void testTeaSafeFolderRetrievalAddEntries()
    {
        long const blocks = 2048;
        boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
        teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
        teasafe::TeaSafeFolder subFolder = folder.getTeaSafeFolder("folderA");
        subFolder.addTeaSafeFile("subFileA");
        subFolder.addTeaSafeFile("subFileB");
        subFolder.addTeaSafeFile("subFileC");
        subFolder.addTeaSafeFile("subFileD");

        // test root entries still intact
        {
            std::vector<teasafe::EntryInfo> entries = folder.listAllEntries();
            ASSERT_EQUAL(entries.size(), 6, "testTeaSafeFolderRetrievalAddEntries: root number of entries");
            std::vector<teasafe::EntryInfo>::iterator it = entries.begin();
            ASSERT_EQUAL(entries[0].filename(), "test.txt", "testTeaSafeFolderRetrievalAddEntries: root filename A");
            ASSERT_EQUAL(entries[1].filename(), "some.log", "testTeaSafeFolderRetrievalAddEntries: root filename B");
            ASSERT_EQUAL(entries[2].filename(), "folderA", "testTeaSafeFolderRetrievalAddEntries: root filename C");
            ASSERT_EQUAL(entries[3].filename(), "picture.jpg", "testTeaSafeFolderRetrievalAddEntries: root filename D");
            ASSERT_EQUAL(entries[4].filename(), "vai.mp3", "testTeaSafeFolderRetrievalAddEntries: root filename E");
            ASSERT_EQUAL(entries[5].filename(), "folderB", "testTeaSafeFolderRetrievalAddEntries: root filename F");
        }
        // test sub folder entries exist
        {
            std::vector<teasafe::EntryInfo> entries = subFolder.listAllEntries();
            ASSERT_EQUAL(entries.size(), 4, "testTeaSafeFolderRetrievalAddEntries: subfolder number of entries");
            std::vector<teasafe::EntryInfo>::iterator it = entries.begin();
            ASSERT_EQUAL(entries[0].filename(), "subFileA", "testTeaSafeFolderRetrievalAddEntries: subFolder filename A");
            ASSERT_EQUAL(entries[1].filename(), "subFileB", "testTeaSafeFolderRetrievalAddEntries: subFolder filename B");
            ASSERT_EQUAL(entries[2].filename(), "subFileC", "testTeaSafeFolderRetrievalAddEntries: subFolder filename C");
            ASSERT_EQUAL(entries[3].filename(), "subFileD", "testTeaSafeFolderRetrievalAddEntries: subFolder filename D");
        }
    }
Beispiel #3
0
static void test_discarded_image(skiatest::Reporter* reporter, const SkMatrix& transform,
                                 sk_sp<SkImage> (*buildImage)()) {
    auto surface(SkSurface::MakeRasterN32Premul(10, 10));
    SkCanvas* canvas = surface->getCanvas();

    // SkBitmapCache is global, so other threads could be evicting our bitmaps.  Loop a few times
    // to mitigate this risk.
    const unsigned kRepeatCount = 42;
    for (unsigned i = 0; i < kRepeatCount; ++i) {
        SkAutoCanvasRestore acr(canvas, true);

        sk_sp<SkImage> image(buildImage());

        // always use high quality to ensure caching when scaled
        SkPaint paint;
        paint.setFilterQuality(kHigh_SkFilterQuality);

        // draw the image (with a transform, to tickle different code paths) to ensure
        // any associated resources get cached
        canvas->concat(transform);
        canvas->drawImage(image, 0, 0, &paint);

        const auto desc = SkBitmapCacheDesc::Make(image.get());

        // delete the image
        image.reset(nullptr);

        // all resources should have been purged
        SkBitmap result;
        REPORTER_ASSERT(reporter, !SkBitmapCache::Find(desc, &result));
    }
}
Beispiel #4
0
 void testListAllEntriesEmpty()
 {
     long const blocks = 2048;
     boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
     teasafe::SharedCoreIO io(createTestIO(testPath));
     teasafe::TeaSafeFolder folder(io, 0, std::string("root"));
     std::vector<teasafe::EntryInfo> entries = folder.listAllEntries();
     ASSERT_EQUAL(entries.size(), 0, "testListAllEntriesEmpty: number of entries");
 }
Beispiel #5
0
 void testRemoveEmptySubFolder()
 {
     long const blocks = 2048;
     boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
     teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
     folder.removeTeaSafeFolder("folderA");
     std::vector<teasafe::EntryInfo> entries = folder.listAllEntries();
     ASSERT_EQUAL(entries.size(), 5, "testRemoveEmptySubFolder: number of entries after removal");
 }
Beispiel #6
0
 void testListFolderEntries()
 {
     long const blocks = 2048;
     boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
     teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
     std::vector<teasafe::EntryInfo> entries = folder.listFolderEntries();
     ASSERT_EQUAL(entries.size(), 2, "testListFolderEntries: number of entries");
     std::vector<teasafe::EntryInfo>::iterator it = entries.begin();
     ASSERT_EQUAL(entries[0].filename(), "folderA", "testListFolderEntries: filename C");
     ASSERT_EQUAL(entries[1].filename(), "folderB", "testListFolderEntries: filename F");
 }
Beispiel #7
0
Engine::Engine( int cornerX, int cornerY, int w, int h, const char *label )
    : Fl_Double_Window(cornerX,cornerY,w,h,label),
      state(PREVIEW), framesPerCycle(50),
      pointsForFraming(100000), animationFraming(0.1),
      pointsPerFrame(20000), minimalBuiltPoints(1000),
      imageSavedWidth(800), imageSavedHeight(600),
      animationSavedWidth(160), animationSavedHeight(120),
      intervalFrame(40),
      clockNumber(true), skel2("triangle"),
      trueDensity(true), colored(false) {
    imageLarge = buildImage( w, h );
}
Beispiel #8
0
 void testListFileEntries()
 {
     long const blocks = 2048;
     boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
     teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
     std::vector<teasafe::EntryInfo> entries = folder.listFileEntries();
     ASSERT_EQUAL(entries.size(), 4, "testListFileEntries: number of entries");
     std::vector<teasafe::EntryInfo>::iterator it = entries.begin();
     ASSERT_EQUAL(entries[0].filename(), "test.txt", "testListFileEntries: filename A");
     ASSERT_EQUAL(entries[1].filename(), "some.log", "testListFileEntries: filename B");
     ASSERT_EQUAL(entries[2].filename(), "picture.jpg", "testListFileEntries: filename D");
     ASSERT_EQUAL(entries[3].filename(), "vai.mp3", "testListFileEntries: filename E");
 }
Beispiel #9
0
    void testAddEntryNameRetrieval()
    {
        long const blocks = 2048;
        boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);

        {
            teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
            ASSERT_EQUAL(folder.getEntryInfo(0).filename(), "test.txt", "testAddEntryNameRetrieval A");
            ASSERT_EQUAL(folder.getEntryInfo(1).filename(), "some.log", "testAddEntryNameRetrieval B");
            ASSERT_EQUAL(folder.getEntryInfo(2).filename(), "folderA", "testAddEntryNameRetrieval B");
            ASSERT_EQUAL(folder.getEntryInfo(3).filename(), "picture.jpg", "testAddEntryNameRetrieval C");
            ASSERT_EQUAL(folder.getEntryInfo(4).filename(), "vai.mp3", "testAddEntryNameRetrieval D");
            ASSERT_EQUAL(folder.getEntryInfo(5).filename(), "folderB", "testAddEntryNameRetrieval B");
        }
    }
Beispiel #10
0
bool PNGAImageWriter::Export(QFile& file) {
    QImage pixmap = buildImage();
    assert(pixmap.isGrayscale());
    png::image<png::gray_pixel> image(pixmap.width(), pixmap.height());
    for (size_t y = 0; y < image.get_height(); ++y)
    {
        for (size_t x = 0; x < image.get_width(); ++x)
        {
            QRgb pix = pixmap.pixel(x, y);
            assert(qIsGray(pix));
            image[y][x] = png::gray_pixel(qAlpha(pix));
        }
    }
    image.write(file.fileName().toStdString());
    return true;
}
Beispiel #11
0
void
Engine::transition() {
    const int imagesWidth  = ( state == SAVEMNG ) ? animationSavedWidth : w();
    const int imagesHeight = ( state == SAVEMNG ) ? animationSavedHeight : h();
    Skeleton skelWork( skel1.size() );
    std::vector<Zoom> zooms;
    for ( std::vector< Image* >::const_iterator i = images.begin(); i != images.end(); ++i ) {
	delete *i;
    }
    images.clear();
    const MinMax minmax = findFrameTransition( (int)(animationFraming*pointsForFraming) );
    for ( float k=-framesPerCycle; k <= 0; ++k ) {
	const float rate = ( 1 - cos( M_PI*k/framesPerCycle ) ) / 2;
	skelWork.weightedMix( skel1, skel2, rate );
	zooms.push_back( Zoom( minmax, imagesWidth, imagesHeight,
			       skelWork.getZoomFunction(), framesPerCycle ) );
	images.push_back( buildImage( imagesWidth, imagesHeight, w(), h() ) );
    }
    int idemo = 1;
    const int idemoMax = 3;
    unsigned long timer = clock();
    while ( idemo <= idemoMax ) {
	for ( int k = -framesPerCycle; k <= framesPerCycle-1; ++k ) {
	    float rate = ( 1 - cos( M_PI*k/framesPerCycle ) ) / 2;
	    skelWork.weightedMix( skel1, skel2, rate );
	    const int i = (k > 0)? framesPerCycle - k: k+framesPerCycle;
	    if ( clockNumber ) {
		drawPoints( skelWork, zooms[i], *images[i], timer );
	    } else {
		drawPoints( skelWork, zooms[i], *images[i], pointsPerFrame );
	    }
	    if ( state != ANIMATION && state != DEMO && state != SAVEMNG ) {
	        return;
	    }
	    if ( state == DEMO && idemo == idemoMax && k == 0 ) {
		return; // break
	    }
	    if ( state == SAVEMNG && k == 0 ) {
		return; // break
	    }
	}
	if ( state == DEMO ) {
	    ++idemo;
	}
    }
}
NoiseTexture2D::NoiseTexture2D( unsigned int pixelSize ) 
{
    _pixelSize = pixelSize;
    _image = new osg::Image();
        
    buildImage();
    
    setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
    setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
    
    setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR );
    setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR ); 
    
    setBorderWidth( 0 );
    
    setInternalFormat( GL_LUMINANCE32F_ARB );
}
Beispiel #13
0
void
Engine::rotation() {
    const int imagesWidth  = ( state == SAVEMNG ) ? animationSavedWidth : w();
    const int imagesHeight = ( state == SAVEMNG ) ? animationSavedHeight : h();
    Skeleton skelWork = skel;
    std::vector<Zoom> zooms;
    for ( std::vector< Image* >::const_iterator i = images.begin(); i != images.end(); ++i ) {
	delete *i;
    }
    images.clear();
    const MinMax minmax = findFrameRotation( (int)(animationFraming*pointsForFraming) );
    for ( float k=-framesPerCycle; k <= framesPerCycle-1; ++k ) {
	skelWork.rotate( 2*M_PI/(2*framesPerCycle) );
	zooms.push_back( Zoom( minmax, imagesWidth, imagesHeight,
			       skelWork.getZoomFunction(), framesPerCycle ) );
	images.push_back( buildImage( imagesWidth, imagesHeight, w(), h() ) );
    }
    int idemo = 1;
    const int idemoMax = 2;
    unsigned long timer = clock();
    while ( idemo <= idemoMax ) {
	// to avoid a shift due to bad accuracy of rotate():
	skelWork = skel;
	for ( int k = -framesPerCycle; k <= framesPerCycle-1; ++k ) {
	    if ( clockNumber ) {
		drawPoints( skelWork, zooms[k+framesPerCycle],
			    *images[k+framesPerCycle], timer );
	    } else {
		drawPoints( skelWork, zooms[k+framesPerCycle],
			    *images[k+framesPerCycle], pointsPerFrame );
	    }
	    skelWork.rotate( 2*M_PI/(2*framesPerCycle) );
	    if ( state != ANIMATION && state != DEMO && state != SAVEMNG ) {
	        return;
	    }
	}
	if ( state == DEMO ) {
	    ++idemo;
	}
	if ( state == SAVEMNG ) {
	    return; // break
	}
    }
}
bool DistanceFieldWriter::Export(QFile& file) {
    QImage pixmap = buildImage();

    DistanceField * field = new DistanceField(pixmap.width(), pixmap.height());
    for(int y = 0; y < pixmap.height(); y++) {
        const QRgb * scanline = (QRgb*)pixmap.scanLine(y);
        for(int x = 0; x < pixmap.width(); x++) {
            field->SetPixel(x, y, qAlpha(scanline[x]) <= 0);
        }
    }
    field->Generate();
    QImage largePixmap(pixmap.width(),pixmap.height(),QImage::Format_Indexed8);
    largePixmap.setColorCount(256);
    for(int i = 0; i < 256; i++) largePixmap.setColor(i, qRgb(i,i,i));
    for(int y = 0; y < pixmap.height(); y++) {
        for(int x = 0; x < pixmap.width(); x++) {
            int dist = field->GetDistance(x, y) + 128;
            if(dist < 0) dist = 0;
            if(dist > 255) dist = 255;
            largePixmap.setPixel(x, y, dist);
        }
    }
    delete field;

    /* Scale the large distance field down */
    QImage smallPixmap = largePixmap.scaled(pixmap.width() / 16, pixmap.height() / 16, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);

    /* Convert the small pixmap to indexed format */
    QImage small8BitPixmap(smallPixmap.width(), smallPixmap.height(), QImage::Format_Indexed8);
    for(int i = 0; i < 256; i++) small8BitPixmap.setColor(i, qRgb(i,i,i));
    for(int y = 0; y < smallPixmap.height(); y++) {
        const QRgb * scanline = (QRgb*)smallPixmap.scanLine(y);
        for(int x = 0; x < smallPixmap.width(); x++) {
            small8BitPixmap.setPixel(x, y, qRed(scanline[x]));
        }
    }
    small8BitPixmap.save(&file, m_format.toUtf8().data());

    return true;
}
void FboBlending::update(bool forceUpdate){
	bool modified = forceUpdate;
	
	if(_gammaTop != gammaTop || _gammaBottom != gammaBottom || _gammaLeft != gammaLeft || _gammaRight != gammaRight){
	_gammaTop = gammaTop;
	_gammaBottom = gammaBottom;
	_gammaLeft = gammaLeft;
	_gammaRight = gammaRight;
		modified = true;
	}
	
	if(top.gammaR.g != gammaR || top.gammaG.g != gammaG || top.gammaB.g != gammaB){
		top.setGamma(gammaR, gammaG, gammaB);
		bottom.setGamma(gammaR, gammaG, gammaB);
		left.setGamma(gammaR, gammaG, gammaB);
		right.setGamma(gammaR, gammaG, gammaB);
		modified = true;
	}
	if(!(_top == top)){
		_top = (top);
		modified = true;
	}
	if(!(_bottom == bottom)){
		_bottom = (bottom);
		modified = true;
	}
	if(!(_left == left)){
		_left = (left);
		modified = true;
	}
	if(!(_right == right)){
		_right = (right);
		modified = true;
	}
	
	if(modified){
		buildImage();
		//rebuild blending image!
	}
}
Beispiel #16
0
    void testTeaSafeFolderRetrievalAddEntriesAppendData()
    {
        long const blocks = 2048;
        boost::filesystem::path testPath = buildImage(m_uniquePath, blocks);
        teasafe::TeaSafeFolder folder = createTestFolder(testPath, blocks);
        teasafe::TeaSafeFolder subFolder = folder.getTeaSafeFolder("folderA");
        subFolder.addTeaSafeFile("subFileA");
        subFolder.addTeaSafeFile("subFileB");
        subFolder.addTeaSafeFile("subFileC");
        subFolder.addTeaSafeFile("subFileD");

        std::string testData("some test data!");
        teasafe::TeaSafeFile entry = subFolder.getTeaSafeFile("subFileB", teasafe::OpenDisposition::buildAppendDisposition());
        std::vector<uint8_t> vec(testData.begin(), testData.end());
        entry.write((char*)&vec.front(), testData.length());
        entry.flush();
        entry.seek(0); // seek to start since retrieving from folder automatically seeks to end
        vec.resize(entry.fileSize());
        entry.read((char*)&vec.front(), entry.fileSize());
        std::string result(vec.begin(), vec.end());
        ASSERT_EQUAL(result, testData, "testTeaSafeFolderRetrievalAddEntriesAppendData");
    }
Beispiel #17
0
 Image(uint16_t * rawImage, const RawParameters & params, const QString& _filename) :
     filename(_filename)
 {
     buildImage(rawImage, params);
 }
Beispiel #18
0
void
Engine::resetImage( int w, int h, int wd, int wh, int s ) {
    delete imageLarge;
    imageLarge = buildImage( w, h, wd, wh, s );
}
Beispiel #19
0
void
Engine::zoom() {
    const int imagesWidth  = ( state == SAVEMNG ) ? animationSavedWidth : w();
    const int imagesHeight = ( state == SAVEMNG ) ? animationSavedHeight : h();
    Skeleton skelSubframe;
    // we must check that we are not going to zoom inside the zoom function:
    if ( skel.selected() == 0 ) {
        // this section should be synchronized since the selected function
        // can be changed before its use by Skeleton::subframe
	skel.shiftSelectedFunction(1);
    }
    skelSubframe.subframe(skel);
    Function functionWork;
    const Zoom zoom( skel.findFrame( pointsForFraming, _x, _y, _color ),
		     imagesWidth, imagesHeight, skel.getZoomFunction(), framesPerCycle );
    for ( std::vector< Image* >::const_iterator i = images.begin(); i != images.end(); ++i ) {
	delete *i;
    }
    images.clear();
    for ( int i = 0; i < framesPerCycle; ++i ) {
	images.push_back( buildImage( imagesWidth, imagesHeight, w(), h() ) );
    }
    int idemo = 1;
    const int idemoMax = 3;
    unsigned long clock0 = clock();
    const float dilat0 = 1.0/skelSubframe.getFunction().surface();
    const float dilat1 = 1.0/skel.getFunction().surface();
    const float otherDilat = 1.0/(skel.sumSurfaces() - skel.getFunction().surface());
    while ( idemo <= idemoMax ) {
	for ( int k = 0; k < framesPerCycle; ++k ) {
	    const float rate = (float)k / framesPerCycle;
	    functionWork.spiralMix( skel.getFunction(), skelSubframe.getFunction(), rate );
	    functionWork.calculateTemp();
	    int pointsToCalculate = pointsPerFrame;
	    if ( state == SAVEMNG) {	
		// points(t) = points(0)*(1 + S/s(t) * (1/s(t) - 1/s(0))/(1/s(1) - 1/s(0)) ) 
		pointsToCalculate = (int)( ( 1.0 + (1/functionWork.surface()-dilat0)
					     / (dilat1-dilat0) * dilat1 / otherDilat
					       ) * pointsPerFrame );
		// to avoid explosion of computation time:
		if ( pointsToCalculate > 100 * pointsPerFrame ) {
		    pointsToCalculate = 100 * pointsPerFrame;
		}
	    }
	    for ( int i = 1; clockNumber || i < pointsToCalculate; ++i ) {
		skel.nextPoint( _x, _y, _color );
		float zx = _x;
		float zy = _y;
		functionWork.previousPoint( zx, zy, false );
		zoom.toScreen( zx, zy );
		images[k]->mem_plot( zoom.screenX, zoom.screenY );
		images[k]->mem_coul( zoom.screenX, zoom.screenY, _color );
		if ( clockNumber ) {
		    if ( i % minimalBuiltPoints == 0 ) {
			const unsigned long newClock = clock();
			if ( newClock - clock0 >= intervalFrame * timecv ) {
			    clock0 = newClock;
			    break;
			}
		    }
		}
	    }
	    make_current();
	    images[k]->mem_draw();
	    if ( Fl::ready() ) {
		Fl::check();
	    }
	    if ( state != ANIMATION && state != DEMO && state != SAVEMNG ) {
	        return;
	    }
	}
	if ( state == DEMO ) {
	    ++idemo;
	}
	if ( state == SAVEMNG ) {
	    return;
	}
    }
}
Beispiel #20
0
int main()
{
	//learning rate
	double alpha = 0.03;
	int maxIter = 15000;
	int miniBatchSize = 1000;
	double noiseRatio = 0.3;
	int inputSize = 28*28;
	int hiddenSize = 28;
	int imgWidth = 8; 
	char *fileBuf  = new char[4096];
	bool ret = loadFileToBuf("ParamConfig.ini",fileBuf,4096);
	if(ret)
	{
		getConfigDoubleValue(fileBuf,"noiseRatio:",noiseRatio);
		getConfigDoubleValue(fileBuf,"alpha:",alpha);
		getConfigIntValue(fileBuf,"maxIter:",maxIter);
		getConfigIntValue(fileBuf,"miniBatchSize:",miniBatchSize);
		getConfigIntValue(fileBuf,"hiddenSize:",hiddenSize);
		getConfigIntValue(fileBuf,"inputSize:",inputSize);
		getConfigIntValue(fileBuf,"imgWidth:",imgWidth);
		cout << "noiseRatio:" << noiseRatio << endl;
		cout << "alpha:" << alpha << endl;
		cout << "maxIter:" << maxIter << endl;
		cout << "miniBatchSize:" << miniBatchSize << endl;
		cout << "hiddenSize:" << hiddenSize << endl;
		cout << "inputSize:" << inputSize << endl;
		cout << "imgWidth:" << imgWidth << endl;
	}
	delete []fileBuf;

	//set eigen threads
	SYSTEM_INFO info;
	GetSystemInfo(&info);
	Eigen::setNbThreads(info.dwNumberOfProcessors);

	MatrixXd trainData(1,inputSize);
	DAE dae(inputSize,hiddenSize);
	ret = loadMnistData(trainData,"mnist\\train-images-idx3-ubyte");
	cout << "Loading training data..." << endl;
	if(ret == false)
	{
		return -1;
	}
	clock_t start = clock();
	//cout << trainData.rows() << " " << trainData.cols() << endl; 
	MatrixXd showImage = trainData.leftCols(100).transpose();
	buildImage(showImage,imgWidth,"data.jpg");
	dae.train(trainData,noiseRatio,alpha,maxIter,miniBatchSize);
	cout << "End Train" << endl;
	MatrixXd hiddenTheta = dae.getTheta();
	buildImage(hiddenTheta,imgWidth,"weights.jpg",true);
	cout << "Saving hidden neurons" << endl;
	dae.saveModel("DAE_Model.txt");
	clock_t end = clock();
	cout << "The code ran for " << (end - start)/(double)(CLOCKS_PER_SEC*60)
		<< " minutes on " << Eigen::nbThreads() << " thread(s)." << endl;
	cout << "noiseRatio: " << noiseRatio << endl;
	cout << "alpha: " << alpha << endl;
	cout << "miniBatchSize: " << miniBatchSize << endl;
	system("pause");
	return 0;
}