本文整理汇总了C++中TimeFrequencyData::ImageCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeFrequencyData::ImageCount方法的具体用法?C++ TimeFrequencyData::ImageCount怎么用?C++ TimeFrequencyData::ImageCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeFrequencyData
的用法示例。
在下文中一共展示了TimeFrequencyData::ImageCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IncreaseFrequency
void ChangeResolutionAction::IncreaseFrequency(TimeFrequencyData &originalData, const TimeFrequencyData &changedData, bool restoreImage, bool restoreMask)
{
if(restoreImage)
{
size_t imageCount = originalData.ImageCount();
if(imageCount != changedData.ImageCount())
throw std::runtime_error("When restoring resolution in change resolution action, original data and changed data do not have the same number of images");
for(size_t i=0;i<imageCount;++i)
{
Image2DCPtr image = changedData.GetImage(i);
Image2DPtr newImage(new Image2D(image->EnlargeVertically(_frequencyDecreaseFactor, originalData.ImageHeight())));
originalData.SetImage(i, newImage);
}
}
if(restoreMask)
{
originalData.SetMask(changedData);
size_t maskCount = originalData.MaskCount();
for(size_t i=0;i<maskCount;++i)
{
Mask2DCPtr mask = changedData.GetMask(i);
Mask2DPtr newMask = Mask2D::CreateUnsetMaskPtr(originalData.ImageWidth(), originalData.ImageHeight());
newMask->EnlargeVerticallyAndSet(*mask, _frequencyDecreaseFactor);
originalData.SetMask(i, newMask);
}
}
}
示例2: DecreaseFrequency
void ChangeResolutionAction::DecreaseFrequency(TimeFrequencyData &timeFrequencyData)
{
size_t imageCount = timeFrequencyData.ImageCount();
for(size_t i=0;i<imageCount;++i)
{
Image2DCPtr image = timeFrequencyData.GetImage(i);
Image2DPtr newImage = image->ShrinkVertically(_frequencyDecreaseFactor);
timeFrequencyData.SetImage(i, newImage);
}
size_t maskCount = timeFrequencyData.MaskCount();
for(size_t i=0;i<maskCount;++i)
{
Mask2DCPtr mask = timeFrequencyData.GetMask(i);
Mask2DPtr newMask = mask->ShrinkVertically(_frequencyDecreaseFactor);
timeFrequencyData.SetMask(i, newMask);
}
}
示例3: DecreaseTimeWithMask
void ChangeResolutionAction::DecreaseTimeWithMask(TimeFrequencyData &data)
{
size_t polCount = data.PolarisationCount();
for(size_t i=0;i<polCount;++i)
{
TimeFrequencyData *polData = data.CreateTFDataFromPolarisationIndex(i);
Mask2DCPtr mask = polData->GetSingleMask();
for(unsigned j=0;j<polData->ImageCount();++j)
{
Image2DCPtr image = polData->GetImage(j);
polData->SetImage(j, ThresholdTools::ShrinkHorizontally(_timeDecreaseFactor, image, mask));
}
delete polData;
}
size_t maskCount = data.MaskCount();
for(size_t i=0;i<maskCount;++i)
{
Mask2DCPtr mask = data.GetMask(i);
Mask2DPtr newMask = mask->ShrinkHorizontallyForAveraging(_timeDecreaseFactor);
data.SetMask(i, newMask);
}
}
示例4: DecreaseTime
void ChangeResolutionAction::DecreaseTime(TimeFrequencyData &timeFrequencyData)
{
if(_useMaskInAveraging)
{
DecreaseTimeWithMask(timeFrequencyData);
}
else {
size_t imageCount = timeFrequencyData.ImageCount();
for(size_t i=0;i<imageCount;++i)
{
Image2DCPtr image = timeFrequencyData.GetImage(i);
Image2DPtr newImage(new Image2D(image->ShrinkHorizontally(_timeDecreaseFactor)));
timeFrequencyData.SetImage(i, std::move(newImage));
}
size_t maskCount = timeFrequencyData.MaskCount();
for(size_t i=0;i<maskCount;++i)
{
Mask2DCPtr mask = timeFrequencyData.GetMask(i);
Mask2DPtr newMask(new Mask2D(mask->ShrinkHorizontally(_timeDecreaseFactor)));
timeFrequencyData.SetMask(i, std::move(newMask));
}
}
}
示例5: plotBaselineRMS
void PlotAction::plotBaselineRMS(ArtifactSet &artifacts)
{
if(artifacts.PolarizationStatistics() == 0)
throw BadUsageException("No polarization statistics in the artifact set");
TimeFrequencyData &data = artifacts.ContaminatedData();
TimeFrequencyMetaDataCPtr metaData = artifacts.MetaData();
double rms = 0.0;
for(unsigned i=0;i<data.PolarisationCount();++i)
{
TimeFrequencyData *polarisation = data.CreateTFDataFromPolarisationIndex(i);
Mask2DCPtr mask = polarisation->GetSingleMask();
for(unsigned j=0;j<polarisation->ImageCount();++j)
{
Image2DCPtr image = polarisation->GetImage(j);
rms += ThresholdTools::RMS(image, mask);
}
delete polarisation;
}
rms /= data.PolarisationCount();
;
AOLogger::Info << "RMS of " << metaData->Antenna1().name << " x " << metaData->Antenna2().name << ": "
<< rms << '\n';
}
示例6: calibrate
void CalibratePassbandAction::calibrate(TimeFrequencyData& data) const
{
const size_t height = data.ImageHeight();
std::vector<num_t> stddev(_steps);
for(size_t step=0; step!=_steps; ++step)
{
const size_t startY = step*height/_steps, endY = (step+1)*height/_steps;
std::vector<num_t> dataVector((1+endY-startY) * data.ImageWidth() * data.ImageCount());
std::vector<num_t>::iterator vecIter = dataVector.begin();
const Mask2DCPtr maskPtr = data.GetSingleMask();
const Mask2D &mask = *maskPtr;
for(size_t i=0; i!=data.ImageCount(); ++i)
{
const Image2D &image = *data.GetImage(i);
for(size_t y=startY; y!=endY; ++y)
{
const num_t *inputPtr = image.ValuePtr(0, y);
const bool *maskPtr = mask.ValuePtr(0, y);
for(size_t x=0; x!=image.Width(); ++x)
{
if(!*maskPtr && std::isfinite(*inputPtr))
{
*vecIter = *inputPtr;
++vecIter;
}
++inputPtr;
++maskPtr;
}
}
}
dataVector.resize(vecIter - dataVector.begin());
num_t mean;
ThresholdTools::WinsorizedMeanAndStdDev<num_t>(dataVector, mean, stddev[step]);
}
for(size_t i=0; i!=data.ImageCount(); ++i)
{
const Image2D &image = *data.GetImage(i);
Image2D *destImage = Image2D::CreateUnsetImage(image.Width(), image.Height());
for(size_t step=0; step!=_steps; ++step)
{
const size_t startY = step*height/_steps, endY = (step+1)*height/_steps;
float correctionFactor;
if(stddev[step] == 0.0)
correctionFactor = 0.0;
else
correctionFactor = 1.0 / stddev[step];
const __m128 corrFact4 = _mm_set_ps(correctionFactor, correctionFactor, correctionFactor, correctionFactor);
for(size_t y=startY; y!=endY; ++y)
{
const float *inputPtr = image.ValuePtr(0, y);
float *destPtr = destImage->ValuePtr(0, y);
for(size_t x=0;x<image.Width();x+=4)
{
_mm_store_ps(destPtr, _mm_mul_ps(corrFact4, _mm_load_ps(inputPtr)));
inputPtr += 4;
destPtr += 4;
}
}
}
data.SetImage(i, Image2DPtr(destImage));
}
}