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


C++ ImageVariant类代码示例

本文整理汇总了C++中ImageVariant的典型用法代码示例。如果您正苦于以下问题:C++ ImageVariant类的具体用法?C++ ImageVariant怎么用?C++ ImageVariant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __SetToActiveImage_Click

void NewImageInterface::__SetToActiveImage_Click( Button& /*sender*/, bool /*checked*/ )
{
   ImageWindow w = ImageWindow::ActiveWindow();

   if ( !w.IsNull() )
   {
      ImageVariant v = w.MainView().Image();
      AbstractImage* img = v.AnyImage();

      if ( img != 0 )
      {
         if ( v.IsFloatSample() )
            switch ( v.BitsPerSample() )
            {
            case 32: instance.sampleFormat = NewImageSampleFormat::F32; break;
            case 64: instance.sampleFormat = NewImageSampleFormat::F64; break;
            }
         else
            switch ( v.BitsPerSample() )
            {
            case  8: instance.sampleFormat = NewImageSampleFormat::I8; break;
            case 16: instance.sampleFormat = NewImageSampleFormat::I16; break;
            case 32: instance.sampleFormat = NewImageSampleFormat::I32; break;
            }

         instance.colorSpace = img->IsColor() ? NewImageColorSpace::RGB : NewImageColorSpace::Gray;
         instance.width = img->Width();
         instance.height = img->Height();
         instance.numberOfChannels = img->NumberOfChannels();

         UpdateControls();
      }
   }
}
开发者ID:morserover,项目名称:PCL,代码行数:34,代码来源:NewImageInterface.cpp

示例2: CombineChannels

static void CombineChannels( GenericImage<P>& img, int colorSpace, const String& baseId,
                             const Rect& r,
                             const GenericImage<P0>* src0, ImageVariant& src1, ImageVariant& src2 )
{
   if ( src1 )
   {
      if ( src1.IsFloatSample() )
         switch ( src1.BitsPerSample() )
         {
         case 32:
            CombineChannels( img, colorSpace, baseId, r, src0, static_cast<Image*>( src1.ImagePtr() ), src2 );
            break;
         case 64:
            CombineChannels( img, colorSpace, baseId, r, src0, static_cast<DImage*>( src1.ImagePtr() ), src2 );
            break;
         }
      else
         switch ( src1.BitsPerSample() )
         {
         case  8:
            CombineChannels( img, colorSpace, baseId, r, src0, static_cast<UInt8Image*>( src1.ImagePtr() ), src2 );
            break;
         case 16:
            CombineChannels( img, colorSpace, baseId, r, src0, static_cast<UInt16Image*>( src1.ImagePtr() ), src2 );
            break;
         case 32:
            CombineChannels( img, colorSpace, baseId, r, src0, static_cast<UInt32Image*>( src1.ImagePtr() ), src2 );
            break;
         }
   }
   else
      CombineChannels( img, colorSpace, baseId, r, src0, static_cast<UInt8Image*>( nullptr ), src2 );
}
开发者ID:Astroshed,项目名称:PCL,代码行数:33,代码来源:ChannelCombinationInstance.cpp

示例3: Apply

 static void Apply( ImageVariant& image, const BinarizeInstance& instance )
 {
    for ( int c = 0; c < image.NumberOfNominalChannels(); ++c )
    {
       image.SelectChannel( c );
       if ( instance.isGlobal )
          image.Binarize( instance.level[0] );
       else
          image.Binarize( instance.level[c] );
    }
 }
开发者ID:GeorgViehoever,项目名称:PCL,代码行数:11,代码来源:BinarizeInstance.cpp

示例4: ValidateProcessImageExecution

   static api_bool api_func ValidateProcessImageExecution( const_image_handle hImage, const_process_handle hp, char16_type* whyNot, uint32 maxLen )
   {
      try
      {
         uint32 bitsPerSample;
         api_bool isFloat;
         if ( !(*API->SharedImage->GetImageFormat)( hImage, &bitsPerSample, &isFloat ) )
            throw 0;

         ImageVariant image;
         void* h = const_cast<image_handle>( hImage );
         if ( isFloat )
            switch ( bitsPerSample )
            {
            case 32 :
               image = ImageVariant( new pcl::Image( h ) );
               break;
            case 64 :
               image = ImageVariant( new pcl::DImage( h ) );
               break;
            default :
               return api_false; // ?!
            }
         else
            switch ( bitsPerSample )
            {
            case  8 :
               image = ImageVariant( new UInt8Image( h ) );
               break;
            case 16 :
               image = ImageVariant( new UInt16Image( h ) );
               break;
            case 32 :
               image = ImageVariant( new UInt32Image( h ) );
               break;
            default :
               return api_false; // ?!
            }

         image.SetOwnership( true );

         String whyNotStr;
         bool ok = constInstance->CanExecuteOn( image, whyNotStr );

         if ( !ok && !whyNotStr.IsEmpty() && whyNot != 0 && maxLen > 0 )
               whyNotStr.c_copy( whyNot, maxLen );

         return api_bool( ok );
      }
      ERROR_HANDLER
      return api_false;
   }
开发者ID:AndresPozo,项目名称:PCL,代码行数:52,代码来源:MetaProcess.cpp

示例5: ApplyInverseRealFourierTransform

static void ApplyInverseRealFourierTransform( GenericImage<P>& image, const ImageVariant& dft, bool parallel, int maxProcessors )
{
   if ( !dft || dft->IsEmpty() )
   {
      image.FreeData();
      return;
   }

   switch ( dft.BitsPerSample() )
   {
   case 32: ApplyInverseRealFourierTransform_1( image, static_cast<const FComplexImage&>( *dft ), parallel, maxProcessors ); break;
   case 64: ApplyInverseRealFourierTransform_1( image, static_cast<const DComplexImage&>( *dft ), parallel, maxProcessors ); break;
   }
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:14,代码来源:FourierTransform.cpp

示例6: lock

bool ConvertToGrayscaleInstance::ExecuteOn( View& view )
{
   AutoViewLock lock( view );

   ImageVariant image = view.Image();

   StandardStatus status;
   image.SetStatusCallback( &status );

   Console().EnableAbort();

   image.SetColorSpace( ColorSpace::Gray );

   return true;
}
开发者ID:Astroshed,项目名称:PCL,代码行数:15,代码来源:GrayscaleRGBInstances.cpp

示例7: Apply

 static void Apply( ImageVariant& image, const CurvesTransformationInstance& instance, bool useLUT = false )
 {
    if ( image.IsFloatSample() )
       switch ( image.BitsPerSample() )
       {
       case 32 : Apply( static_cast<Image&>( *image ), instance, useLUT ); break;
       case 64 : Apply( static_cast<DImage&>( *image ), instance, useLUT ); break;
       }
    else
       switch ( image.BitsPerSample() )
       {
       case  8 : Apply( static_cast<UInt8Image&>( *image ), instance, useLUT ); break;
       case 16 : Apply( static_cast<UInt16Image&>( *image ), instance, useLUT ); break;
       case 32 : Apply( static_cast<UInt32Image&>( *image ), instance, useLUT ); break;
       }
 }
开发者ID:SunGong1993,项目名称:PCL,代码行数:16,代码来源:CurvesTransformationInstance.cpp

示例8: switch

StarDetector::StarDetector( const ImageVariant& image, int channel,
                            const DPoint& pos, int radius, float threshold, bool autoAperture )
{
   star.status = NotDetected;
   star.channel = channel;
   star.rect = pos;
   star.pos = pos;

   if ( image )
   {
      image->SelectChannel( channel );

      if ( image.IsFloatSample() )
         switch ( image.BitsPerSample() )
         {
         case 32: star.status = Detect( star.pos, radius, threshold, static_cast<const Image&>( *image ) ); break;
         case 64: star.status = Detect( star.pos, radius, threshold, static_cast<const DImage&>( *image ) ); break;
         }
      else
         switch ( image.BitsPerSample() )
         {
         case  8: star.status = Detect( star.pos, radius, threshold, static_cast<const UInt8Image&>( *image ) ); break;
         case 16: star.status = Detect( star.pos, radius, threshold, static_cast<const UInt16Image&>( *image ) ); break;
         case 32: star.status = Detect( star.pos, radius, threshold, static_cast<const UInt32Image&>( *image ) ); break;
         }

      star.rect = DRect( star.pos - double( radius ), star.pos + double( radius ) );

      if ( autoAperture && star )
      {
         Rect r = star.rect.RoundedToInt();

         for ( double m0 = 1; ; )
         {
            image->SelectRectangle( r );
            double m = Matrix::FromImage( image ).Median();
            if ( m0 < m || (m0 - m)/m0 < 0.01 )
               break;
            m0 = m;
            r.InflateBy( 1, 1 );
         }

         star.rect = r;
      }
   }
}
开发者ID:GeorgViehoever,项目名称:PCL,代码行数:46,代码来源:StarDetector.cpp

示例9: lock

bool BinarizeInstance::ExecuteOn( View& view )
{
   AutoViewLock lock( view );

   ImageVariant image = view.Image();

   if ( image.IsComplexSample() )
      return false;

   Console().EnableAbort();

   StandardStatus status;
   image.SetStatusCallback( &status );

   BinarizeEngine::Apply( image, *this );

   return true;
}
开发者ID:GeorgViehoever,项目名称:PCL,代码行数:18,代码来源:BinarizeInstance.cpp

示例10: Convolve

static
void Convolve( const ImageVariant& v1, ImageVariant& v2,
               pcl_enum interpolation, float radiusD, float angleD, DPoint center, int c )
{
   if ( v1.IsFloatSample() )
      switch ( v1.BitsPerSample() )
      {
      case 32 : Convolve_1( static_cast<const Image&>( *v1 ), v2, interpolation, radiusD, angleD, center, c ); break;
      case 64 : Convolve_1( static_cast<const DImage&>( *v1 ), v2, interpolation, radiusD, angleD, center, c ); break;
      }
   else
      switch ( v1.BitsPerSample() )
      {
      case  8 : Convolve_1( static_cast<const UInt8Image&>( *v1 ), v2, interpolation, radiusD, angleD, center, c ); break;
      case 16 : Convolve_1( static_cast<const UInt16Image&>( *v1 ), v2, interpolation, radiusD, angleD, center, c ); break;
      case 32 : Convolve_1( static_cast<const UInt32Image&>( *v1 ), v2, interpolation, radiusD, angleD, center, c ); break;
      }
}
开发者ID:Astroshed,项目名称:PCL,代码行数:18,代码来源:LarsonSekaninaInstance.cpp

示例11: Convolve_1

template <class P> static
void Convolve_1( const GenericImage<P>& image, ImageVariant& v2,
                 pcl_enum interpolation, float radiusD, float angleD, DPoint center, int c )
{
   switch ( v2.BitsPerSample() )
   {
   case 32 : Convolve_2( image, static_cast<Image&>( *v2 ), interpolation, radiusD, angleD, center, c ); break;
   case 64 : Convolve_2( image, static_cast<DImage&>( *v2 ), interpolation, radiusD, angleD, center, c ); break;
   }
}
开发者ID:Astroshed,项目名称:PCL,代码行数:10,代码来源:LarsonSekaninaInstance.cpp

示例12: ExecuteOn

bool ProcessInstance::ExecuteOn( ImageVariant& image, const IsoString& hints )
{
   if ( !image.IsSharedImage() || !image.IsCompletelySelected() )
   {
      ImageVariant tmp;
      tmp.CreateSharedImageAs( image ).AssignImage( image );
      if ( !ExecuteOn( tmp ) )
         return false;
      if ( image.IsCompletelySelected() )
         image.AssignImage( tmp );
      else
         image.Apply( tmp, ImageOp::Mov, image.SelectedRectangle().LeftTop() );
      return true;
   }

   return (*API->Process->ExecuteOnImage)( handle, image.SharedImageHandle(), hints.c_str(), 0/*flags*/ ) != api_false;
}
开发者ID:morserover,项目名称:PCL,代码行数:17,代码来源:ProcessInstance.cpp

示例13: lock

bool AnnotationInstance::ExecuteOn( View& view )
{
   AutoViewLock lock( view );

   ImageVariant image = view.Image();

   StandardStatus status;
   image.SetStatusCallback( &status );

   Console().EnableAbort();

   if ( !image.IsComplexSample() )
      if ( image.IsFloatSample() )
         switch ( image.BitsPerSample() )
      {
         case 32: AnnotationEngine::Apply( static_cast<pcl::Image&>( *image ), *this ); break;
         case 64: AnnotationEngine::Apply( static_cast<pcl::DImage&>( *image ), *this ); break;
      }
      else
         switch ( image.BitsPerSample() )
      {
         case  8: AnnotationEngine::Apply( static_cast<pcl::UInt8Image&>( *image ), *this ); break;
         case 16: AnnotationEngine::Apply( static_cast<pcl::UInt16Image&>( *image ), *this ); break;
         case 32: AnnotationEngine::Apply( static_cast<pcl::UInt32Image&>( *image ), *this ); break;
      }

   return true;
}
开发者ID:AndresPozo,项目名称:PCL,代码行数:28,代码来源:AnnotationInstance.cpp

示例14: lock

 bool PhotometricSuperflatInstance::ExecuteOn( View& view )
 {
     AutoViewLock lock( view );
     
     ImageVariant image = view.Image();
     if ( image.IsComplexSample() )
         return false;
     
     StandardStatus status;
     image.SetStatusCallback( &status );
     
     Console().EnableAbort();
     
     if ( image.IsFloatSample() )
         switch ( image.BitsPerSample() )
     {
         case 32: PhotometricSuperflatEngine::Apply( static_cast<Image&>( *image ), *this ); break;
         case 64: PhotometricSuperflatEngine::Apply( static_cast<DImage&>( *image ), *this ); break;
     }
     else
         switch ( image.BitsPerSample() )
     {
         case  8: PhotometricSuperflatEngine::Apply( static_cast<UInt8Image&>( *image ), *this ); break;
         case 16: PhotometricSuperflatEngine::Apply( static_cast<UInt16Image&>( *image ), *this ); break;
         case 32: PhotometricSuperflatEngine::Apply( static_cast<UInt32Image&>( *image ), *this ); break;
     }
     
     return true;
 }
开发者ID:robertoabraham,项目名称:PhotometricSuperflat,代码行数:29,代码来源:PhotometricSuperflatInstance.cpp

示例15: ApplyFilter_1

template <class P> static
void ApplyFilter_1( GenericImage<P>& image, const ImageVariant& v2,
                    float amount, float threshold, float deringing,
                    float rangeLow, float rangeHigh, pcl_bool disableExtension, int c, pcl_bool highPass )
{
   switch ( v2.BitsPerSample() )
   {
   case 32 : ApplyFilter_2( image, static_cast<const Image&>( *v2 ),
                            amount, threshold, deringing, rangeLow, rangeHigh, disableExtension, c, highPass ); break;
   case 64 : ApplyFilter_2( image, static_cast<const DImage&>( *v2 ),
                            amount, threshold, deringing, rangeLow, rangeHigh, disableExtension, c, highPass ); break;
   }
}
开发者ID:Astroshed,项目名称:PCL,代码行数:13,代码来源:LarsonSekaninaInstance.cpp


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