本文整理汇总了C++中ossimRefPtr::validate方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimRefPtr::validate方法的具体用法?C++ ossimRefPtr::validate怎么用?C++ ossimRefPtr::validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimRefPtr
的用法示例。
在下文中一共展示了ossimRefPtr::validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getHistogram
ossimRefPtr<ossimImageData> ossimHistogramEqualization::runEqualizationAlgorithm(T, ossimRefPtr<ossimImageData> tile)
{
if(!theAccumulationHistogram ||
!getHistogram())
{
return tile;
}
// for now we will always pull from res 0 information
ossimRefPtr<ossimMultiBandHistogram> histo = getHistogram()->getMultiBandHistogram(0);
if(histo.valid())
{
ossim_uint32 maxBands = ( (histo->getNumberOfBands() >
tile->getNumberOfBands())?
tile->getNumberOfBands():
histo->getNumberOfBands());
long offsetUpperBound = tile->getHeight()*tile->getWidth();
for(ossim_uint32 band = 0; band < maxBands; ++band)
{
ossimRefPtr<ossimHistogram> bandHisto = histo->getHistogram(band);
T* buf = static_cast<T*>(tile->getBuf(band));
double *histoLut = band<theForwardLut.size()?theForwardLut[band]:NULL;
ossim_uint32 actualBand = theBandList[band];
if(bandHisto.valid())
{
if(buf&&histoLut&&(actualBand < histo->getNumberOfBands()))
{
if(theInverseFlag)
{
histoLut = theInverseLut[actualBand];
}
if(histoLut)
{
if(tile->getDataObjectStatus() == OSSIM_FULL)
{
T minPix = (T)tile->getMinPix(actualBand);
T maxPix = (T)tile->getMaxPix(actualBand);
for(long offset = 0; offset < offsetUpperBound; ++offset)
{
ossim_int32 idx = bandHisto->GetIndex(buf[offset]);
if(idx>=0)
{
T value = (T)(histoLut[idx]);
//---
// Assign clamping to min max.
//
// ESH 03/2009 -- Clamping to within min-max fixed
//---
buf[offset] = value < minPix ? minPix :
(value > maxPix ? maxPix : value);
}
}
}
else
{
T minPix = (T)tile->getMinPix(actualBand);
T maxPix = (T)tile->getMaxPix(actualBand);
T nullPix = (T)tile->getNullPix(actualBand);
for(long offset = 0; offset < offsetUpperBound; ++offset)
{
ossim_int32 idx = bandHisto->GetIndex(buf[offset]);
if((buf[offset]!=nullPix)&&(idx>=0))
{
T value = (T)(histoLut[idx]);
//---
// Assign clamping to min max.
//
// ESH 03/2009 -- Clamping to within min-max fixed
//---
buf[offset] = value < minPix ? minPix :
(value > maxPix ? maxPix : value);
}
else
{
buf[offset] = nullPix;
}
}
}
}
}
}
}
tile->validate();
}
return tile;
}
示例2: decodeJpeg
//.........这里部分代码省略.........
//---
// Step 2: specify data source. In this case we will uncompress from
// memory so we will use "ossimJpegMemorySrc" in place of " jpeg_stdio_src".
//---
ossimJpegMemorySrc ( &cinfo,
&(in.front()),
(size_t)(in.size()) );
/* Step 3: read file parameters with jpeg_read_header() */
jpeg_read_header(&cinfo, TRUE);
/* Step 4: set parameters for decompression */
/* In this example, we don't need to change any of the defaults set by
* jpeg_read_header(), so we do nothing here.
*/
/* Step 5: Start decompressor */
jpeg_start_decompress(&cinfo);
#if 0 /* Please leave for debug. (drb) */
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "jpeg cinfo.output_width: " << cinfo.output_width
<< "\njpeg cinfo.output_height: " << cinfo.output_height
<< "\n";
}
#endif
const ossim_uint32 SAMPLES = cinfo.output_width;
const ossim_uint32 LINES = cinfo.output_height;
const ossim_uint32 BANDS = cinfo.output_components;
if ( out.valid() )
{
// This will resize tile if not correct.
out->setImageRectangleAndBands(
ossimIrect(0,0,(ossim_int32)SAMPLES-1,(ossim_int32)LINES-1), BANDS );
}
else
{
out = new ossimU8ImageData( 0, BANDS, SAMPLES, LINES );
out->initialize();
}
// Get pointers to the cache tile buffers.
std::vector<ossim_uint8*> destinationBuffer(BANDS);
for (ossim_uint32 band = 0; band < BANDS; ++band)
{
destinationBuffer[band] = out->getUcharBuf(band);
}
std::vector<ossim_uint8> lineBuffer(SAMPLES * cinfo.output_components);
JSAMPROW jbuf[1];
jbuf[0] = (JSAMPROW) &(lineBuffer.front());
while (cinfo.output_scanline < LINES)
{
// Read a line from the jpeg file.
jpeg_read_scanlines(&cinfo, jbuf, 1);
//---
// Copy the line which if band interleaved by pixel the the band
// separate buffers.
//---
ossim_uint32 index = 0;
for (ossim_uint32 sample = 0; sample < SAMPLES; ++sample)
{
for (ossim_uint32 band = 0; band < BANDS; ++band)
{
destinationBuffer[band][sample] = lineBuffer[index];
++index;
}
}
for (ossim_uint32 band = 0; band < BANDS; ++band)
{
destinationBuffer[band] += SAMPLES;
}
}
// Set the tile status:
out->validate();
// clean up...
jpeg_finish_decompress(&cinfo);
} // Matches: if (setjmp(jerr.setjmp_buffer) == 0)
jpeg_destroy_decompress(&cinfo);
} // Matches: if ( (in[0] == 0xff) ... )
} // Matches: if ( in.size() > 3 )
return result;
}