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


C++ ImageList::begin方法代码示例

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


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

示例1: pv

void pv(const ImageList &images) 
{
    cout << "[ ";
    for (ImageList::const_iterator i = images.begin(); i != images.end(); ++i)
    {
        std::cout << i->filename() << ' ';
    }
    cout << "]" << endl;
}
开发者ID:JaWSnl,项目名称:swoc-framework,代码行数:9,代码来源:ImageRepository.cpp

示例2: fourier_broken

void fourier_broken(T &m, feature_t* buf) {
    int dftCount = FDLENGTH;

	typename ImageFactory<T>::view_type *tmp = simple_image_copy(m);
    // get contour points for each CC
    ImageList* ccs = cc_analysis(*tmp);
    PointVector p;

    for(ImageList::iterator cc_it = ccs->begin(); cc_it != ccs->end();
            cc_it++) {
        Cc* cc = static_cast<Cc*>(*cc_it);
        Point orig = cc->origin();
        PointVector* cc_p = contour_pavlidis(*cc);

        for(PointVector::iterator p_it = cc_p->begin();
                p_it != cc_p->end(); p_it++) {

            p.push_back(*p_it + orig);
        }
        delete *cc_it;
        delete cc_p;
    } 
    delete ccs;
	delete tmp->data();
	delete tmp;

    if (p.size() == 0) {
      for (int k = 0; k < dftCount; k++)
        buf[k] = 0.0;
      return;
    }
    else if (p.size() == 1) {
      buf[0] = 1.0;
      for (int k = 1; k < dftCount; k++)
        buf[k] = 0.0;
      return;
    }

    //  calculate convex hull and interpolate points
    PointVector* hullPoints = convex_hull_from_points(&p);
    FloatPointVector* interpolatedHullPoints =
        interpolatePolygonPoints(hullPoints);

    FloatVector* distances = minimumContourHullDistances(interpolatedHullPoints, &p);

    floatFourierDescriptorBrokenA(interpolatedHullPoints, &p, distances, dftCount, buf);

    delete hullPoints;
    delete interpolatedHullPoints;
    delete distances;
}
开发者ID:elaboris,项目名称:gamera,代码行数:51,代码来源:fourier_features.hpp

示例3: createBaseTexture

  void SplattingManager::createBaseTexture(Image& image, size_t width, size_t height,
    ImageList textures, float repeatX, float repeatZ)
  {
    if (textures.size() > mImpl->numTextures)
      OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Given more textures than texture channels available.", "ET::SplattingManager::createBaseTexture");

    // first resize the textures according to the desired output size and the repeat values
    ushort scaleWidth = (ushort) (width / repeatX);
    ushort scaleHeight = (ushort) (height / repeatZ);
    for (ImageList::iterator it = textures.begin(); it != textures.end(); ++it)
      it->resize(scaleWidth, scaleHeight);

    // create the buffer to hold our generated base texture
#if OGRE_VERSION_MINOR > 4
    uchar* data = OGRE_ALLOC_T(uchar, width*height*3, MEMCATEGORY_GENERAL);
#else
    uchar* data = new uchar[width*height*3];
#endif
    size_t pos = 0;
    for (size_t y = 0; y < height; ++y)
    {
      for (size_t x = 0; x < width; ++x)
      {
        ColourValue val (0,0,0);
        int texX = (int) (x % scaleWidth);
        int texY = (int) (y % scaleHeight);
        for (size_t t = 0; t < textures.size(); ++t)
        {
          // get interpolated part of this texture at the current pixel
          float weight = mImpl->interpolateWeight(x, y, width, height, t);
          // get colour value of the texture image
          ColourValue col = textures[t].getColourAt(texX, texY, 0);
          // add to the pixel colour level
          val += weight*col;
        }

        // write colour to our buffer
        data[pos+0] = uchar(255*val.r);
        data[pos+1] = uchar(255*val.g);
        data[pos+2] = uchar(255*val.b);
        pos += 3;
      }
    }

    image.loadDynamicImage(data, width, height, 1, PF_BYTE_RGB, true);
  }
开发者ID:hjqqq,项目名称:Forever,代码行数:46,代码来源:ETSplattingManager.cpp

示例4: maximimNumOfComponents

/** Search through the list of Images and find the maximum number of components used amoung the images.*/
unsigned int maximimNumOfComponents(const ImageList& imageList)
{
    unsigned int max_components = 0;
    for(osg::ImageList::const_iterator itr=imageList.begin();
        itr!=imageList.end();
        ++itr)
    {
        osg::Image* image = itr->get();
        GLenum pixelFormat = image->getPixelFormat();
        if (pixelFormat==GL_ALPHA ||
            pixelFormat==GL_INTENSITY ||
            pixelFormat==GL_LUMINANCE ||
            pixelFormat==GL_LUMINANCE_ALPHA ||
            pixelFormat==GL_RGB ||
            pixelFormat==GL_RGBA ||
            pixelFormat==GL_BGR ||
            pixelFormat==GL_BGRA)
        {
            max_components = maximum(Image::computeNumComponents(pixelFormat), max_components);
        }
    }
    return max_components;
}
开发者ID:lindkvis,项目名称:osg,代码行数:24,代码来源:ImageUtils.cpp

示例5: fullMedian

std::pair<Mat, Mat> 
ImageRegistrator::registerImages(ImageList inputImages, int resizeFactor, int cornersAmount)
{
    Scaller                     scaller;
    MatrixList                  homographies;
    ImageList::const_iterator   selectedImage = inputImages.begin();
    ImageList::iterator         nthImage = inputImages.begin();
    PointVector                 selectedImageCorners(cornersAmount);
    PointVector                 nthImageCorners(cornersAmount);
    std::vector<uchar>          status(cornersAmount);
    std::vector<float>          error(cornersAmount);

    goodFeaturesToTrack(
            *selectedImage,
            selectedImageCorners,
            cornersAmount,
            0.01,
            1);

    cv::cornerSubPix(
            *selectedImage,
            selectedImageCorners,
            Size(5, 5),
            Size(-1, -1),
            TermCriteria(
                TermCriteria::COUNT + TermCriteria::EPS,
                6000,
                0.001)
            );


    for (; nthImage != inputImages.end(); ++nthImage) {
        if (nthImage != selectedImage) {
            calcOpticalFlowPyrLK(
                    *selectedImage,
                    *nthImage,
                    selectedImageCorners,
                    nthImageCorners,
                    status,
                    error);

            PointVector selImgCor = removeBadPoints(selectedImageCorners, status);
            PointVector nthImgCor = removeBadPoints(nthImageCorners, status);

            Mat H = findHomography(
                    selImgCor,
                    nthImgCor,
                    CV_RANSAC,
                    0.1);

            if (cv::norm(Point2f(H.at<double>(0,2), H.at<double>(1,2))) > 2) {
                nthImage->release();
                continue;
            }

            roundMatrixCoefficients(H, resizeFactor);
            homographies.push_back(H);
        }
    }  
    
    inputImages.erase(std::remove_if(inputImages.begin(),
                inputImages.end(),
                ImageRegistrator::ImageRemPred()),
            inputImages.end());
        
    inputImages = scaller.upscaleImages(inputImages, resizeFactor); 
    MatrixList::iterator h = homographies.begin();

    for (nthImage = inputImages.begin(); nthImage != inputImages.end(); ++nthImage) {
        if (nthImage != selectedImage) {
            util::printMatrix(*h, 12);
            warpPerspective(
                    nthImage->clone(),
                    *nthImage,
                    *h,
                    nthImage->size(),
                    cv::INTER_NEAREST | cv::WARP_INVERSE_MAP);
            ++h;
        }
    }

    Mat                 output(selectedImage->size(), selectedImage->type());
    std::list<uchar>    pixelValues;
    Mat                 medianWeights(output.size(), output.type());
    
    for (int i = 0; i < selectedImage->rows ; ++i) {
        for (int j = 0; j < selectedImage->cols; ++j) {

            for (nthImage = inputImages.begin(); nthImage != inputImages.end(); ++nthImage) {
                uchar value = (*nthImage).at<uchar>(i,j);

                if (value != 0)  {
                    pixelValues.push_back(value);
                }
            }

            if ( !pixelValues.empty() ) {
                output.at<uchar>(i,j) = produceMedian(pixelValues);
                medianWeights.at<uchar>(i,j) = 
                    static_cast<uchar>(std::sqrt(pixelValues.size()));
//.........这里部分代码省略.........
开发者ID:renutyagi,项目名称:SuperResolutionProject,代码行数:101,代码来源:ImageRegistrator.cpp

示例6: attemptPush

	void attemptPush(ImageList& queue, WorkRequest newRequest) {
		if (std::find(queue.begin(), queue.end(), newRequest) == queue.end()) {
			queue.push_back(newRequest);
		}
	}
开发者ID:poppeman,项目名称:Pictus,代码行数:5,代码来源:imagecache.cpp

示例7: PruneImages

void IRPruner::PruneImages(ImageList & image_names,
                           std::vector<base_transform_t::Pointer> &transform,
                           const unsigned int &shrink_factor,
                           const double &pixel_spacing,
                           const bool &use_std_mask,
                           const unsigned int &tile_size,
                           const double &intensity_tolerance,
                           float overlap_percent)
{
  double min_interest = std::numeric_limits<unsigned int>::max();
  double max_interest = std::numeric_limits<unsigned int>::min();

  ImageList passed;
  ImageList failed;

  unsigned int i = 0;
  for (ImageList::const_iterator fn_iter = image_names.begin(); fn_iter != image_names.end(); ++fn_iter, i++)
  {
    // Load in an image...
    image_t::Pointer image = std_tile<image_t>(*fn_iter, 
                                               shrink_factor, 
                                               pixel_spacing);

    mask_t::ConstPointer mask;
    if (use_std_mask)
    {
      mask = std_mask<image_t>(image);
    }

    image_t::RegionType image_region = image->GetBufferedRegion();
    image_t::SizeType image_size = image_region.GetSize();
    image_t::IndexType image_index = image_region.GetIndex();

    image_t::SizeType chunk_size;
    double full_count = 0.0;
    double interest_level = 0.0;
    
    float left_crop = image_size[0] * overlap_percent;
    float right_crop = image_size[0] * (1.0f - overlap_percent);
    
    float top_crop = image_size[1] * overlap_percent;
    float bottom_crop = image_size[1] * (1.0f - overlap_percent); 

    // Iterate through the image in small chunks...
    for (unsigned int x = 0, xid = 0; x < image_size[0]; x += tile_size, xid++)
    {
      if ( x > left_crop && (x+tile_size) < right_crop )
        continue;

      for (unsigned int y = 0, yid = 0; y < image_size[1]; y += tile_size, yid++)
      {
        if ( y > top_crop && (y+tile_size) < bottom_crop )
          continue;

        image_t::RegionType chunk_region;
        image_t::IndexType chunk_index;
        chunk_index[0] = x + image_index[0];
        chunk_index[1] = y + image_index[1];
        chunk_region.SetIndex( chunk_index );

        chunk_size[0] = std::min(tile_size, static_cast<unsigned int>(image_size[0] - x));
        chunk_size[1] = std::min(tile_size, static_cast<unsigned int>(image_size[1] - y));
        chunk_region.SetSize( chunk_size );

        image_t::IndexType index;
        typedef itk::ImageRegionIteratorWithIndex<image_t> iter_t;
        iter_t iter(image, chunk_region);
        
        // Find the average intensity on this chunk.
        double avg = 0.0, count = 0.0;
        for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter)
        {
          index = iter.GetIndex();
          double pixel_value = image->GetPixel(index);
          avg += pixel_value;
          count += 1.0;
          full_count += 1.0;
        }

        avg /= count;

        // Find how far each value is from the average.
        for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter)
        {
          index = iter.GetIndex();

          double pixel_value = image->GetPixel(index);
          interest_level += std::abs(pixel_value - avg);
        }
      }
    }

    double interest = (interest_level / full_count);
    if ( interest < min_interest )
      min_interest = interest;
    if ( interest > max_interest )
      max_interest = interest;
    
    if ( transform.size() != 0 )
    {
//.........这里部分代码省略.........
开发者ID:CIBC-Internal,项目名称:Seg3D,代码行数:101,代码来源:IRPruner.cpp


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