void GeneratePerlinNoiseProcess::run() { PerlinNoise pn; Image* pOutImage = 0; if ( mUseNormalization ) { pOutImage = pn.GenerateNormalized( mPersistence, mNrOctaves, mWidth, mHeight, mRed, mGreen, mBlue, mSeed, mZoom ); } else { pOutImage = pn.Generate( mPersistence, mNrOctaves, mWidth, mHeight, mRed, mGreen, mBlue, mSeed, mZoom ); } std::string imageName = std::string("PerlinClouds"); pOutImage->SetImageName( imageName ); AddResult( pOutImage ); // ownership of this image is transfered through GetImage() to ImageDataList }
bool GenerateSyntheticImagesTest() { bool allSuccess = true; int width = 256; int height = 256; double sigma1 = 3.0; double sigma2 = 15.0; double rho = -0.9; double sigma = 7.0; ArrayGrid<double>* pGrid = GridGenerator::GenerateHorizontalGradient(512, 128); ImageIO::WritePGM(pGrid, string("HorizontalGradient.pgm"), ImageIO::NULL_OUT); delete pGrid; ArrayGrid<double>* pInvZone = GridGenerator::GenerateInverseZonePlate ( ); ImageIO::WritePGM(pInvZone, string("InvZonePlate.pgm"), ImageIO::NULL_OUT ); delete pInvZone; ArrayGrid<double>* pZone = GridGenerator::GenerateZonePlate ( ); ImageIO::WritePGM(pZone, string("ZonePlate.pgm"), ImageIO::NULL_OUT ); delete pZone; ArrayGrid<double>* pSheppLogan = GridGenerator::GenerateSheppLogan ( ); ImageIO::WritePGM(pSheppLogan, string("SheppLogan.pgm"), ImageIO::NORMAL_OUT ); delete pSheppLogan; ArrayGrid<double>* pLogFrequencyContrast = GridGenerator::GenerateLogFrequencyContrastChart( ); ImageIO::WritePGM( pLogFrequencyContrast, string("LogFrequencyContrast.pgm"), ImageIO::NORMAL_OUT ); delete pLogFrequencyContrast; int nrPeriods = 85; ArrayGrid<double>* pStarChart = GridGenerator::GenerateStarChart( width, nrPeriods ); ImageIO::WritePGM( pStarChart, string("StarChart.pgm"), ImageIO::NORMAL_OUT ); delete pStarChart; double length = 13.0; double angle = 0.4; ArrayGrid<double>* pLine = GridGenerator::GenerateLine( width, height, length, angle ); ImageIO::WritePGM( pLine, string("PSFLine.pgm"), ImageIO::NORMAL_OUT ); delete pLine; ArrayGrid<double>* pSquare = GridGenerator::GenerateSquare( width, height, sigma); ImageIO::WritePGM(pSquare, string("PSFSquare.pgm"), ImageIO::NORMAL_OUT ); delete pSquare; ArrayGrid<double>* pDisk = GridGenerator::GenerateDisk( width, height, sigma); ImageIO::WritePGM(pDisk, string("PSFDisk.pgm"), ImageIO::NORMAL_OUT ); delete pDisk; ArrayGrid<double>* pAiry = GridGenerator::GenerateAiry( width, height, sigma); ImageIO::WritePGM(pAiry, string("Airy.pgm"), ImageIO::NORMAL_OUT ); delete pAiry; ArrayGrid<double>* pGauss = GridGenerator::GenerateGaussian( width, height, sigma1, sigma2, rho); ImageIO::WritePGM( pGauss, string("Gauss.pgm"), ImageIO::NORMAL_OUT ); delete pGauss; ArrayGrid<double>* pGx = GridGenerator::GenerateGaussianFirstDerivativeX( width, height, sigma1, sigma2 ); ImageIO::WritePGM( pGx, string("Gx.pgm"), ImageIO::GRADIENT_OUT ); ImageIO::WriteTXT( pGx, string("Gx.txt") ); delete pGx; ArrayGrid<double>* pGy = GridGenerator::GenerateGaussianFirstDerivativeY( width, height, sigma1, sigma2 ); ImageIO::WritePGM( pGy, string("Gy.pgm"), ImageIO::GRADIENT_OUT ); ImageIO::WriteTXT( pGy, string("Gy.txt") ); delete pGy; ArrayGrid<double>* pGxx = GridGenerator::GenerateGaussianSecondDerivativeX ( width, height, sigma1, sigma2 ); ImageIO::WritePGM( pGxx, string("Gxx.pgm"), ImageIO::NORMAL_OUT ); ImageIO::WriteTXT( pGxx, string("Gxx.txt") ); delete pGxx; ArrayGrid<double>* pGyy = GridGenerator::GenerateGaussianSecondDerivativeY ( width, height, sigma1, sigma2 ); ImageIO::WritePGM( pGyy, string("Gyy.pgm"), ImageIO::NORMAL_OUT ); ImageIO::WriteTXT( pGyy, string("Gyy.txt") ); delete pGyy; ArrayGrid<double>* pGxy = GridGenerator::GenerateGaussianMixedDerivativesXY ( width, height, sigma1, sigma2 ); ImageIO::WritePGM(pGxy, string("Gxy.pgm"), ImageIO::NORMAL_OUT ); delete pGxy; ArrayGrid<double>* pBars = GridGenerator::GenerateBars( width, height, 20 ); ImageIO::WritePGM( pBars, string("Bars.pgm"), ImageIO::NORMAL_OUT ); delete pBars; float persistence = 0.8; int octaves = 7; float red = 1.5; float green = 1.0; float blue = 2.0; int seed = 0; float zoom = 75; PerlinNoise pn; Image* pData = pn.Generate( persistence, octaves, width, height, red, green, blue, seed, zoom ); ImageIO::Write( pData, std::string("PerlinColor.ppm") ); delete pData; //ArrayGrid<int>* pIsing = GridGenerator::GenerateIsingTexture( ); //ImageIO::WritePGM(pGx, string("Ising.pgm"), ImageIO::GRADIENT_OUT ); //delete pIsing; return allSuccess; }