本文整理汇总了C++中ossimRefPtr::copyTileToNormalizedBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimRefPtr::copyTileToNormalizedBuffer方法的具体用法?C++ ossimRefPtr::copyTileToNormalizedBuffer怎么用?C++ ossimRefPtr::copyTileToNormalizedBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimRefPtr
的用法示例。
在下文中一共展示了ossimRefPtr::copyTileToNormalizedBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remapFromNormalizedTable
void ossimTableRemapper::remapFromNormalizedTable(
ossimRefPtr<ossimImageData>& inputTile)
{
if (!theNormBuf) // First time...
{
theNormBuf = new ossim_float64[theTile->getSize()];
}
// Normalize and copy the source tile to a buffer.
inputTile->copyTileToNormalizedBuffer(theNormBuf);
const ossim_uint32 BANDS = theTile->getNumberOfBands();
const ossim_uint32 PPB = theTile->getSizePerBand(); // pixels per band
//---
// NOTE:
// If (theTableBandCount == one) that means we only have one band; or,
// the user wanted to remap all bands using the same table...
//---
const ossim_uint32 BAND_OFFSET = (theTableBandCount == 1) ? 0 : PPB;
// remap table (rt)
ossim_float64* rt = reinterpret_cast<ossim_float64*>(&theTable.front());
ossim_float64* buf = theNormBuf;
ossim_float64 p = 0.0;
for (ossim_uint32 band = 0; band < BANDS; ++band)
{
for (ossim_uint32 pixel = 0; pixel < PPB; ++pixel)
{
// Get the source pixel...
ossim_uint32 idx
= static_cast<ossim_uint32>(buf[pixel]*theTableBinCount+0.5);
if((idx < theTableBinCount))
{
// If within range use to index the remap table; else, null.
p = (idx < theTableBinCount) ? rt[idx] : 0.0;
}
// else if(idx < 0)
// {
// p = 0.0;
// }
else
{
p = 1.0;
}
// Range check (in case table bad) and assign to destination pixel.
buf[pixel] = (p >= 0.0) ? ( (p <=1.0) ? p : 1) : 0.0;
}
// Go to next band.
rt += BAND_OFFSET;
buf += PPB;
}
// Un-normalize and copy the buffer to the destination tile.
theTile->copyNormalizedBufferToTile(theNormBuf);
}