本文整理汇总了C++中ossimRefPtr::getImageRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimRefPtr::getImageRectangle方法的具体用法?C++ ossimRefPtr::getImageRectangle怎么用?C++ ossimRefPtr::getImageRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ossimRefPtr
的用法示例。
在下文中一共展示了ossimRefPtr::getImageRectangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: origin
//**************************************************************************************************
template <class T> void ossimScaleFilter::runVerticalFilterTemplate(
T /* dummy */,
const ossimRefPtr<ossimImageData>& input,
ossimRefPtr<ossimImageData>& output)
{
ossimIrect viewRect = output->getImageRectangle();
ossimIrect imageRect = input->getImageRectangle();
ossim_int32 vw = viewRect.width();
ossim_int32 vh = viewRect.height();
ossim_int32 iw = imageRect.width();
ossimIpt origin(viewRect.ul());
ossimIpt imageOrigin(imageRect.ul());
ossimIpt inputUl = m_InputRect.ul();
ossimIpt inputLr = m_InputRect.lr();
double scale = 0.0;
double support = 0.0;
ossim_int32 x = 0;
ossim_int32 y = 0;
ossim_int32 start = 0;
ossim_int32 stop = 0;
ossim_int32 kernelIdx = 0;
const ossimFilter* filter = getVerticalFilter();
ossim_float64 center = 0.0;
ossim_int32 bandIdx = 0;
ossim_int32 numberOfBands = m_Tile->getNumberOfBands();
scale = m_BlurFactor*ossim::max(1.0/m_ScaleFactor.y, 1.0);
support=scale*filter->getSupport();
if (support <= 0.5)
{
support = .5 + FLT_EPSILON;
scale = 1.0;
}
scale=1.0/scale;
for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
{
T* imageBuf = (T*)input->getBuf(bandIdx);
T* viewBuf = (T*)output->getBuf(bandIdx);
T np = (T)input->getNullPix(bandIdx);
T outNp = (T)output->getNullPix(bandIdx);
T outMinPix = (T)output->getMinPix(bandIdx);
T outMaxPix = (T)output->getMaxPix(bandIdx);
for(y = 0; y < vh; ++y)
{
center=(double) ((y + origin.y+0.5)/m_ScaleFactor.y);
start=ossim::max((ossim_int32)ossim::round<int>(center-support), (ossim_int32)inputUl.y);
stop=ossim::min((ossim_int32)ossim::round<int>(center+support), (ossim_int32)inputLr.y);
ossim_int32 delta = stop-start;
if (delta <= 0)
{
break;
}
vector<double> kernel(delta);
double density = 0.0;
for(kernelIdx = 0; kernelIdx < delta; ++kernelIdx)
{
kernel[kernelIdx] = filter->filter(scale*(start + kernelIdx - center + .5),
filter->getSupport());
density += kernel[kernelIdx];
}
if ((density != 0.0) && (density != 1.0))
{
/*
Normalize.
*/
density=1.0/density;
for (kernelIdx=0; kernelIdx < delta; kernelIdx++)
kernel[kernelIdx]*=density;
}
ossim_int32 offset = ((start - imageOrigin.y)*iw);
ossim_int32 offsetCenter = ((((ossim_int32)center) - imageOrigin.y)*iw);
for(x = 0; x < vw; ++x)
{
T* yptr = imageBuf + offset + x;
T* yCenterptr = imageBuf + offsetCenter + x;
double result = 0.0;
density = 0.0;
if((*yCenterptr) == np)
{
*viewBuf = outNp;
}
else
{
for(kernelIdx = 0; kernelIdx < delta; ++kernelIdx)
{
if((*yptr != np)&&
(kernel[kernelIdx] != 0.0))
{
result += ((*yptr)*kernel[kernelIdx]);
density += kernel[kernelIdx];
}
yptr += iw;
}
//.........这里部分代码省略.........