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


C++ ImageLoader类代码示例

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


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

示例1: qMin

void ImageListModel::fetchMore(const QModelIndex &)
{
    int remainder = m_imageInfoList.count() - m_imageInfoCount;
    int itemsToFetch = qMin(100, remainder);

    int beginIndex = m_imageInfoCount;
    int endIndex = beginIndex + itemsToFetch;
    if (endIndex >= m_imageInfoList.count())
        endIndex = m_imageInfoList.count() - 1;

    beginInsertRows(QModelIndex(), beginIndex, endIndex);
    m_imageInfoCount += itemsToFetch;
    endInsertRows();

    // start multithreaded image loading
    for (int i = beginIndex; i <= endIndex; i++) {
        const ImageInfo imageInfo = m_imageInfoList.at(i);
        if (imageInfo.exists()) {
            ImageLoader *imageLoader = new ImageLoader(imageInfo.imagePath(), i);
            imageLoader->setScaleSize(MainWindow::MAX_THUMBNAIL_SIZE, MainWindow::MAX_THUMBNAIL_SIZE);
            connect(imageLoader, SIGNAL(imageLoaded(QImage, int, int, int)), SLOT(thumbnailLoaded(QImage, int, int, int)));
            m_imageLoaderPool.start(imageLoader);
        }
    }

    emit changed();
    qDebug("ImageListModel::fetchMore(): from %d to %d", beginIndex, endIndex);
}
开发者ID:vos,项目名称:qsm,代码行数:28,代码来源:imagelistmodel.cpp

示例2: Q_UNUSED

void WeatherItemFactory::updateItem(ListView* list, bb::cascades::VisualNode *listItem,
        const QString &type, const QVariantList &indexPath, const QVariant &data)
{
    Q_UNUSED(list);
    Q_UNUSED(indexPath);
    Q_UNUSED(type);

    // Update the control with the correct data.
    QVariantMap map = data.value<QVariantMap>();
    WeatherItem *weatherItem = static_cast<WeatherItem *>(listItem);

    ImageLoader *imloader = new ImageLoader();
    imloader->loadImage(map["weatherIconUrl"].toString(), weatherItem->getConditionsImage(), "/wsymbols01_png_64/", ".png");

    //set labels
    weatherItem->setTime(map["time"].toString());

    weatherItem->setWindSpeed(map["windspeedKmph"].toString());

    weatherItem->setTemperature(map["tempC"]);

    weatherItem->setCloudCover(map["cloudcover"].toString());

    weatherItem->setPressure(map["pressure"].toString());

    weatherItem->setHumidity(map["humidity"].toString());

    weatherItem->setSwellHeight(map["swellHeight_m"].toString());

    //rotate arrows
    weatherItem->setWindDirection(180 + map["winddirDegree"].toFloat());

    weatherItem->setSwellDirection(180 + map["swellDir"].toFloat());
}
开发者ID:mytcg,项目名称:GameCardsBB10,代码行数:34,代码来源:WeatherItemFactory.cpp

示例3: GenUVSphere

void MainScreen::onInit(ScreenContext& sc)
{
    // Store engine ref
    mEngine = sc.GetEngine();

    // Store file data cache ref
    mFileDataCache = sc.GetFileDataCache();

    // Cube rotation state
    mRotationData.degreesInc = 0.05f;
    mRotationData.rotating = false;

    // Camera initial position
    mCamera.SetPos(glm::vec3(0, 0, 8));

    // Add sample UV Sphere
    ModelData sphereModel = GenUVSphere(1, 32, 32);
    mEngine->GetModelStore().Load("4", std::move(sphereModel));

    // Create world objects
    SetupWorld();

    // Create world lights
    SetupLights();

    // Cam shouldn't follow character initially
    mFollowingCharacter = false;

    // Initial choosen moving light
    mMovingLightIndex = 0;

    // Init character
    mCharacter.Init(&mEngine->GetWindow(), mScene.get());

    // Load the skybox
    ImageLoader imLoader;
    auto& cubemapStore = mEngine->GetCubemapStore();
    cubemapStore.Load(skybox, imLoader.Load(*(*mFileDataCache)["ext/Assets/Textures/Skybox/Bluesky/bluesky.tga"], "tga"));
    mEngine->GetSkyboxRenderer().SetCubemapId(cubemapStore[skybox]->id);

    // Load the irr map
    mEngine->GetCubemapStore().Load(irrmap, imLoader.Load(*(*mFileDataCache)["ext/Assets/Textures/Skybox/Bluesky/bluesky_irr.tga"], "tga"));

    // Load the rad map
    for (unsigned int i = 0; i < 9; ++i) {
        mEngine->GetCubemapStore().Load(
            radmap,
            imLoader.Load(*(*mFileDataCache)[
                              "ext/Assets/Textures/Skybox/Bluesky/bluesky_rad_" + std::to_string(i) + ".tga"], "tga"), i);
    }

    // Do not show AABBs by default
    mShowAABBs = false;

    // Do not show Debug info by default
    mShowDbgInfo = false;

    // Init renderform creator
    mRenderformCreator = std::make_unique<RenderformCreator>(&(mEngine->GetModelStore()), &(mEngine->GetMaterialStore()));
}
开发者ID:ScaryBoxStudios,项目名称:TheRoom,代码行数:60,代码来源:MainScreen.cpp

示例4: libImage

unsigned int ImageLoader::recursiveUpdateDepth(unsigned int maxDepth)
{
	// the purpose of this phase is to make the images sortable such that 
	// in a sort list of images, every image that an image depends on
	// occurs in the list before it.
	if ( fDepth == 0 ) {
		// break cycles
		fDepth = maxDepth;
		
		// get depth of dependents
		unsigned int minDependentDepth = maxDepth;
		for(unsigned int i=0; i < libraryCount(); ++i) {
			ImageLoader* dependentImage = libImage(i);
			if ( (dependentImage != NULL) && !libIsUpward(i) ) {
				unsigned int d = dependentImage->recursiveUpdateDepth(maxDepth);
				if ( d < minDependentDepth )
					minDependentDepth = d;
			}
		}
	
		// make me less deep then all my dependents
		fDepth = minDependentDepth - 1;
	}
	
	return fDepth;
}
开发者ID:turingH,项目名称:dyld_soucecode_analysis,代码行数:26,代码来源:ImageLoader.cpp

示例5: memcpy

unsigned int __stdcall Texture::Atlas::ThreadLoadTexture( void* data ) {
  Thread::Work *work = ( Thread::Work* ) data;
  ThreadDataLoadTexture *loader = ( ThreadDataLoadTexture* ) work->data;
  //__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => begin: data[%d] size[%d; %d]", loader->data->getLength(), loader->size.width, loader->size.height );
  //

  ImageLoader image;
  if( !image.LoadFromBuffer( ( Byte* ) loader->data->getData(), loader->data->getLength() ) ) {
    __log.PrintInfo( Filelevel_ERROR, "Texture::Atlas::ThreadLoadTexture => image.LoadFromBuffer failed" );
    work->status = Thread::THREAD_WORK_STATUS_ERROR;
    return 1;
  }
  Dword
    *dst = ( Dword* ) loader->atlas->textureData.getData(),
    *src = ( Dword* ) image.GetImageData();
  for( Dword y = 0; y < image.GetImageSize().height; ++y ) {
    memcpy( dst + ( loader->item->rect.top + y ) * loader->atlas->size.width + loader->item->rect.left, src + y * image.GetImageSize().width, image.GetImageSize().width * 4 );
  }
  loader->atlas->FlushToGPU();

  //done
  delete loader->data;
  delete loader;
  work->status = Thread::THREAD_WORK_STATUS_DONE;
  //__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => done" );
  return 0;
}//ThreadLoadTexture
开发者ID:KoMaTo3,项目名称:flatuniverse,代码行数:27,代码来源:textureatlas.cpp

示例6: ImageLoader

void PipelineManager::setup(QStringList fx, QDir &input, QDir &output)
{
    // Chargement des images comme première étape du pipeline
    ImageLoader *loader = new ImageLoader(this);
    loader->setName("loader");
    loader->setImageDir(input);
    stageList.append(loader);

    // Préparation des effets
    foreach (QString fxName, fx) {
        if (!effects.hasEffect(fxName)) {
            qDebug() << "unkown effect " << fxName;
            continue;
        }
        EffectStage *fxStage = new EffectStage(this);
        fxStage->setName(fxName);
        fxStage->setEffect(effects.effect(fxName));
        stageList.append(fxStage);
    }

    // Sauvegarde des images comme dernière étape du pipeline
    ImageSaver *saver = new ImageSaver(this);
    saver->setName("saver");
    saver->setOutput(output);
    stageList.append(saver);
}
开发者ID:Feinte75,项目名称:TP4_INF2610,代码行数:26,代码来源:pipelinemanager.cpp

示例7: test_video

void test_video() {

	VideoCapture cap(CV_CAP_ANY);
	ImageProcessor processor;
	ImageLoader loader;
	NeuralNetwork net;
	net.load(NET_FILE_NAME);

	//net.visualize_hidden_units(1, 50);

	if (!cap.isOpened()) {
		cout << "Failed to initialize camera\n";
		return;
	}

	namedWindow("CameraCapture");
	namedWindow("ProcessedCapture");

	cv::Mat frame;
	while (true) {

		cap >> frame;

		cv::Mat processedFrame = processor.process_image(frame);

		if(processedFrame.rows * processedFrame.cols == INPUT_LAYER_SIZE) {

			mat input = loader.to_arma_mat(processedFrame);

			int label = net.predict(input);

			if(label == 0)
				putText(frame, "A", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
			else if(label == 1)
				putText(frame, "E", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
			else if(label == 2)
				putText(frame, "I", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
			else if(label == 3)
				putText(frame, "O", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
			else if(label == 4)
				putText(frame, "U", Point(500, 300), FONT_HERSHEY_SCRIPT_SIMPLEX, 2, Scalar::all(0), 3, 8);
		}

		imshow("CameraCapture", frame);
		imshow("ProcessedCapture", processedFrame);

		int key = waitKey(5);

		if(key == 13) {
			imwrite("captura.jpg", frame);
		}
		if (key == 27)
			break;
	}

	destroyAllWindows();
}
开发者ID:EPineiro,项目名称:NeuralNetworks,代码行数:57,代码来源:Main.cpp

示例8: main

int main()
{
	ImageLoader loader;
	auto f = loader.LoadImage("../Resource/Fig0310(a)(Moon Phobos).jpg");
	auto low_high(HW::strechlim(f));
	//auto hist(HW::imhist(f,255));
	auto g = HW::imadjust(f, low_high, 0,1);

	ImageWriter writer;
	writer.WritePNGImage(g, "imadjustTest.png");
	return 0;
}
开发者ID:jiemojiemo,项目名称:HWImageProcess,代码行数:12,代码来源:imadjustTest.cpp

示例9: SetCursor

/*
=============
  SetCursor
=============
*/
void Mouse::SetCursor( const std::string &imageFileName )
{
  this->cursor.isHardware = true;

  ImageLoader image;
  image.LoadFromFile( imageFileName );

  this->cursor.size.Set( float( image.GetImageSize()->width ) , float( image.GetImageSize()->height ) );
  this->cursor.spriteOffset.Set( this->cursor.size.x * 0.5f * this->cursor.pixelsToTexels.x, this->cursor.size.y * 0.5f * this->cursor.pixelsToTexels.y, 0.0f );

  ShowCursor( false );
}//SetCursor
开发者ID:KoMaTo3,项目名称:LightTest,代码行数:17,代码来源:mouse.cpp

示例10: skinPath

 Assets::Texture* Md2Parser::loadTexture(const Md2Skin& skin) {
     const Path skinPath(String(skin.name));
     MappedFile::Ptr file = m_fs.openFile(skinPath);
     
     Color avgColor;
     const ImageLoader image(ImageLoader::PCX, file->begin(), file->end());
     
     const Buffer<unsigned char>& indices = image.indices();
     Buffer<unsigned char> rgbImage(indices.size() * 3);
     m_palette.indexedToRgb(indices, indices.size(), rgbImage, avgColor);
     
     return new Assets::Texture(skin.name, image.width(), image.height(), avgColor, rgbImage);
 }
开发者ID:Gustavo6046,项目名称:TrenchBroom,代码行数:13,代码来源:Md2Parser.cpp

示例11: mess

 void
 Image::load( const std::string &filename )
 {
   using namespace std;
   size_t pos = filename.find_last_of('.');
   if ( pos == string::npos ) {
     std::string mess("Image::load: Can't load image ");
     mess.append(filename);
     throw new Exception(mess);
   }
   const string ext = filename.substr(pos+1);
   ImageLoader *imgLoader = ImageLoader::getImageLoader(ext);
   imgData = imgLoader->load(filename);
 }
开发者ID:BackupTheBerlios,项目名称:sfox-svn,代码行数:14,代码来源:image.cpp

示例12: WXUNUSED

void ClientStateIndicator::RunConnectionAnimation(wxTimerEvent& WXUNUSED(event)){
	
	if(indexIndVis < numOfIndic){
		indexIndVis++;
		for(int j = 0; j < indexIndVis; j++){
			ImageLoader *currInd = m_connIndV[j];
			currInd->Show(true);
		}
	}else{
		indexIndVis = 0;
		for(int i = 0; i < numOfIndic; i++){
			ImageLoader *currInd = m_connIndV[i];
			currInd->Show(false);
		}
	}
}
开发者ID:BME-IK,项目名称:gridbee-nacl-framework,代码行数:16,代码来源:sg_ClientStateIndicator.cpp

示例13: atoi

	EntityArchetype::EntityArchetype(xmlpp::Document* doc, ImageLoader& loader, Database* db) {
		const xmlpp::Element* root = dynamic_cast<const xmlpp::Element*>(doc->get_root_node());
			
		name = dynamic_cast<const xmlpp::Element*>(root->find("name")[0])->get_child_text()->get_content();
		width = atoi(dynamic_cast<const xmlpp::Element*>(root->find("width")[0])->get_child_text()->get_content().c_str());
		height = atoi(dynamic_cast<const xmlpp::Element*>(root->find("height")[0])->get_child_text()->get_content().c_str());
		frames = atoi(dynamic_cast<const xmlpp::Element*>(root->find("frames")[0])->get_child_text()->get_content().c_str());
		std::string imgName = dynamic_cast<const xmlpp::Element*>(root->find("image")[0])->get_child_text()->get_content();
		
		if (!root->find("scripts").empty()) {
			const xmlpp::Element* scripts = dynamic_cast<const xmlpp::Element*>(root->find("scripts")[0]);
			if (!scripts->find("idle").empty())
				idleScript = dynamic_cast<const xmlpp::Element*>(scripts->find("idle")[0])->get_child_text()->get_content();
			if (!scripts->find("timer").empty())
				timerScript = dynamic_cast<const xmlpp::Element*>(scripts->find("timer")[0])->get_child_text()->get_content();
			if (!scripts->find("init").empty())
				initScript = dynamic_cast<const xmlpp::Element*>(scripts->find("init")[0])->get_child_text()->get_content();
		}
		
		std::vector<xmlpp::Node*> modeNodes = root->find("modes");
		for (unsigned int i = 0; i < modeNodes.size(); ++i) {
			modes.push_back(dynamic_cast<const xmlpp::Element*>(modeNodes[i])->get_child_text()->get_content());
		}
		
		image = loader.loadFromFile("gfx/entities/" + imgName);
	}
开发者ID:cpetosky,项目名称:o2d-lib,代码行数:26,代码来源:EntityArchetype.cpp

示例14:

Sampler2D::Sampler2D(const std::string &filename, u32 s){
	settings = s;

	ImageLoader loader;
	ImageData image = loader.loadTrueRaw(filename);
	width = image.width;
	height = image.height;
	info("SAMPLER", "from:", filename, width, ":", height);
	switch(image.originalFormat){
		case gl::RED :
			data = make_unique<SamplerSingleChannelU8>(image.data, image.width, image.height);
			break;
		case gl::BGR : break;
		case gl::BGRA : break;
	};

}
开发者ID:DezerteR,项目名称:Po-Male-Ka,代码行数:17,代码来源:Sampler2D.cpp

示例15: setFormat

FrameDisplayGL ::FrameDisplayGL(QWidget *parent)
{
    QGLFormat frmt;
    setFormat(frmt);

    currWidth =visibleRegion().boundingRect().width();
    currHeight=visibleRegion().boundingRect().height();
    QString msg = QString("Loading image into QImage");
    Profiler timer(msg);
    timer.start();
    ImageLoader i;
    QString x("/home/xmk/programming/capella/test/images/m51.jpg");
    image = i.imageLoader( &x, 0 );

    //i.loadImage("/home/xmk/programming/skeleton/test/images/m42.jpg", 1 );
    timer.finish();
}
开发者ID:dnxumuk,项目名称:capella,代码行数:17,代码来源:framedisplaygl.cpp


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