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


C++ ImageBase类代码示例

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


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

示例1:

void	ImageBaseTest::testPixeloffset() {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testPixelOffset() begin");
	CPPUNIT_ASSERT(i1->pixeloffset(4, 11) == (4 + 11 * 640));
	CPPUNIT_ASSERT(i1->pixeloffset(ImagePoint(4, 11)) == (4 + 11 * 640));
	CPPUNIT_ASSERT(i4->pixeloffset(4, 11) == (4 + 1024 * (11)));
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testPixelOffset() end");
}
开发者ID:AndreasFMueller,项目名称:AstroPhotography,代码行数:7,代码来源:ImageBaseTest.cpp

示例2: PrepareFor

void Integral::PrepareFor(ImageBase& Source)
{
   ImageProgram::PrepareFor(Source);

   // Also build float program as we will need it
   GetProgram(Float).Build();

   SSize VerticalImgSize = {GetNbGroupsW(Source) - 1, Source.Height()};
   SSize HorizontalImgSize = {Source.Width(), GetNbGroupsH(Source) - 1};

   if (VerticalImgSize.Width == 0)
      VerticalImgSize.Width = 1;

   if (HorizontalImgSize.Height == 0)
      HorizontalImgSize.Height = 1;

   // Check validity of current temp buffers
   if (m_VerticalJunctions != nullptr && 
      uint(VerticalImgSize.Width) <= m_VerticalJunctions->Width() &&
      uint(VerticalImgSize.Height) <= m_VerticalJunctions->Height() &&
      uint(HorizontalImgSize.Width) <= m_HorizontalJunctions->Width() &&
      uint(HorizontalImgSize.Height) <= m_HorizontalJunctions->Height() &&
      Source.IsFloat() == m_VerticalJunctions->IsFloat())
   {
      // Buffers are good
      return;
   }

   // Create buffers for temporary results
   m_VerticalJunctions = std::make_shared<TempImage>(*m_CL, VerticalImgSize, SImage::F32);
   m_HorizontalJunctions = std::make_shared<TempImage>(*m_CL, HorizontalImgSize, SImage::F32);
}
开发者ID:lochotzke,项目名称:OpenCLIPP,代码行数:32,代码来源:Integral.cpp

示例3: CreateCachedImage

HICON SmileyType::GetIconDup(void)
{
	ImageBase* img = CreateCachedImage();
	img->SelectFrame(m_index);
	HICON hIcon = img->GetIcon();
	img->Release();
	return hIcon;
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:8,代码来源:smileys.cpp

示例4: ImageSize

void	ImageBaseTest::testAccessors() {
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testAccessors() begin");
	CPPUNIT_ASSERT(i1->size() == ImageSize(640,480));
	CPPUNIT_ASSERT(i2->size() == ImageSize(640,480));
	CPPUNIT_ASSERT(i3->size() == ImageSize(1024,768));
	CPPUNIT_ASSERT(i4->size() == ImageSize(1024,768));
	debug(LOG_DEBUG, DEBUG_LOG, 0, "testAccessors() end");
}
开发者ID:AndreasFMueller,项目名称:AstroPhotography,代码行数:8,代码来源:ImageBaseTest.cpp

示例5: CheckSizeAndType

void CheckSizeAndType(const ImageBase& Img1, const ImageBase& Img2)
{
   CheckCompatibility(Img1, Img2);

   if (Img1.Depth() != Img2.Depth())
      throw cl::Error(CL_INVALID_VALUE, "Different image depth used");

   if (Img1.IsUnsigned() != Img2.IsUnsigned())
      throw cl::Error(CL_INVALID_VALUE, "Different image types used");
}
开发者ID:AntAgna,项目名称:OpenCLIPP,代码行数:10,代码来源:Program.cpp

示例6: CheckCompatibility

void CheckCompatibility(const ImageBase& Img1, const ImageBase& Img2)
{
   CheckSameSize(Img1, Img2);

   if (Img1.IsFloat() != Img2.IsFloat())
      throw cl::Error(CL_INVALID_VALUE, "Different image types used");

   if (Img1.IsUnsigned() != Img2.IsUnsigned())
     throw cl::Error(CL_INVALID_VALUE, "Different image types used");
}
开发者ID:AntAgna,项目名称:OpenCLIPP,代码行数:10,代码来源:Program.cpp

示例7: drawImage

void DisplayImpl::drawImage(Point p, const ImageBase& img)
{
    short int xEnd=p.x()+img.getWidth()-1;
    short int yEnd=p.y()+img.getHeight()-1;

    //Qt backend is meant to catch errors, so be bastard
    if(xEnd >= width || yEnd >= height)
        throw(logic_error("Image out of bounds"));

    img.draw(*this,p);
    beginPixelCalled=false;
}
开发者ID:BitsDevelopmentTeam,项目名称:bits-fonera,代码行数:12,代码来源:display_qt.cpp

示例8: diff

int ImageBase::diff(ImageBase seuille, ImageBase dilate){
	unsigned char* dataS = seuille.getData();
	unsigned char* dataD = dilate.getData();
	unsigned char* data = this->getData();

	for(int i = 0; i < this->getTotalSize(); i++){
		if(dataS[i] == dataD[i]){
			data[i] = 255;
		}else{
			data[i] = 0;
		}
	}
	return 0;
}
开发者ID:ulia22,项目名称:Analyse_images,代码行数:14,代码来源:ImageBase.cpp

示例9: SameType

bool SameType(const ImageBase& Img1, const ImageBase& Img2)
{
   return (Img1.IsFloat() == Img2.IsFloat() &&
      Img1.IsUnsigned() == Img2.IsUnsigned() &&
      Img1.Depth() == Img2.Depth() &&
      Img1.NbChannels() == Img2.NbChannels());
}
开发者ID:AntAgna,项目名称:OpenCLIPP,代码行数:7,代码来源:Program.cpp

示例10: PrepareFor

void ImageProximityFFT::PrepareFor(ImageBase& Source, Image& Template)
{
   SSize size;

   size.Width = Source.Width();
   size.Height = Source.Height();

   if (m_image_sqsums == nullptr || m_image_sqsums->Width() < size.Width || m_image_sqsums->Height() < size.Height)
      m_image_sqsums = std::make_shared<TempImage>(*m_CL, size, SImage::F32, Source.NbChannels());


   // Size of the FFT input and output
   size.Width = Source.Width() + Template.Width() / 2;
   size.Height = Source.Height() + Template.Height() / 2;

   // Search for a size supported by clFFT
   while (!m_fft.IsSupportedLength(size.Width))
      size.Width++;

   while (!m_fft.IsSupportedLength(size.Height))
      size.Height++;

   if (m_bigger_source == nullptr || m_bigger_source->Width() != size.Width || m_bigger_source->Height() != size.Height)
      m_bigger_source = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 1);

   if (m_bigger_template == nullptr || m_bigger_template->Width() < size.Width || m_bigger_template->Height() < size.Height)
      m_bigger_template = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 1);



   // Size of the spectral images
   size.Width = size.Width / 2 + 1;

   if (m_templ_spect == nullptr || m_templ_spect->Width() < size.Width || m_templ_spect->Height() < size.Height)
      m_templ_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);

   if (m_source_spect == nullptr || m_source_spect->Width() != size.Width || m_source_spect->Height() != size.Height)
      m_source_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);

   if (m_result_spect == nullptr || m_result_spect->Width() < size.Width || m_result_spect->Height() < size.Height)
      m_result_spect = std::make_shared<TempImage>(*m_CL, size, SImage::F32, 2);

   m_integral.PrepareFor(Source);
   m_statistics.PrepareFor(Template);
   m_transform.PrepareFor(Source);
   m_fft.PrepareFor(*m_bigger_source, *m_source_spect);
   SelectProgram(Source).Build();
   SelectProgram(*m_source_spect).Build();
}
开发者ID:AntAgna,项目名称:OpenCLIPP,代码行数:49,代码来源:ImageProximityFFT.cpp

示例11: SelectName

static std::string SelectName(const char * Name, const ImageBase& Img)
{
   if (Img.NbChannels() != 1)
      throw cl::Error(CL_IMAGE_FORMAT_NOT_SUPPORTED, "Filters on images with >1 channels not yet supported");

   return std::string(Name) + "_1C";
}
开发者ID:lochotzke,项目名称:OpenCLIPP,代码行数:7,代码来源:FiltersVector.cpp

示例12: desegaliser

/**
Déségalise une image en utilisant la fonction de répartition inverse d'une autre image.
**/
int ImageBase::desegaliser(ImageBase img){
	unsigned char* data = this->getData();
	double F[256];
	img.getFa(F);
	int indice = 0;
	double tmp = 0., space = 1000., current = 0.;
	
	cout << "test1" << endl;
	for(int i = 0; i < this->getTotalSize(); i++){
		current = (double)data[i]/(double)255.;
		for(int j = 0; j < 256; j++){
			tmp = current - F[j];
			if(tmp < 0.)
				tmp *= -1.;
				
			if(tmp < space){
				space = tmp;
				indice = j;
			}
		}
		data[i] = (unsigned char)(F[indice]*255.);
		space = 1000.;
		tmp = 0.;
		indice = 0;
	}
	cout << "test2" << endl;
	return 0;
}
开发者ID:ulia22,项目名称:Analyse_images,代码行数:31,代码来源:ImageBase.cpp

示例13: main

int main(int argc, char **argv)
{
	///////////////////////////////////////// Exemple d'un seuillage d'image
	char cNomImgLue[250];
	char info;
	int indice;
  
	if(argc != 4) 
	{
		printf("Usage: ImageIn.pgm C(ou L) Indice \n"); 
		return 1;
	}
	sscanf (argv[1],"%s",cNomImgLue);
	sscanf (argv[2],"%c",&info);
	sscanf (argv[3],"%d",&indice);

	
	//ImageBase imIn, imOut;
	ImageBase imIn;
	imIn.load(cNomImgLue);

	//ImageBase imG(imIn.getWidth(), imIn.getHeight(), imIn.getColor());

	if(info == 'C')
	{
		for(int x = 0; x < imIn.getHeight(); ++x)
		{
			printf("%d %d\n", x, imIn[x][indice]);
		}
	}
	else if(info == 'L')
	{
		for(int y = 0; y < imIn.getWidth(); ++y)
		{
			printf("%d %d\n", y, imIn[indice][y]);
		}
	}
	else
	{
		printf("Usage: ImageIn.pgm C(ou L) Indice \n"); 
		return 1;
	}

	return 0;
}
开发者ID:Arihy,项目名称:TPM,代码行数:45,代码来源:profil.cpp

示例14: GetRange

cl::NDRange VectorProgram::GetRange(EProgramVersions Version, const ImageBase& Img1)
{
   switch (Version)
   {
   case Fast:
      // The fast version uses a 1D range
      return cl::NDRange(Img1.Width() * Img1.Height() * Img1.NbChannels() / GetVectorWidth(Img1.DataType()), 1, 1);

   case Standard:
   case Unaligned:
      // The other versions use a 2D range
      return Img1.VectorRange(GetVectorWidth(Img1.DataType()));

   case NbVersions:
   default:
      throw cl::Error(CL_INVALID_PROGRAM, "Invalid program version in VectorProgram");
   }

}
开发者ID:AntAgna,项目名称:OpenCLIPP,代码行数:19,代码来源:Program.cpp

示例15: AddCacheImage

ImageBase* AddCacheImage(const CMString& file, int index)
{
	CMString tmpfile(file); tmpfile.AppendFormat(_T("#%d"), index);
	unsigned id = mir_hash(tmpfile.c_str(), tmpfile.GetLength() * sizeof(TCHAR));

	WaitForSingleObject(g_hMutexIm, 3000);

	ImageBase srch(id);
	ImageBase *img = g_imagecache.find(&srch);
	if (img == NULL) {
		int ind = file.ReverseFind('.');
		if (ind == -1)
			return NULL;

		CMString ext = file.Mid(ind+1);
		ext.MakeLower();
		if (ext == _T("dll") || ext == _T("exe"))
			img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoDll) : (ImageBase*)new IconType(id, file, index, icoDll);
		else if (ext == _T("ico"))
			img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, 0, icoFile) : (ImageBase*)new IconType(id, file, 0, icoFile);
		else if (ext == _T("icl"))
			img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, index, icoIcl) : (ImageBase*)new IconType(id, file, index, icoIcl);
		else if (ext == _T("gif"))
			img = new ImageType(id, file, NULL);
		else if (fei == NULL || ext == _T("tif") || ext == _T("tiff"))
			img = new ImageType(id, file, NULL);
		else
			img = opt.HQScaling ? (ImageBase*)new ImageType(id, file, NULL) : (ImageBase*)new ImageFType(id, file);

		g_imagecache.insert(img);

		if (timerId == 0) {
			timerId = 0xffffffff;
			CallFunctionAsync(sttMainThreadCallback, NULL);
		}
	}
	else img->AddRef();

	ReleaseMutex(g_hMutexIm);

	return img;
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:42,代码来源:imagecache.cpp


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