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


C++ ImageSet类代码示例

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


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

示例1: loadImageSet

void SpriteDef::loadImageSet(XmlNodePtr node, const std::string &palettes)
{
    const std::string name = XML::getProperty(node, "name", "");

    // We don't allow redefining image sets. This way, an included sprite
    // definition will use the already loaded image set with the same name.
    if (mImageSets.find(name) != mImageSets.end())
        return;

    const int width = XML::getProperty(node, "width", 0);
    const int height = XML::getProperty(node, "height", 0);
    std::string imageSrc = XML::getProperty(node, "src", "");
    Dye::instantiate(imageSrc, palettes);

    ResourceManager *resman = ResourceManager::getInstance();
    ImageSet *imageSet = resman->getImageSet(imageSrc, width, height);

    if (!imageSet)
    {
        logger->log1("Couldn't load imageset!");
        return;
    }

    imageSet->setOffsetX(XML::getProperty(node, "offsetX", 0));
    imageSet->setOffsetY(XML::getProperty(node, "offsetY", 0));
    mImageSets[name] = imageSet;
}
开发者ID:Evonline,项目名称:ManaPlus,代码行数:27,代码来源:spritedef.cpp

示例2: Java_com_nvidia_fcamerapro_FCamInterface_enqueueMessageForFlashFusion

    /* [CS478] Assignment #2
     * Add a new function performs flash/no-flash fusion using ImageStack. The form of
     * this function will be quite different from the other JNI calls above. The assignment
     * webpage has many hints to help you figure out how to implement this section.
     */
    JNIEXPORT void JNICALL Java_com_nvidia_fcamerapro_FCamInterface_enqueueMessageForFlashFusion(JNIEnv *env, jobject thiz, jstring flashOnPath, jstring flashOffPath) {
        /* [CS478]
         * Enqueue a new message that represents a request for global autofocus.
         */
        int value;
        LOG("MYFOCUS flash fusion request\n");
        //sAppData->requestQueue.produce(ParamSetRequest(PARAM_AUTO_FOCUS_FACE, &value, 0));
        const char *str1 = (const char *) env->GetStringUTFChars(flashOnPath, 0);
        const char *str2 = (const char *) env->GetStringUTFChars(flashOffPath, 0);
        LOG("MYFOCUS got path: %s\n", str1);
        LOG("MYFOCUS got path: %s\n", str2);
        ImageStack::Image imgFlashOn = ImageStack::FileJPG::load(str1);
        ImageStack::Image imgFlashOff = ImageStack::FileJPG::load(str2);

        ImageStack::JointBilateral::apply(imgFlashOff, imgFlashOn, 4.0f, 4.0f, 0.0f, 0.4f);

        ImageSet *is = writer->newImageSet(); // writer is a global instance of AsyncImageWriter already defined
        FCam::_Frame* f = new FCam::Tegra::_Frame;
        f->image = FCam::Image(imgFlashOff.width, imgFlashOff.height, FCam::RGB24);
        for (int y = 0; y < imgFlashOff.height; y++) {
            for (int x = 0; x < imgFlashOff.width; x++) {
                for (int c = 0; c < 3; c++) {
                    ((unsigned char*)f->image(x, y))[c] = (unsigned char)(255 * imgFlashOff(x, y)[c] + 0.5f);
                }
            }
        }

        is->add(FileFormatDescriptor::EFormatJPEG, FCam::Frame(f));
        writer->push(is);

    }
开发者ID:bayanbatn,项目名称:cs478assignment2,代码行数:36,代码来源:FCamInterface.cpp

示例3: assert

void LocalPlayer::loadTargetCursor(const std::string &filename,
                                   const int width, const int height,
                                   const bool outRange,
                                   const TargetCursorSize &size)
{
    assert(size > -1);
    assert(size < 3);

    ResourceManager *resman = ResourceManager::getInstance();

    ImageSet *currentImageSet = resman->getImageSet(filename, width, height);
    Animation *anim = new Animation();

    for (unsigned int i = 0; i < currentImageSet->size(); ++i)
    {
        anim->addFrame(currentImageSet->get(i), 75,
                      (16 - (currentImageSet->getWidth() / 2)),
                      (16 - (currentImageSet->getHeight() / 2)));
    }

    SimpleAnimation *currentCursor = new SimpleAnimation(anim);

    const int index = outRange ? 1 : 0;

    mTargetCursorImages[index][size] = currentImageSet;
    mTargetCursor[index][size] = currentCursor;
}
开发者ID:stevecotton,项目名称:Aethyra,代码行数:27,代码来源:localplayer.cpp

示例4: ROUND

cv::Mat FAST::CFastImage::FastAddImages( const ImageSet& _imgs ) {
	if (_imgs.empty())
		DEBUG_ERROR("NO IMAGES");
	int nImgs = (int)_imgs.size(); 
	int middle1 = ROUND(nImgs/2); 
	Mat outImg, outImg2; 
	
	#pragma omp parallel sections 
	{
		#pragma omp section 
		{
			outImg = Mat::zeros(_imgs[0].size(), _imgs[0].type());
			FOR (i, middle1)
				cv::add(outImg, _imgs[i], outImg); 
		}
		#pragma omp section 
		{
			outImg2 = Mat::zeros(_imgs[0].size(), _imgs[0].type());
			for (int i = middle1; i < nImgs; i++)
				cv::add(outImg2, _imgs[i], outImg2); 
		}
	}

	add(outImg, outImg2, outImg); 
	return outImg; 
}
开发者ID:cleoag,项目名称:light-field-video,代码行数:26,代码来源:FastImage.cpp

示例5: ImageSet

void ClarkModel::MakeSets(const ImageSet& residualSet)
{
	_residual.reset(new ImageSet(
			&residualSet.Table(), residualSet.Allocator(),
			residualSet.ChannelsInDeconvolution(), residualSet.SquareJoinedChannels(),
			residualSet.LinkedPolarizations(),
			size(), 1));
	_model.reset(new ImageSet(
		&residualSet.Table(), residualSet.Allocator(),
		residualSet.ChannelsInDeconvolution(), residualSet.SquareJoinedChannels(),
		residualSet.LinkedPolarizations(),
		size(), 1));
	for(size_t imgIndex=0; imgIndex!=_model->size(); ++imgIndex)
	{
		std::fill((*_model)[imgIndex], (*_model)[imgIndex]+size(), 0.0);
		
		const double* sourceResidual = residualSet[imgIndex];
		double* destResidual = (*_residual)[imgIndex];
		for(size_t pxIndex=0; pxIndex!=size(); ++pxIndex)
		{
			size_t srcIndex = _positions[pxIndex].second*_width + _positions[pxIndex].first;
			destResidual[pxIndex] = sourceResidual[srcIndex];
		}
	}
}
开发者ID:kernsuite-debian,项目名称:wsclean,代码行数:25,代码来源:clarkloop.cpp

示例6: inputPyramid

// ######################################################################
void DirectFeedChannel::inputPyramid(const ImageSet<float>& pyramid,
                                     const SimTime& t)
{
  if (itsCoeff.empty()) initializeCoeffs(pyramid.size());
  else ASSERT(itsCoeff.size() == pyramid.size());

  itsPyr = pyramid;
  itsPyrTime = t;
  LDEBUG("itsPyrTime: %fms", itsPyrTime.msecs());
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:11,代码来源:DirectFeedChannel.C

示例7: readEmoteNode

void EmoteDB::readEmoteNode(xmlNodePtr node, const std::string &filename)
{
    int id = XML::getProperty(node, "id", -1);
    if (id == -1)
    {
        logger->log("Emote Database: Emote with missing ID in %s!", filename.c_str());
        return;
    }

    Emote *currentEmote = new Emote;

    currentEmote->name = XML::getProperty(node, "name", "unknown");
    currentEmote->effect = XML::getProperty(node, "effectid", -1);

    if (currentEmote->effect == -1)
    {
        logger->log("Emote Database: Warning: Emote %s has no attached effect in %s!",
                    currentEmote->name.c_str(), filename.c_str());
        delete currentEmote;
        return;
    }

    const std::string imageName = XML::getProperty(node, "image", "");
    const int width = XML::getProperty(node, "width", 0);
    const int height = XML::getProperty(node, "height", 0);

    if (imageName.empty() || width <= 0 || height <= 0)
    {
        logger->log("Emote Database: Warning: Emote %s has bad imageset values in %s",
                    currentEmote->name.c_str(), filename.c_str());
        delete currentEmote;
        return;
    }

    ImageSet *is = ResourceManager::getInstance()->getImageSet(imageName,
                                                               width,
                                                               height);
    if (!is || !(is->size() > 0))
    {
        logger->log("Emote Database: Error loading imageset for emote %s in %s",
                    currentEmote->name.c_str(), filename.c_str());
        delete is;
        delete currentEmote;
        return;
    }
    else
    {
        // For now we just use the first image in the animation
        currentEmote->sprite = new ImageSprite(is->get(0));
    }

    mEmotes[id] = currentEmote;
    if (id > mLastEmote)
        mLastEmote = id;
}
开发者ID:Kenny690,项目名称:mana,代码行数:55,代码来源:emotedb.cpp

示例8: loadImageSet

ImageSet* loadImageSet(FeatureDatabase& fdb, LshKBM& lshKBM,
    vector<uint32_t>& imageIds, string pathToSet)
{//load/create inverted file
  ImageSet* imgSet;
  FILE *fTest=fopen(pathToSet.c_str(),"rb");
  if(!fTest){
    cout<<"Registering images - creation of inverted file"<<endl;
    imgSet=new ImageSet();
    imgSet->registerImages(lshKBM,fdb,imageIds);
    cout<<"Saving image set to "<<pathToSet<<endl;
    FILE *f=fopen(pathToSet.c_str(), "wb");
    if(!f)
      cerr<<"Cannot write image set file"<<endl;
    else {
      imgSet->save(f,lshKBM);
      fclose(f);
    }
  }else{
    cout<<"Loading image set from "<<pathToSet<<endl;
    imgSet = new ImageSet();
    bool ok = imgSet->load(fTest, lshKBM, lshKBM.getVersion()<2); // in version 0 and 1 the guid was not handled correctly ...
    fclose(fTest);
    if(!ok) return NULL;

    // Sanity check: query_db_index is where we will lookup detailed infos like
    // the file name later, when printing out matching images. This database
    // must be the same as the one used for image registration.
    // However, if the image set has been created using a subset of a
    // database (using -i0 -i4 -i6 ...), img_set->num_images will be less
    // than the number of images in the db. Without a database ID that's
    // stored in the image set, we cannot realiably check that condition.
    if(fdb.index().size() != imgSet->imageCount()) {
      cout<<"WARNING: Database is (probably) not the one used for the image set, you might need --query-db\n"
          "         Don't worry about this message if you registered a subset of a database (specifying images via -i)"<<endl;
    }
//    for(unsigned int node = 0; node < imgSet->wordCount(); node++) {
//      cout<<"@"<<node<<": ";
//      uint32_t imgCount=0;
//      DB_TFIDF* tfidf = imgSet->getWordInfos()[node].firstDB_TFIDF;
//      while(tfidf) {
//        for(int i=0; i<DB_TFIDF_SIZE; i++) {
//          if(tfidf->imgID[i] == -1)
//            break;
//          //            cout<<tfidf->imgID[i]<<"; ";
//        }
//        tfidf = tfidf->nextDB_TFIDF;
//        ++imgCount;
//      }
//      cout<<" #="<<imgCount<<"\t";
//    }
//    cout<<endl;
  }
  return imgSet;
}
开发者ID:jstraub,项目名称:ptamRosBinaryFeatureRelocalization,代码行数:54,代码来源:briefIR.cpp

示例9: applyTeamColors

ImageSet applyTeamColors(const SdlSurface &baseImg)
{
    initColors();

    ImageSet ret;
    for (int i = 0; i < numTeams; ++i) {
        ret.emplace_back(sdlDeepCopy(baseImg));
        applyColor(ret[i], i);
    }

    return ret;
}
开发者ID:CraigularB,项目名称:battle-sim,代码行数:12,代码来源:team_color.cpp

示例10: SimpleAnimation

ProgressIndicator::ProgressIndicator()
{
    ImageSet *images = Theme::getImageSetFromTheme("progress-indicator.png",
                       32, 32);

    Animation *anim = new Animation;
    for (ImageSet::size_type i = 0; i < images->size(); ++i)
        anim->addFrame(images->get(i), 100, 0, 0);

    mIndicator = new SimpleAnimation(anim);

    setSize(32, 32);
}
开发者ID:Ablu,项目名称:invertika,代码行数:13,代码来源:progressindicator.cpp

示例11: draw

void Ampermetre::draw(gcn::Graphics *graphics)
{
    mLabel->setCaption(toString(mCurrent));
    mLabel->adjustSize();

    std::stringstream ss;
    ss <<"graphics/elektrik/item-ampermetre.png";
    Graphics *g = static_cast<Graphics*>(graphics);

    ImageSet *res = circuitWindow->mComponentImageSet[ss.str()];
    g->drawImage(res->get(0),4,4);

    Component::draw(graphics);
}
开发者ID:mekolat,项目名称:elektrogamesvn,代码行数:14,代码来源:ampermetre.cpp

示例12: ExecuteMajorIteration

double MoreSane::ExecuteMajorIteration(ImageSet& dataImage, ImageSet& modelImage, const ao::uvector<const double*>& psfImages, size_t width, size_t height, bool& reachedMajorThreshold)
{
	for(size_t i=0; i!=dataImage.size(); ++i)
	{
		double* residualData = dataImage[i];
		double* modelData = modelImage[i];
		ExecuteMajorIteration(residualData, modelData, psfImages[dataImage.PSFIndex(i)], width, height);
	}
	
	++_iterationNumber;
	
	reachedMajorThreshold = _iterationNumber<_maxIter;
	return 0.0;
}
开发者ID:kernsuite-debian,项目名称:wsclean,代码行数:14,代码来源:moresane.cpp

示例13: findPeakPositions

void ClarkLoop::findPeakPositions(ImageSet& convolvedResidual)
{
	Image integratedScratch(_width, _height, convolvedResidual.Allocator());
	convolvedResidual.GetLinearIntegrated(integratedScratch.data());
	
	if(!_rmsFactorImage.empty())
	{
		integratedScratch *= _rmsFactorImage;
	}
	
	const size_t
		xiStart = _horizontalBorder, xiEnd = std::max<long>(xiStart, _width - _horizontalBorder),
		yiStart = _verticalBorder, yiEnd = std::max<long>(yiStart, _height - _verticalBorder);
	
	if(_mask)
	{
		for(size_t y=yiStart; y!=yiEnd; ++y)
		{
			const bool* maskPtr = _mask + y*_width;
			double* imagePtr = integratedScratch.data() + y*_width;
			for(size_t x=xiStart; x!=xiEnd; ++x)
			{
				double value;
				if(_allowNegativeComponents)
					value = fabs(imagePtr[x]);
				else
					value = imagePtr[x];
				if(value >= _threshold && maskPtr[x])
					_clarkModel.AddPosition(x, y);
			}
		}
	}
	else {
		for(size_t y=yiStart; y!=yiEnd; ++y)
		{
			double* imagePtr = integratedScratch.data() + y*_width;
			for(size_t x=xiStart; x!=xiEnd; ++x)
			{
				double value;
				if(_allowNegativeComponents)
					value = fabs(imagePtr[x]);
				else
					value = imagePtr[x];
				if(value >= _threshold)
					_clarkModel.AddPosition(x, y);
			}
		}
	}
}
开发者ID:kernsuite-debian,项目名称:wsclean,代码行数:49,代码来源:clarkloop.cpp

示例14: Q_ASSERT

bool SpriteDefinition::readImageSet(XmlReader &xml)
{
    Q_ASSERT(xml.isStartElement() && xml.name() == "imageset");

    const QXmlStreamAttributes attr = xml.attributes();
    const QString name = attr.value("name").toString();

    if (name.isEmpty()) {
        qWarning() << "Empty name for imageset!";
        xml.skipCurrentElement();
        return false;
    }

    // Do not allow same imageset multiple times
    if (mImageSets.find(name) != mImageSets.end()) {
        qWarning() << "Duplicate use of image set name \"" << name << "\"!";
        xml.skipCurrentElement();
        return false;
    }

    const int width = attr.value("width").toInt();
    const int height = attr.value("height").toInt();
    const int offsetX = attr.value("offsetX").toInt();
    const int offsetY = attr.value("offsetY").toInt();
    QString imageSrc = attr.value("src").toString();

    // TODO: Dye

    ImageSet *imageSet =  new ImageSet(imageSrc, offsetX, offsetY,
                                       width, height, this);
    mImageSets[name] = imageSet;

    const Mana::ImageResource *imageResource = imageSet->imageResource();

    // Wait for the image to be ready, if necessary
    if (imageResource->status() == Resource::Loading) {
        connect(imageResource, SIGNAL(statusChanged(Resource::Status)),
                this, SLOT(imageFileStatusChanged(Resource::Status)));
        mImageRequests[imageResource] = &xml;
        return true;
    }

    return false;
}
开发者ID:Mic71,项目名称:manamobile,代码行数:44,代码来源:spritedef.cpp

示例15: OnCapture

static void OnCapture(FCAM_INTERFACE_DATA *tdata, AsyncImageWriter *writer, FCam::Tegra::Sensor &sensor,
                      FCam::Tegra::Flash &flash, FCam::Tegra::Lens &lens) {
    FCAM_SHOT_PARAMS *currentShot = &tdata->currentShot;
    FCAM_SHOT_PARAMS *previousShot = &tdata->previousShot;

    // Stop streaming and drain frames. It should not be necessary, but let's be safe.
    sensor.stopStreaming();
    while (sensor.shotsPending() > 0) {
        sensor.getFrame();
    }

    // Prepare a new image set.
    ImageSet *is = writer->newImageSet();

    // Prepare flash action.
    FCam::Flash::FireAction flashAction(&flash);
    flashAction.time = 0;
    flashAction.brightness = flash.maxBrightness();

    // Request capture for each shot.
    for (int i = 0; i < currentShot->burstSize; i++) {

        FCam::Shot shot;
        shot.exposure = currentShot->captureSet[i].exposure;
        shot.gain = currentShot->captureSet[i].gain;
        shot.whiteBalance = currentShot->captureSet[i].wb;
        shot.image = FCam::Image(CAPTURE_IMAGE_WIDTH, CAPTURE_IMAGE_HEIGHT, FCam::YUV420p);
        shot.histogram.enabled = false;
        shot.sharpness.enabled = false;
        if (currentShot->captureSet[i].flashOn != 0) {
            shot.addAction(flashAction);
        }
        sensor.capture(shot);
    }

    // Currently we pause capture while writing the file. It may be good
    // to change this in the future so that writing occurs in the background.
    FileFormatDescriptor fmt(FileFormatDescriptor::EFormatJPEG, 95);
    while (sensor.shotsPending() > 0) {
        is->add(fmt, sensor.getFrame());
    }
    writer->push(is);
}
开发者ID:bayanbatn,项目名称:cs478assignment2,代码行数:43,代码来源:FCamInterface.cpp


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