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


C++ valarray::max方法代码示例

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


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

示例1: _runGrayToneMapping

// run the initilized retina filter in order to perform gray image tone mapping, after this call all retina outputs are updated
void _runGrayToneMapping(const std::valarray<float> &grayImageInput, std::valarray<float> &grayImageOutput)
{
     // apply tone mapping on the multiplexed image
    // -> photoreceptors local adaptation (large area adaptation)
    _multiuseFilter->runFilter_LPfilter(grayImageInput, grayImageOutput, 0); // compute low pass filtering modeling the horizontal cells filtering to acess local luminance
    _multiuseFilter->setV0CompressionParameterToneMapping(1.f, grayImageOutput.max(), _meanLuminanceModulatorK*grayImageOutput.sum()/(float)_multiuseFilter->getNBpixels());
    _multiuseFilter->runFilter_LocalAdapdation(grayImageInput, grayImageOutput, _temp2); // adapt contrast to local luminance

    // -> ganglion cells local adaptation (short area adaptation)
    _multiuseFilter->runFilter_LPfilter(_temp2, grayImageOutput, 1); // compute low pass filtering (high cut frequency (remove spatio-temporal noise)
    _multiuseFilter->setV0CompressionParameterToneMapping(1.f, _temp2.max(), _meanLuminanceModulatorK*grayImageOutput.sum()/(float)_multiuseFilter->getNBpixels());
    _multiuseFilter->runFilter_LocalAdapdation(_temp2, grayImageOutput, grayImageOutput); // adapt contrast to local luminance

}
开发者ID:23pointsNorth,项目名称:opencv_contrib,代码行数:15,代码来源:retinafasttonemapping.cpp

示例2: find_histogram

int find_histogram(const std::valarray<T>& vol, std::valarray<int>& hist, unsigned int bins, 
		   T& min, T& max)
{
  // size and zero the histogram
  hist.resize(bins); hist = 0;

  if(min == max) { min = vol.min(); max = vol.max(); }

  int validsize(-1);

  if(min != max) {
    double fA = bins / double(max - min);
    double fB = (bins * -min) / double(max - min);
    
    validsize = 0;

    for(unsigned int i = 0; i < vol.size(); ++i) {
      unsigned int idx = unsigned(fA * vol[i] + fB);
      ++hist[ std::max(unsigned(0), std::min(idx, bins - 1)) ];
      ++validsize;
    }      
  }

  return validsize;
}
开发者ID:xingzhong,项目名称:RTfslview,代码行数:25,代码来源:histogramfns.hpp

示例3: Plot

void histogram_plot::Plot(const std::valarray<double>& data)
{
	{
		QWriteLocker locker(&data_lock);

		if (intervals.size() != (int)(data.size()))
		{
			intervals.resize(data.size());
			values.resize(data.size());

			for (int i = 0; i < intervals.size(); i++ )
				intervals[i] = QwtDoubleInterval(i, i + 1);
		}

		double nTotal = 0;

		for (size_t i = 0; i < data.size(); i++ )
			nTotal += data[i];

		for (size_t i = 0; i < data.size(); i++ )
			values[i] = data[i] / nTotal;

		double max_val = data.max() / nTotal;

		IncludeY(max_val);
	}

	replot();
}
开发者ID:imrehg,项目名称:ionizer,代码行数:29,代码来源:histogram_plot.cpp

示例4: barPlot

void histogram_plot::barPlot(const std::valarray<double>& data)
{
	if (data.size() == 0)
		return;

	{
		QWriteLocker locker(&data_lock);

		if (intervals.size() != (int)(data.size()))
		{
			intervals.resize(data.size());
			values.resize(data.size());

			for (int i = 0; i < intervals.size(); i++ )
				intervals[i] = QwtDoubleInterval(i, i + 1);
		}

		for (size_t i = 0; i < data.size(); i++ )
			values[i] = data[i];

		double max_val = data.max();
		double min_val = data.min();

		if (max_val > 0)
			max_val *= 2;
		else
			max_val = 0;

		if (min_val < 0)
			min_val *= 2;
		else
			min_val = 0;

		SetYRange(min_val, max_val);
	}

	replot();
}
开发者ID:imrehg,项目名称:ionizer,代码行数:38,代码来源:histogram_plot.cpp

示例5: find_thresholds

void find_thresholds(const std::valarray<T>& vol, std::valarray<int>& hist, unsigned int bins, 
		     T& minval, T& maxval)
{
  const unsigned int max_passes(10);

  unsigned int pass(1);
  unsigned int lowest_bin(0), highest_bin(bins-1), bottom_bin(0), top_bin(0);
  T min(vol.min()), max(vol.max());
  T thresh2(0), thresh98(0);

  while((pass == 1) ||
	(double(thresh98 - thresh2) < (double(max - min) / 10))) {

    if(pass > 1) {
      // increase range slightly from the 2-98% range found
      bottom_bin = std::max(int(bottom_bin) - 1,             0);
      top_bin    = std::min(int(top_bin)    + 1, int(bins) - 1);

      double fA = ((max - min) / double(bins));
      T tmpmin = min + ( bottom_bin * fA);
      max      = min + ((top_bin+1) * fA);
      min = tmpmin;
    }

    if(pass == max_passes) { min = max = max_passes; } // give up and revert to full range ...

    int validsize = find_histogram(vol, hist, bins, min, max);

    if(validsize < 1) {
      minval = thresh2 = min; maxval = thresh98 = max;
      return;
    }

    if(pass == max_passes) { // ... _but_ ignore end bins
      validsize -= hist[lowest_bin] + hist[highest_bin];
      ++lowest_bin; --highest_bin;
    }

    if (validsize < 0) {
      // ie zero range
      thresh2=thresh98=min;
      break;
    }

    double fA = ((max-min)/double(bins));

    int count;

    for(count=0, bottom_bin=lowest_bin; count<validsize/50; ++bottom_bin)
      count += hist[bottom_bin];
    --bottom_bin;
    thresh2 =  min + (bottom_bin*fA);

    for(count=0, top_bin=highest_bin; count<validsize/50; --top_bin)
      count += hist[top_bin]; 
    ++top_bin;
    thresh98 = min + ((top_bin+1)*fA);

    if (pass==max_passes)
      break;

    ++pass;
  }

  find_histogram(vol, hist, bins, thresh2, thresh98);

  minval =  thresh2;
  maxval = thresh98;
}
开发者ID:xingzhong,项目名称:RTfslview,代码行数:69,代码来源:histogramfns.hpp

示例6: norm1

T norm1(const std::valarray<T> &v){
	return v.max();
}
开发者ID:ne555,项目名称:grapher,代码行数:3,代码来源:parabola.cpp


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