本文整理汇总了C++中ossimRefPtr::GetRes方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimRefPtr::GetRes方法的具体用法?C++ ossimRefPtr::GetRes怎么用?C++ ossimRefPtr::GetRes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimRefPtr
的用法示例。
在下文中一共展示了ossimRefPtr::GetRes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[] )
{
enum
{
PASSED = 0,
FAILED = 1
};
int status = PASSED;
ossimArgumentParser ap(&argc, argv);
ossimInit::instance()->addOptions(ap);
ossimInit::instance()->initialize(ap);
try
{
ossimIrect rect(0,0,255,255);
ossimRefPtr<ossimImageData> srcTile = new ossimImageData(0, OSSIM_UINT16, 1, 256, 256);
srcTile->initialize();
srcTile->setImageRectangle( rect );
// Set max for conversion to 8 bit.
srcTile->setMaxPix( 255, 0 );
ossim_uint16* src = srcTile->getUshortBuf();
const ossim_uint32 LINES = 256;
const ossim_uint32 SAMPLES = 256;
ossim_uint32 s = 0;
// line loop
for(ossim_uint32 line = 0; line < LINES; ++line)
{
// sample loop
for(ossim_uint32 samp = 0; samp < SAMPLES; ++samp)
{
src[samp] = s;
}
src += SAMPLES;
++s;
}
ossimRefPtr<ossimImageData> destTile = new ossimImageData(0, OSSIM_UINT8, 1, 256, 256);
destTile->initialize();
destTile->setImageRectangle( rect );
destTile->loadTile( srcTile.get() );
destTile->validate();
ossimRefPtr<ossimMultiBandHistogram> his = new ossimMultiBandHistogram( 1, 256, 0, 255 );
destTile->populateHistogram( his );
const ossimRefPtr<ossimHistogram> h = his->getHistogram( 0 );
if ( h.valid() )
{
float count;
// Skipping NULL pixel (i=0) since those are no longer being counted in the histogram
// (OLK 04/2016)
for( ossim_uint32 i = 1; i < LINES; ++i )
{
count = h->GetCount( static_cast<float>(i) );
if ( count != 256.0 )
{
status = FAILED;
cerr << "bin[254]: " << h->GetCount( 254.0)
<< "\nbin[" << i << "]: count = " << count
<< "\nShould be 256..."
<< "\nhistogram bin count: " << h->GetRes()
<< endl;
const ossim_uint8* buf = destTile->getUcharBuf();
if ( buf )
{
cerr << "tile buffer index(255, 255) = "
<< (int)buf[65535] << endl;
}
break;
}
}
}
else
{
status = FAILED;
}
}
catch (const ossimException& e)
{
ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
status = FAILED;
}
cout << "ossim-loadtile-test: " << (status == PASSED ? "PASSED" : "FAILED") << endl;
return status;
}