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


C++ Signal::resize方法代码示例

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


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

示例1: revert

void Downsampler::revert(Signal& signal) const
{
    // Resize and set the sample rate on the signal
    int revertedSize = _fineStructure.size();
    signal.resize(revertedSize);
    signal.sampleRate = _fineStructure.sampleRate;

    // Move the values to their new positions and add the fine structure
    double sizeRatio = signal.size() / revertedSize;
    for(int i = revertedSize - 1; i >= 0; i--)
        signal[i] = signal[sizeRatio * i] + _fineStructure[i];
}
开发者ID:jettca,项目名称:TextureAnimation,代码行数:12,代码来源:Downsampler.cpp

示例2: inverse

TransformeeFourier::Signal TransformeeFourier::inverse(const Signal & signal){
	Signal returnRecompoTransfoFourier;
	double N = signal.size();
	returnRecompoTransfoFourier.resize((int)(N));
	
	for(double j = -N/2; j < N/2; j++){
		returnRecompoTransfoFourier[(j+(N/2))] = 0;
		for(double i = 0; i < N; i ++){	
			std::complex<double> c(0.0, ((j+(N/2)))*i*M_PI*2.0/N);
			returnRecompoTransfoFourier[(j+(N/2))] += signal[i] * exp(c);
		}	
	}
	return returnRecompoTransfoFourier;
}
开发者ID:Bergil,项目名称:MathImage_AnalyseFrequentielle,代码行数:14,代码来源:TransformeeFourier.cpp

示例3: filter

Downsampler::Downsampler(Signal& signal, double targetRate):
    _fineStructure(signal),
    _newSampleRate(signal.sampleRate /
        pow(2, (int)(log(signal.sampleRate / targetRate) / log(2))))
{
    int oldSize = signal.size();

    // Apply a lowpass filter to obtain the fine structure
    LowpassFilter filter(_newSampleRate / 2);
    filter.filter(signal);
    for(int i = 0; i < oldSize; i++)
        _fineStructure[i] -= signal[i];

    // Fill values into new positions
    int newSize = (int)(_newSampleRate / signal.sampleRate * oldSize);
    double sizeRatio = oldSize / newSize;
    for(int i = 0; i < newSize; i++)
        signal[i] = signal[(int)(sizeRatio * i)];

    // Set the new size and sample rate
    signal.resize(std::min(newSize, oldSize));
    signal.sampleRate = _newSampleRate;
}
开发者ID:jettca,项目名称:TextureAnimation,代码行数:23,代码来源:Downsampler.cpp


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