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


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

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


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

示例1: AddRfiPos

void TestSetGenerator::AddRfiPos(Image2D& data, Mask2D& rfi, double lineStrength, size_t startTime, size_t duration, unsigned frequencyPos)
{
	for(size_t t=startTime;t<startTime+duration;++t) {
		data.AddValue(t, frequencyPos, lineStrength);
		if(lineStrength > 0)
			rfi.SetValue(t, frequencyPos, true);
	}
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:8,代码来源:testsetgenerator.cpp

示例2: AddBroadbandLinePos

void TestSetGenerator::AddBroadbandLinePos(Image2D& data, Mask2D& rfi, double lineStrength, size_t startTime, size_t duration, unsigned frequencyStart, double frequencyEnd, enum BroadbandShape shape)
{
	const double s = (frequencyEnd-frequencyStart);
	for(size_t f=frequencyStart;f<frequencyEnd;++f) {	
		// x will run from -1 to 1
		const double x = (double) ((f-frequencyStart)*2)/s-1.0;
		double factor = shapeLevel(shape, x);
		for(size_t t=startTime;t<startTime+duration;++t) {
			data.AddValue(t, f, lineStrength * factor);
			if(lineStrength > 0.0)
				rfi.SetValue(t, f, true);
		}
	}
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:14,代码来源:testsetgenerator.cpp

示例3: AddSlewedBroadbandLinePos

void TestSetGenerator::AddSlewedBroadbandLinePos(Image2D& data, Mask2D& rfi, double lineStrength, double slewrate, size_t startTime, size_t duration, unsigned frequencyStart, double frequencyEnd, enum BroadbandShape shape)
{
	const double s = (frequencyEnd-frequencyStart);
	for(size_t f=frequencyStart;f<frequencyEnd;++f) {	
			// x will run from -1 to 1
		const double x = (double) ((f-frequencyStart)*2)/s-1.0;
		double factor = shapeLevel(shape, x);
		double slew = slewrate * (double) f;
		size_t slewInt = (size_t) slew;
		double slewRest = slew - slewInt;
		
		data.AddValue(startTime+slewInt, f, lineStrength * factor * (1.0 - slewRest));
		if(lineStrength > 0.0)
			rfi.SetValue(startTime+slewInt, f, true);
		for(size_t t=startTime+1;t<startTime+duration;++t) {
			data.AddValue(t+slewInt, f, lineStrength * factor);
			if(lineStrength > 0.0)
				rfi.SetValue(t+slewInt, f, true);
		}
		data.AddValue(startTime+duration+slewInt, f, lineStrength * factor * slewRest);
		if(lineStrength > 0.0)
			rfi.SetValue(startTime+duration+slewInt, f, true);
	}
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:24,代码来源:testsetgenerator.cpp

示例4: SubtractBackground

void TestSetGenerator::SubtractBackground(Image2D& image)
{
	Mask2DPtr zero = Mask2D::CreateSetMaskPtr<false>(image.Width(), image.Height());
	LocalFitMethod fittedImage;
	fittedImage.SetToWeightedAverage(20, 40, 7.5, 15.0);
	Image2DPtr imagePtr = Image2D::MakePtr(image);
	TimeFrequencyData data(TimeFrequencyData::AmplitudePart, Polarization::StokesI, imagePtr);
	data.SetGlobalMask(zero);
	fittedImage.Initialize(data);
	for(unsigned i=0;i<fittedImage.TaskCount();++i)
		fittedImage.PerformFit(i);
	image = Image2D::MakeFromDiff(image, *fittedImage.Background().GetSingleImage());
	for(unsigned y=0;y<image.Height();++y) {
		for(unsigned x=0;x<image.Width();++x) {
			image.AddValue(x, y, 1.0);
		}
	}
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:18,代码来源:testsetgenerator.cpp

示例5: 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

示例6: main


//.........这里部分代码省略.........
					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) {
					r = 1.0;
					b = 1.0;
				} else if(useSpectrum)
					ScaledWLtoRGB(wavelengthRatio, r, g, b);
				else
					HLStoRGB(wavelengthRatio, 0.5, 1.0, r, g, b);
				totalRed += r;
				totalGreen += g;
				totalBlue += b;
				if(red == 0) {
					red = Image2D::CreateUnsetImage(image->Width(), image->Height());
					green = Image2D::CreateUnsetImage(image->Width(), image->Height());
					blue = Image2D::CreateUnsetImage(image->Width(), image->Height());
					mono = Image2D::CreateUnsetImage(image->Width(), image->Height());
				}
				size_t minY = image->Height(), minX = image->Width();
				if(red->Height() < minY) minY = red->Height();
				if(red->Width() < minX) minX = red->Width();
				for(unsigned y=0;y<minY;++y)
				{
					for(unsigned x=0;x<minX;++x)	
					{
						long double value = image->Value(x, y);
						mono->AddValue(x, y, value);
						if(redblue) {
							if(value > 0)
								red->AddValue(x, y, value/max);
							else
								blue->AddValue(x, y, value/(-max)); 
						}
						else {
							if(value < 0.0) value = 0.0;
							value /= max;
							if(colormap && (y < 96 && y >= 32 && x < images*8)) { 
								if(x >= i*8 && x < i*8+8) {
									red->SetValue(x, y, r * images);
									green->SetValue(x, y, g * images);
									blue->SetValue(x, y, b * images);
								}
							} else {
								red->AddValue(x, y, r * value);
								green->AddValue(x, y, g * value);
								blue->AddValue(x, y, b * value);
							}
						}
					}
				}
				++addedCount; 
				delete image;
			}
		}
		
		if(subtract) {
			subtractFits->Close();
			delete subtractFits;
		}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:67,代码来源:colormapper.cpp


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