本文整理汇总了C++中View::Image方法的典型用法代码示例。如果您正苦于以下问题:C++ View::Image方法的具体用法?C++ View::Image怎么用?C++ View::Image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::Image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanExecuteOn
bool FluxCalibrationInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "FluxCalibration cannot be executed on complex images.";
return false;
}
if ( view.Image()->IsColor() )
{
whyNot = "FluxCalibration cannot be executed on color images.";
return false;
}
FITSKeywordArray inputKeywords;
view.Window().GetKeywords( inputKeywords );
if ( FluxCalibrationEngine::KeywordExists( inputKeywords, "FLXMIN" ) ||
FluxCalibrationEngine::KeywordExists( inputKeywords, "FLXRANGE" ) ||
FluxCalibrationEngine::KeywordExists( inputKeywords, "FLX2DN" ) )
{
whyNot = "FluxCalibration cannot be executed on an already flux-calibrated image.";
return false;
}
whyNot.Clear();
return true;
}
示例2: CanExecuteOn
bool DebayerInstance::CanExecuteOn( const View& view, String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
whyNot = "Debayer cannot be executed on complex images.";
else if ( view.Image().Width() < 6 || view.Image().Height() < 6 )
whyNot = "Debayer needs an image of at least 6 by 6 pixels";
else
{
whyNot.Clear();
return true;
}
return false;
}
示例3: ExecuteOn
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;
}
示例4: ExecuteOn
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;
}
示例5: ExecuteOn
bool CropInstance::ExecuteOn( View& view )
{
if ( !view.IsMainView() )
return false; // should not happen!
if ( p_margins == 0.0 )
{
Console().WriteLn( "<end><cbr><* Identity *>" );
return true;
}
AutoViewLock lock( view );
ImageWindow window = view.Window();
ImageVariant image = view.Image();
Crop C( p_margins );
C.SetMode( static_cast<Crop::crop_mode>( p_mode ) );
C.SetResolution( p_resolution.x, p_resolution.y );
C.SetMetricResolution( p_metric );
C.SetFillValues( p_fillColor );
// Dimensions of target image
int w0 = image.Width();
int h0 = image.Height();
// Dimensions of transformed image
int width = w0, height = h0;
C.GetNewSizes( width, height );
if ( width < 1 || height < 1 )
throw Error( "Crop: Invalid operation: Null target image dimensions" );
// On 32-bit systems, make sure the resulting image requires less than 4 GB.
if ( sizeof( void* ) == sizeof( uint32 ) )
{
uint64 sz = uint64( width )*uint64( height )*image.NumberOfChannels()*image.BytesPerSample();
if ( sz > uint64( uint32_max-256 ) )
throw Error( "Crop: Invalid operation: Target image dimensions would exceed four gigabytes" );
}
DeleteAstrometryMetadataAndPreviewsAndMask( window );
Console().EnableAbort();
StandardStatus status;
image.SetStatusCallback( &status );
C >> image;
if ( p_forceResolution )
{
Console().WriteLn( String().Format( "Setting resolution: h:%.3lf, v:%.3lf, u:px/%s",
p_resolution.x, p_resolution.y, p_metric ? "cm" : "inch" ) );
window.SetResolution( p_resolution.x, p_resolution.y, p_metric );
}
return true;
}
示例6: __Click
void AdaptiveStretchCurveGraphInterface::__Click( Button& sender, bool checked )
{
if ( sender == GUI->Render_ToolButton )
{
ImageWindow window( m_width, m_height,
3, // numberOfChannels
8, // bitsPerSample
false, // floating point
true ); // color
if ( !m_gridBitmap.IsNull() )
{
View mainView = window.MainView();
ImageVariant v = mainView.Image();
static_cast<UInt8Image&>( *v ).Blend( m_gridBitmap );
if ( !m_curveBitmap.IsNull() )
static_cast<UInt8Image&>( *v ).Blend( m_curveBitmap );
}
window.BringToFront();
window.Show();
window.ZoomToFit( false/*allowMagnification*/ );
}
else if ( sender == GUI->Edit_ToolButton )
{
CurvesTransformationInstance curves( TheCurvesTransformationProcess );
float ux = 1.0/(m_curve.Length() - 1);
float m0 = 0;
for ( int i = 0, j = 1; j < m_curve.Length(); ++j )
{
float dy = Abs( m_curve[j] - m_curve[i] );
if ( dy > 0.01 )
{
float dx = ux*(j - i);
float m = dy/dx;
if ( Abs( m - m0 )/m > 0.05 )
{
m0 = m;
i = j;
curves[CurveIndex::RGBK].Add( ux*i, m_curve[i] );
}
}
else if ( 1 + dy == 1 )
{
for ( ; ++j < m_curve.Length(); ++j )
{
dy = Abs( m_curve[j] - m_curve[i] );
if ( 1 + dy > 1 )
{
m0 = 0;
i = j-1;
curves[CurveIndex::RGBK].Add( ux*i, m_curve[i] );
break;
}
}
}
}
curves.LaunchInterface();
}
}
示例7: CanExecuteOn
bool ConvertToGrayscaleInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "ConvertToGrayscale cannot be executed on complex images.";
return false;
}
if ( view.Image().ColorSpace() == ColorSpace::Gray )
{
whyNot = "ConvertToGrayscale cannot be executed on grayscale images.";
return false;
}
whyNot.Clear();
return true;
}
示例8: CanExecuteOn
bool ChannelCombinationInstance::CanExecuteOn( const View& v, String& whyNot ) const
{
if ( v.Image().IsComplexSample() )
{
whyNot = "ChannelCombination cannot be executed on complex images.";
return false;
}
if ( v.Image()->ColorSpace() != ColorSpace::RGB )
{
whyNot = "ChannelCombination can only be executed on RGB color images.";
return false;
}
whyNot.Clear();
return true;
}
示例9: CanExecuteOn
bool AnnotationInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "Annotation cannot be executed on complex images.";
return false;
}
return true;
}
示例10: CanExecuteOn
bool PhotometricSuperflatInstance::CanExecuteOn( const View& view, String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "PhotometricSuperflat cannot be executed on complex images.";
return false;
}
whyNot.Clear();
return true;
}
示例11: CanExecuteOn
bool BinarizeInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "Binarize cannot be executed on complex images.";
return false;
}
whyNot.Clear();
return true;
}
示例12: CanExecuteOn
bool CurvesTransformationInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.Image().IsComplexSample() )
{
whyNot = "CurvesTransformation cannot be executed on complex images.";
return false;
}
whyNot.Clear();
return true;
}
示例13: ExecuteOn
bool FluxCalibrationInstance::ExecuteOn( View& view )
{
AutoViewLock lock( view );
ImageVariant image = view.Image();
if ( image.IsComplexSample() )
throw Error( "FluxCalibration cannot be executed on complex images." );
StandardStatus status;
image->SetStatusCallback( &status );
image->Status().Initialize( "Flux calibration", image->NumberOfPixels() );
Console().EnableAbort();
if ( image.IsFloatSample() )
switch ( image.BitsPerSample() )
{
case 32:
FluxCalibrationEngine::Apply( static_cast<Image&>( *image ), view, *this );
break;
case 64:
FluxCalibrationEngine::Apply( static_cast<DImage&>( *image ), view, *this );
break;
}
else
switch ( image.BitsPerSample() )
{
case 8:
case 16:
{
ImageVariant tmp;
tmp.CreateFloatImage( 32 );
tmp.CopyImage( image );
FluxCalibrationEngine::Apply( static_cast<Image&>( *tmp ), view, *this );
image.CopyImage( tmp );
}
break;
case 32:
{
ImageVariant tmp;
tmp.CreateFloatImage( 64 );
tmp.CopyImage( image );
FluxCalibrationEngine::Apply( static_cast<DImage&>( *tmp ), view, *this );
image.CopyImage( tmp );
}
break;
}
return true;
}
示例14: ExecuteOn
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;
}
示例15: ExecuteOn
bool RescaleInstance::ExecuteOn( View& view )
{
AutoViewLock lock( view );
ImageVariant image = view.Image();
if ( image.IsComplexSample() )
return false;
Console().EnableAbort();
StandardStatus status;
image.SetStatusCallback( &status );
switch ( mode )
{
default:
case RescalingMode::RGBK:
image->SelectNominalChannels();
image.Rescale();
break;
case RescalingMode::RGBK_Individual:
for ( int c = 0; c < image->NumberOfNominalChannels(); ++c )
{
image->SelectChannel( c );
image.Rescale();
}
break;
case RescalingMode::CIEL:
{
ImageVariant L;
image.GetLightness( L );
L.Rescale();
image.SetLightness( L );
}
break;
case RescalingMode::CIEY:
{
ImageVariant Y;
image.GetLuminance( Y );
Y.Rescale();
image.SetLuminance( Y );
}
break;
}
return true;
}