当前位置: 首页>>代码示例>>C++>>正文


C++ Image2D::SetValue方法代码示例

本文整理汇总了C++中Image2D::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ Image2D::SetValue方法的具体用法?C++ Image2D::SetValue怎么用?C++ Image2D::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image2D的用法示例。


在下文中一共展示了Image2D::SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeGaussianData

Image2D TestSetGenerator::MakeGaussianData(unsigned width, unsigned height)
{
	Image2D image = Image2D::MakeUnsetImage(width, height);
	for(unsigned y=0;y<height;++y) {
		for(unsigned x=0;x<width;++x) {
			image.SetValue(x, y, RNG::Gaussian());
		}
	}
	return image; 
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:10,代码来源:testsetgenerator.cpp

示例2: sampleRFIDistribution

Image2D TestSetGenerator::sampleRFIDistribution(unsigned width, unsigned height, double ig_over_rsq)
{
	Image2D image = Image2D::MakeUnsetImage(width, height);
	const double sigma = 1.0;

	for(size_t f=0; f<height;++f) {
		for(size_t t=0; t<width;++t) {
			image.SetValue(t, f, Rand(Gaussian)*sigma + ig_over_rsq / RNG::Uniform());
		}
	}
	return image;
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:12,代码来源:testsetgenerator.cpp

示例3: SetValueAt

void ImageTile::SetValueAt(Image2D &dest, unsigned frequencyIndex, unsigned scanIndex, long double newValue) {
	return dest.SetValue(_scanOffset + scanIndex, _channelOffset + frequencyIndex, newValue);
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:3,代码来源:imagetile.cpp

示例4: MakeTestSet

Image2D TestSetGenerator::MakeTestSet(int number, Mask2D& rfi, unsigned width, unsigned height, int gaussianNoise)
{
	Image2D image;
	switch(number)
	{
		case 0: // Image of all zero's
		return Image2D::MakeZeroImage(width, height);
		case 1: // Image of all ones
		image = Image2D::MakeUnsetImage(width, height);
		image.SetAll(1.0);
		break;
		case 2: // Noise
		return MakeNoise(width, height, gaussianNoise);
		case 3: { // Several broadband lines
		image = MakeNoise(width, height, gaussianNoise);
		AddBroadbandToTestSet(image, rfi, 1.0);
		} break;
		case 4: { // Several broadband lines
		image = MakeNoise(width, height, gaussianNoise);
		AddBroadbandToTestSet(image, rfi, 0.5);
		} break;
		case 5: { // Several broadband lines of random length
		image = MakeNoise(width, height, gaussianNoise);
		AddVarBroadbandToTestSet(image, rfi);
		} break;
		case 6: { // Different broadband lines + low freq background
		image = MakeNoise(width, height, gaussianNoise);
		AddVarBroadbandToTestSet(image, rfi);
		for(unsigned y=0;y<image.Height();++y) {
			for(unsigned x=0;x<image.Width();++x) {
				image.AddValue(x, y, sinn(num_t(x)*M_PIn*5.0 / image.Width()) + 0.1);
			}
		}
		} break;
		case 7: { // Different broadband lines + high freq background 
		image = MakeNoise(width, height, gaussianNoise);
		for(unsigned y=0;y<image.Height();++y) {
			for(unsigned x=0;x<image.Width();++x) {
				image.AddValue(x, y, sinn((long double) (x+y*0.1)*M_PIn*5.0L / image.Width() + 0.1));
				image.AddValue(x, y, sinn((long double) (x+pown(y, 1.1))*M_PIn*50.0L / image.Width() + 0.1));
			}
		}
		AddVarBroadbandToTestSet(image, rfi);
		for(unsigned y=0;y<image.Height();++y) {
			for(unsigned x=0;x<image.Width();++x) {
				image.AddValue(x, y, 1.0); 
			}
		}
		} break;
		case 8: {  // Different droadband lines + smoothed&subtracted high freq background
		image = MakeNoise(width, height, gaussianNoise);
		for(unsigned y=0;y<image.Height();++y) {
			for(unsigned x=0;x<image.Width();++x) {
				image.AddValue(x, y, sinn((num_t) (x+y*0.1)*M_PIn*5.0 / image.Width() + 0.1));
				image.AddValue(x, y, sinn((num_t) (x+pown(y, 1.1))*M_PIn*50.0 / image.Width() + 0.1));
			}
		}
		SubtractBackground(image);
		AddVarBroadbandToTestSet(image, rfi);
		} break;
		case 9: { //FFT of 7
		image = MakeTestSet(7, rfi, width, height);
		Image2D copy(image);
		FFTTools::CreateHorizontalFFTImage(image, copy, false);
		for(unsigned y=0;y<rfi.Height();++y) {
			for(unsigned x=0;x<rfi.Width();++x) {
				image.SetValue(x, y, image.Value(x, y) / sqrtn(image.Width()));
			}
		}
		} break;
		case 10: { // Identity matrix
		image = Image2D::MakeZeroImage(width, height);
		unsigned min = width < height ? width : height;
		for(unsigned i=0;i<min;++i) {
			image.SetValue(i, i, 1.0);
			rfi.SetValue(i, i, true);
		}
		} break;
		case 11: { // FFT of identity matrix
		image = MakeTestSet(10, rfi, width, height);
		Image2D copy(image);
		FFTTools::CreateHorizontalFFTImage(image, copy, false);
		for(unsigned y=0;y<rfi.Height();++y) {
			for(unsigned x=0;x<rfi.Width();++x) {
				image.SetValue(x, y, image.Value(x, y) / sqrtn(width)); 
			}
		}
		} break;
		case 12: { // Broadband contaminating all channels
		image = MakeNoise(width, height, gaussianNoise);
		for(unsigned y=0;y<image.Height();++y) {
			for(unsigned x=0;x<image.Width();++x) {
				image.AddValue(x, y, sinn((num_t) (x+y*0.1)*M_PIn*5.0 / image.Width() + 0.1));
				image.AddValue(x, y, sinn((num_t) (x+powl(y, 1.1))*M_PIn*50.0 / image.Width() + 0.1));
			}
		}
		AddBroadbandToTestSet(image, rfi, 1.0);
		} break;
		case 13: { // Model of three point sources with broadband RFI
		SetModelData(image, rfi, 3);
//.........这里部分代码省略.........
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:101,代码来源:testsetgenerator.cpp

示例5: main


//.........这里部分代码省略.........
				unsigned upper = i+9;
				if(upper > images) upper = images;
				cout << "Adding image " << (i+1) << " - " << upper << "..." << endl;
			}
			bool skip = false;
			if(removeNoiseImages > 0) {
				for(std::vector<ImageInfo>::const_iterator j=variances.begin();j<variances.begin()+removeNoiseImages;++j)
				{
					if(j->index == i) { skip = true; break; }
				}
			}
			if(!skip) {
				long double wavelengthRatio;
				if(images*inputCount > 1)
					wavelengthRatio = (1.0 - (long double) (i+((int) inputIndex-(int) pindex)*images) / (images*inputCount-1.0));
				else
					wavelengthRatio = 0.5;
				std::cout << "ratio=" << wavelengthRatio << '\n';
				Image2D *image = Image2D::CreateFromFits(fitsfile, i);
				if(subtract)
				{
					Image2D *imageB = Image2D::CreateFromFits(*subtractFits, i);
					Image2D *AminB = Image2D::CreateFromDiff(*image, *imageB);
					delete image;
					image = AminB;
					delete imageB;
				}
				if(window)
				{
					Image2D *empty = Image2D::CreateZeroImage(image->Width(), image->Height());
					for(unsigned y=image->Height()-windowY-windowHeight;y<image->Height()-windowY;++y)
					{
						for(unsigned x=windowX;x<windowX+windowWidth;++x)
							empty->SetValue(x, y, image->Value(x, y));
					}
					delete image;
					image = empty;
				}
				if(cutWindow)
				{
					for(unsigned y=image->Height()-cutWindowY-cutWindowHeight;y<image->Height()-cutWindowY;++y)
					{
						for(unsigned x=cutWindowX;x<cutWindowX+cutWindowWidth;++x)
							image->SetValue(x, y, 0.0);
					}
				}
				if(fft) {
					Image2D *fft = FFTTools::CreateFFTImage(*image, FFTTools::Absolute);
					Image2D *fullfft = FFTTools::CreateFullImageFromFFT(*fft);
					delete image;
					delete fft;
					image = fullfft;
				}
				long double max;
				if(individualMaximization) {
					max = image->GetMaximum();
					if(max <= 0.0) max = 1.0;
				} else {
					max = 1.0;
				}
				if(displayMax)
					cout << "max=" << image->GetMinimum() << ":" << image->GetMaximum() << endl; 
				if(rms)
					ReportRMS(image);
				long double r=0.0,g=0.0,b=0.0;
				if(redblue) {
开发者ID:jjdmol,项目名称:LOFAR,代码行数:67,代码来源:colormapper.cpp


注:本文中的Image2D::SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。