当前位置: 首页>>代码示例>>C++>>正文


C++ ossimRefPtr::getScalarType方法代码示例

本文整理汇总了C++中ossimRefPtr::getScalarType方法的典型用法代码示例。如果您正苦于以下问题:C++ ossimRefPtr::getScalarType方法的具体用法?C++ ossimRefPtr::getScalarType怎么用?C++ ossimRefPtr::getScalarType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ossimRefPtr的用法示例。


在下文中一共展示了ossimRefPtr::getScalarType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setCurrentImageData

void ossimRgbImage::setCurrentImageData(ossimRefPtr<ossimImageData>& imageData)
{
   if(imageData.valid())
   {
      if((imageData->getScalarType() == OSSIM_UCHAR)&&
         (imageData->getDataObjectStatus()!=OSSIM_NULL))
      {
         theImageData = imageData;
         initialize();
      }
   }
}
开发者ID:LucHermitte,项目名称:ossim,代码行数:12,代码来源:ossimRgbImage.cpp

示例2: computeNormals

void ossimImageToPlaneNormalFilter::computeNormals(
   ossimRefPtr<ossimImageData>& inputTile,
   ossimRefPtr<ossimImageData>& outputTile)
{
   switch(inputTile->getScalarType())
   {
      case OSSIM_SSHORT16:
      {
         computeNormalsTemplate((ossim_sint16)0,
                                inputTile,
                                outputTile);
         break;
      }
      case OSSIM_UCHAR:
      {
         computeNormalsTemplate((ossim_uint8)0,
                                inputTile,
                                outputTile);
         break;
      }
      case OSSIM_USHORT11:
      case OSSIM_USHORT16:
      {
         computeNormalsTemplate((ossim_uint16)0,
                                inputTile,
                                outputTile);
         break;
      }
      case OSSIM_NORMALIZED_DOUBLE:
      case OSSIM_DOUBLE:
      {
         computeNormalsTemplate((ossim_float64)0,
                                inputTile,
                                outputTile);
         break;
      }
      case OSSIM_NORMALIZED_FLOAT:
      case OSSIM_FLOAT:
      {
         computeNormalsTemplate((ossim_float32)0,
                                inputTile,
                                outputTile);
         break;
      }
      default:
         break;
   }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:48,代码来源:ossimImageToPlaneNormalFilter.cpp

示例3: theCenterPoint

ossimGeoAnnotationBitmap::ossimGeoAnnotationBitmap(
   const ossimGpt& center,
   ossimRefPtr<ossimImageData> imageData,
   unsigned char r,
   unsigned char g,
   unsigned char b)
   :ossimGeoAnnotationObject(r, g, b),
    theCenterPoint(center),
    theProjectedPoint(0,0),
    theImageData(NULL)
{
   if(imageData.valid() &&
      (imageData->getScalarType()==OSSIM_UCHAR))
   {
      theImageData = imageData;
   }
   else
   {
      ossimNotify(ossimNotifyLevel_WARN)
         << "ossimGeoAnnotationBitmap::ossimGeoAnnotationBitmap\n"
         << "Invalid image data passed to ossimGeoAnnotationBitmap "
         << "constructor" << endl;
   }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:24,代码来源:ossimGeoAnnotationBitmap.cpp

示例4: remapTile

//*****************************************************************************
//  METHOD: ossimHsvGridRemapEngine::remapTile
//  
//*****************************************************************************
void ossimHsvGridRemapEngine::remapTile(const ossimDpt&       origin,
                                        ossimGridRemapSource* remapper,
                                        ossimRefPtr<ossimImageData>& tile)
{
   static const char MODULE[] = "ossimHsvGridRemapEngine::remapTile";
   if (traceExec())  CLOG << "entering..." << endl;

   //***
   // Fetch tile size and NULL pixel value:
   //***
   int    width         = tile->getWidth();
   int    height        = tile->getHeight();
   int    offset        = 0;
   
   void* red_buf = tile->getBuf(0);
   void* grn_buf = tile->getBuf(1);
   void* blu_buf = tile->getBuf(2);

   ossimDblGrid& gridH = *(remapper->getGrid(0));
   ossimDblGrid& gridS = *(remapper->getGrid(1));
   ossimDblGrid& gridV = *(remapper->getGrid(2));
      
   //---
   // Remap according to pixel type:
   //---
   switch(tile->getScalarType())
   {
      case OSSIM_UINT8:
      {
         for (double line=origin.line; line<origin.line+height; line+=1.0)
         {
            for (double samp=origin.samp; samp<origin.samp+width; samp+=1.0)
            {
               //---
               // Fetch pixel from the input tile band buffers and convert
               // to HSV:
               //---
               ossimRgbVector rgb_pixel (((ossim_uint8*)red_buf)[offset],
                                         ((ossim_uint8*)grn_buf)[offset],
                                         ((ossim_uint8*)blu_buf)[offset]);
               ossimHsvVector hsv_pixel (rgb_pixel);
               
               //---
               // Remap pixel HSV  with spatially variant bias value:
               //---
               hsv_pixel.setH(hsv_pixel.getH() + gridH(samp,line));
               hsv_pixel.setS(hsv_pixel.getS() + gridS(samp,line));
               hsv_pixel.setV(hsv_pixel.getV() + gridV(samp,line));
               
               //---
               // Convert back to RGB and write to the tile:
               //---
               rgb_pixel = hsv_pixel;  // auto-clamped
               ((ossim_uint8*)red_buf)[offset] = rgb_pixel.getR();
               ((ossim_uint8*)grn_buf)[offset] = rgb_pixel.getG();
               ((ossim_uint8*)blu_buf)[offset] = rgb_pixel.getB();
               
               offset++;
            }
         }
         break;
      }
      
      case OSSIM_USHORT11:
         break;
         
      case OSSIM_UINT16:
         break;
         
      case OSSIM_SINT16:
         break;	

      case OSSIM_FLOAT64:
         break;	

      case OSSIM_NORMALIZED_DOUBLE:
         break;	

      case OSSIM_FLOAT32:
         break;	

      case OSSIM_NORMALIZED_FLOAT:
         break;	

      case OSSIM_SCALAR_UNKNOWN:
      default:
         break;

   }   // end switch statement

   if (traceExec())  CLOG << "returning..." << endl;
   return;
};
开发者ID:LucHermitte,项目名称:ossim,代码行数:97,代码来源:ossimHsvGridRemapEngine.cpp

示例5: encodeJpeg

bool ossimCodecFactory::encodeJpeg( ossim_uint32 quality,
                                    const ossimRefPtr<ossimImageData>& in,
                                    std::vector<ossim_uint8>& out ) const
{
   bool result = false;

   if ( in.valid() && (in->getDataObjectStatus() != OSSIM_NULL) )
   {
      if ( in->getScalarType() == OSSIM_UINT8 )
      {
         // Open a memory stream up to put the jpeg image in memory:
         std::stringstream jpegStreamBuf;
         
         //---
         // Initialize JPEG compression library:
         // NOTE: JDIMENSION is an "unsigned int"
         //---
         struct jpeg_compress_struct cinfo;
         struct jpeg_error_mgr jerr;
         cinfo.err = jpeg_std_error( &jerr );
         jpeg_create_compress(&cinfo);
      
         // Define a custom stream destination manager for jpeglib to write compressed block:
         jpeg_cpp_stream_dest(&cinfo, jpegStreamBuf);
      
         /* Setting the parameters of the output file here */
         cinfo.image_width = in->getWidth();
         cinfo.image_height = in->getHeight();
   
         // Bands must be one or three for this writer.
         const ossim_uint32 INPUT_BANDS = in->getNumberOfBands();
         if ( (INPUT_BANDS == 1) || (INPUT_BANDS == 3) )
         {
            cinfo.input_components = INPUT_BANDS;
         }
         else
         {
            if ( INPUT_BANDS < 3 )
            {
               cinfo.input_components = 1; // Use first band.
            }
            else
            {
               cinfo.input_components = 3; // Use the first 3 bands.
            }
         }
      
         // colorspace of input image 
         if ( cinfo.input_components == 3)
         {
            cinfo.in_color_space = JCS_RGB;
         }
         else
         {
            cinfo.in_color_space = JCS_GRAYSCALE;
         }
      
         // Default compression parameters, we shouldn't be worried about these.
         jpeg_set_defaults( &cinfo );
      
         jpeg_set_quality(&cinfo, quality, TRUE); //limit to baseline-JPEG values
      
         // Now do the compression...
         jpeg_start_compress( &cinfo, TRUE );
      
         // Line buffer:
         ossim_uint32 buf_size = cinfo.input_components*cinfo.image_width;
         std::vector<ossim_uint8> buf(buf_size);
      
         // Compress the tile on line at a time:
      
         JSAMPROW row_pointer[1]; // Pointer to a single row.
         row_pointer[0] = (JSAMPLE*)&buf.front();

         // Get pointers to the input data:
         std::vector<const ossim_uint8*> inBuf(cinfo.input_components);
         for ( ossim_int32 band = 0; band < cinfo.input_components; ++band )
         {
            inBuf[band] = in->getUcharBuf(band);
         }

         ossim_uint32 inIdx = 0;
         for (ossim_uint32 line=0; line< cinfo.image_height; ++line)
         {
            // Convert from band sequential to band interleaved by pixel.
            ossim_uint32 outIdx = 0;
            for ( ossim_uint32 p = 0; p < cinfo.image_width; ++p )
            {
               for ( ossim_int32 band = 0; band < cinfo.input_components; ++band )
               {
                  buf[outIdx++] = inBuf[band][inIdx];
               }
               ++inIdx;
            }

            // Write it...
            jpeg_write_scanlines( &cinfo, row_pointer, 1 );
         }
      
         // Similar to read file, clean up after we're done compressing.
//.........这里部分代码省略.........
开发者ID:Dukeke,项目名称:ossim,代码行数:101,代码来源:ossimCodecFactory.cpp

示例6: CopyTileToIplImage

void ossimTileToIplFilter::CopyTileToIplImage(T dummyVariable, ossimRefPtr<ossimImageData> inputTile, IplImage *output, ossimIrect neighborhoodRect)
{
    ossimDataObjectStatus status = inputTile->getDataObjectStatus();

    uchar *outputData = (uchar *)output->imageData;
    int outputStep = output->widthStep/sizeof(uchar);
    int outputChannels = output->nChannels;

    ossimScalarType inputType = inputTile->getScalarType();
    double scFactor;

    if (inputType == OSSIM_UINT16)
        scFactor = 0.0039; // 255 / 65535
    else if (inputType == OSSIM_USHORT11)
        scFactor = 0.1246; //255 / 2047
    else if (inputType == OSSIM_UINT8)
        scFactor = 1;
    else
        scFactor = 1;

    int pixVal;

    if (status == OSSIM_PARTIAL)
    {
        for( int band = 0; band < outputChannels; band++) {
            T* inBuf = static_cast<T*>(inputTile->getBuf(band));
            for (long y = 0; y < output->height; ++y)
            {
                for (long x = 0; x < output->width; ++x)
                {

                    pixVal = (int)(*inBuf);

                    if ((int)round(pixVal * scFactor) > 255)
                        outputData[y * outputStep + x*outputChannels + band] = 255;
                    else if ((int)round(pixVal * scFactor) < 0)
                        outputData[y * outputStep + x*outputChannels + band] = 0;
                    else
                        outputData[y * outputStep + x*outputChannels + band] = (uchar)round(pixVal * scFactor);

                    ++inBuf;
                }
            }
        }
    }
    else
    {
        for(int band = 0; band < outputChannels; band++) {
            T* inBuf = static_cast<T*>(inputTile->getBuf(band));
            for (int y = 0; y < output->height; ++y)
            {
                for (int x = 0; x < output->width; ++x)
                {
                    pixVal = (int)(*inBuf);

                    if ((int)round(pixVal * scFactor) > 255)
                        outputData[y * outputStep + x*outputChannels + band] = 255;
                    else if ((int)round(pixVal * scFactor) < 0)
                        outputData[y * outputStep + x*outputChannels + band] = 0;
                    else
                        outputData[y * outputStep + x*outputChannels + band] = (uchar)round(pixVal * scFactor);

                    ++inBuf;
                }
            }
        }
    }
}
开发者ID:sunleechina,项目名称:icode-mda,代码行数:68,代码来源:ossimTileToIplFilter_1.cpp


注:本文中的ossimRefPtr::getScalarType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。