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


C++ Image2D类代码示例

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


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

示例1: read

void AbstractFramebuffer::read(const Range2Di& rectangle, Image2D& image) {
    bindInternal(FramebufferTarget::Read);
    const std::size_t dataSize = image.dataSize(rectangle.size());
    char* const data = new char[dataSize];
    (Context::current()->state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), dataSize, data);
    image.setData(image.format(), image.type(), rectangle.size(), data);
}
开发者ID:RobertoMalatesta,项目名称:magnum,代码行数:7,代码来源:AbstractFramebuffer.cpp

示例2: throw

void PngFile::Save(const Image2D &image, const std::string &filename, const ColorMap &colorMap, long double normalizeFactor, long double zeroLevel) throw(IOException)
{
	PngFile pngFile(filename, image.Width(), image.Height());
	pngFile.BeginWrite();
	pngFile.SetFromImage(image, colorMap, normalizeFactor, zeroLevel);
	pngFile.Close();
}
开发者ID:jjdmol,项目名称:LOFAR,代码行数:7,代码来源:pngfile.cpp

示例3:

Image2D::Image2D(Image2D const& _cpy)
{

	SetText(_cpy.GetText());
	m_fg = _cpy.GetForegroundColor();
	m_bg = _cpy.GetBackgroundColor();
	m_width = _cpy.GetWidth();
	m_height = _cpy.GetHeight();
}
开发者ID:Guitaroz,项目名称:Arcade-Space-Shooter,代码行数:9,代码来源:Image2D.cpp

示例4: a

void ImageTest::release() {
    unsigned char data[] = {'c', 'a', 'f', 'e'};
    Image2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 4}, data);
    const unsigned char* const pointer = a.release();

    CORRADE_COMPARE(pointer, data);
    CORRADE_COMPARE(a.data(), nullptr);
    CORRADE_COMPARE(a.size(), Vector2i());
}
开发者ID:Driky,项目名称:magnum,代码行数:9,代码来源:ImageTest.cpp

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

示例6: AddBroadbandToTestSet

void TestSetGenerator::AddBroadbandToTestSet(Image2D& image, Mask2D& rfi, long double length, double strength, bool align, enum BroadbandShape shape)
{
	size_t frequencyCount = image.Height();
	unsigned step = image.Width()/11;
	if(align)
	{
		// see vertevd.h why this is:
		unsigned n = (unsigned) floor(0.5 + sqrt(0.25 + 2.0 * frequencyCount));
		unsigned affectedAntennas = (unsigned) n*(double)length;
		unsigned index = 0;
		Logger::Debug << affectedAntennas << " of " << n << " antennas effected." << '\n';
		Logger::Debug << "Affected  baselines: ";
		for(unsigned y=0;y<n;++y)
		{
			for(unsigned x=y+1;x<n;++x)
			{
				double a1, a2;
				if(x<affectedAntennas) a1=1.0; else a1=0.0;
				if(y<affectedAntennas) a2=1.0; else a2=0.0;
				
				if(y<affectedAntennas || x<affectedAntennas)
				{
					Logger::Debug << x << " x " << y << ", ";
					AddRfiPos(image, rfi, 3.0*strength*a1*a2, step*1, 3, index);
					AddRfiPos(image, rfi, 2.5*strength*a1*a2, step*2, 3, index);
					AddRfiPos(image, rfi, 2.0*strength*a1*a2, step*3, 3, index);
					AddRfiPos(image, rfi, 1.8*strength*a1*a2, step*4, 3, index);
					AddRfiPos(image, rfi, 1.6*strength*a1*a2, step*5, 3, index);

					AddRfiPos(image, rfi, 3.0*strength*a1*a2, step*6, 1, index);
					AddRfiPos(image, rfi, 2.5*strength*a1*a2, step*7, 1, index);
					AddRfiPos(image, rfi, 2.0*strength*a1*a2, step*8, 1, index);
					AddRfiPos(image, rfi, 1.8*strength*a1*a2, step*9, 1, index);
					AddRfiPos(image, rfi, 1.6*strength*a1*a2, step*10, 1, index);
				}
				++index;
			}
		}
		Logger::Debug << ".\n";
	} else {
		unsigned fStart = (unsigned) ((0.5 - length/2.0) * frequencyCount);
		unsigned fEnd = (unsigned) ((0.5 + length/2.0) * frequencyCount);
		AddBroadbandLinePos(image, rfi, 3.0*strength, step*1, 3, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 2.5*strength, step*2, 3, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 2.0*strength, step*3, 3, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 1.8*strength, step*4, 3, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 1.6*strength, step*5, 3, fStart, fEnd, shape);

		AddBroadbandLinePos(image, rfi, 3.0*strength, step*6, 1, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 2.5*strength, step*7, 1, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 2.0*strength, step*8, 1, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 1.8*strength, step*9, 1, fStart, fEnd, shape);
		AddBroadbandLinePos(image, rfi, 1.6*strength, step*10, 1, fStart, fEnd, shape);
	}
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:55,代码来源:testsetgenerator.cpp

示例7: screenshot

bool screenshot(PluginManager::Manager<Trade::AbstractImageConverter>& manager, GL::AbstractFramebuffer& framebuffer, const PixelFormat format, const std::string& filename) {
    Containers::Pointer<Trade::AbstractImageConverter> converter;
    if(!(converter = manager.loadAndInstantiate("AnyImageConverter")))
        return false;

    Image2D image = framebuffer.read(framebuffer.viewport(), {format});
    if(!converter->exportToFile(image, filename))
        return false;

    Debug{} << "DebugTools::screenshot(): saved a" << format << "image of size" << image.size() << "to" << filename;
    return true;
}
开发者ID:Squareys,项目名称:magnum,代码行数:12,代码来源:Screenshot.cpp

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

示例9: AddBroadbandLine

void TestSetGenerator::AddBroadbandLine(Image2D& data, Mask2D& rfi, double lineStrength, size_t startTime, size_t duration, double frequencyRatio, double frequencyOffsetRatio)
{
	size_t frequencyCount = data.Height();
	unsigned fStart = (size_t) (frequencyOffsetRatio * frequencyCount);
	unsigned fEnd = (size_t) ((frequencyOffsetRatio + frequencyRatio) * frequencyCount);
	AddBroadbandLinePos(data, rfi, lineStrength, startTime, duration, fStart, fEnd, UniformShape);
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:7,代码来源:testsetgenerator.cpp

示例10: Raw2D2Image2D

void * Raw2D2Image2D(Raw2D &src,long long type)
{
	PIXTYPE *data= new PIXTYPE[src.size()];
	if (type==1)
	{
		unsigned char* datSrc = new unsigned char [src.size()];//(unsigned char*)(src.data);
		//PIXTYPE *data= new PIXTYPE[src.GetLength()];
		for (long long i=0;i<src.size();i++)
		{
			datSrc[i]=(unsigned char)src.getXY(i);
		}
		//void * ret= (void *)datSrc;
		Image2D * ret = new Image2D(src.getXsize(),src.getYsize(),type);
		memcpy(ret->data,datSrc,ret->GetLength());
		
		unsigned char *dat =(unsigned char*)ret->data;
		void *res =(void *)ret;
		return res;
	}
	else if (type == 2)
	{

		unsigned short * datSrc = new unsigned short [src.size()];//(unsigned short *)(src.data);
		//PIXTYPE *data= new PIXTYPE[src.GetLength()];
		for (long long i=0;i<src.size();i++)
		{
			datSrc[i]=src.getXY(i);
		}
		void * ret=(void *)datSrc;
		return datSrc;
	}
	else
	{


		float* datSrc = new float [src.size()]; //(short*)(src.data);

		for (long long i=0;i<src.size();i++)
		{
			datSrc[i]=src.getXY(i);
		}
		void *ret =(void *)datSrc;
		return datSrc;

	}

}
开发者ID:buaaswf,项目名称:Filters2D,代码行数:47,代码来源:vol_math_RawImage.cpp

示例11: RecenterImage

void RecenterImage(Image2D &image)
{
	IppStatus status;
	Ipp32f minval = 0, maxval = 0;
	status = ippiMinMax_32f_C1R(image.get_image2D(), image.get_stepsize(), image.get_ROIfull(),
		&minval, &maxval);
	status = ippiAddC_32f_C1IR(-minval, image.get_image2D(), image.get_stepsize(), image.get_ROIfull());
	status = ippiMulC_32f_C1IR(100 / (maxval-minval), image.get_image2D(), image.get_stepsize(), image.get_ROIfull());
}
开发者ID:tacaswell,项目名称:PLuTARC_centerfind2D,代码行数:9,代码来源:data_proc1.cpp

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

示例13: data

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

示例14: fill_data

void fill_data( Image2D& _data )
{
    double*  data;
    CALuint  pitch;
    unsigned size;

    data = (double*)_queue.mapMemObject(_data,pitch);
    size = 2*_data.getWidth()*_data.getHeight();

    for(unsigned i=0;i<size;i+=2) {
        *(data + 0) = i+1;
        *(data + 1) = i+1;

        data+=2;
    }

    _queue.unmapMemObject(_data);
}
开发者ID:lsellens,项目名称:calpp,代码行数:18,代码来源:rsqrt.cpp

示例15: AddSlewedBroadbandToTestSet

void TestSetGenerator::AddSlewedBroadbandToTestSet(Image2D& image, Mask2D& rfi, long double length, double strength, double slewrate, enum BroadbandShape shape)
{
	size_t frequencyCount = image.Height();
	unsigned step = image.Width()/11;
	unsigned fStart = (unsigned) ((0.5 - length/2.0) * frequencyCount);
	unsigned fEnd = (unsigned) ((0.5 + length/2.0) * frequencyCount);
	AddSlewedBroadbandLinePos(image, rfi, 3.0*strength, slewrate, step*1, 3, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 2.5*strength, slewrate, step*2, 3, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 2.0*strength, slewrate, step*3, 3, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 1.8*strength, slewrate, step*4, 3, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 1.6*strength, slewrate, step*5, 3, fStart, fEnd, shape);

	AddSlewedBroadbandLinePos(image, rfi, 3.0*strength, slewrate, step*6, 1, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 2.5*strength, slewrate, step*7, 1, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 2.0*strength, slewrate, step*8, 1, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 1.8*strength, slewrate, step*9, 1, fStart, fEnd, shape);
	AddSlewedBroadbandLinePos(image, rfi, 1.6*strength, slewrate, step*10, 1, fStart, fEnd, shape);
}
开发者ID:kernsuite-debian,项目名称:aoflagger,代码行数:18,代码来源:testsetgenerator.cpp


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