FromMayaCameraConverter::FromMayaCameraConverter( const MDagPath &dagPath )
	:	FromMayaDagNodeConverter( "Converts maya camera shape nodes into IECore::Camera objects.", dagPath )
{

	IntParameter::PresetsContainer resolutionModePresets;
	resolutionModePresets.push_back( IntParameter::Preset( "renderGlobals", RenderGlobals ) );
	resolutionModePresets.push_back( IntParameter::Preset( "specified", Specified ) );

	m_resolutionMode = new IntParameter(
		"resolutionMode",
		"Determines how the resolution of the camera is decided.",
		RenderGlobals,
		RenderGlobals,
		Specified,
		resolutionModePresets,
		true
	);

	parameters()->addParameter( m_resolutionMode );

	V2iParameter::PresetsContainer resolutionPresets;
	resolutionPresets.push_back( V2iParameter::Preset( "2K", Imath::V2i( 2048, 1556 ) ) );
	resolutionPresets.push_back( V2iParameter::Preset( "1K", Imath::V2i( 1024, 778 ) ) );

	m_resolution = new V2iParameter(
		"resolution",
		"Specifies the resolution of the camera when mode is set to \"Specified\".",
		Imath::V2i( 2048, 1556 ),
		resolutionPresets
	);

	parameters()->addParameter( m_resolution );

}
示例#2
0
LensDistortOp::LensDistortOp()
	:	WarpOp(
			"Distorts an ImagePrimitive using a parameteric lens model which is supplied as a .cob file. "
			"The resulting image will have the same display window as the origonal with a different data window."
		)
{

	IntParameter::PresetsContainer modePresets;
	modePresets.push_back( IntParameter::Preset( "Distort", kDistort ) );
	modePresets.push_back( IntParameter::Preset( "Undistort", kUndistort ) );

	m_modeParameter = new IntParameter(
			"mode",
			"Whether the distort the image or undistort it. An image with a lens distortion will need to be \"Undistorted\" to make it flat.",
			kUndistort,
			modePresets
			);


	m_lensParameter = new ObjectParameter(
			"lensModel",
			"An object parameter that describes the Lens Model to use. The compound parameter must contain a String object name \"lensModel\" that holds the name of the registered model to use.",
			new CompoundObject(),
			CompoundObjectTypeId
	);

	parameters()->addParameter( m_modeParameter );
	parameters()->addParameter( m_lensParameter );

}
示例#3
0
ImageCompositeOp::ImageCompositeOp() : ImagePrimitiveOp( "ImageCompositeOp" )
{
	IntParameter::PresetsContainer operationPresets;
	operationPresets.push_back( IntParameter::Preset( "Over", Over ) );
	operationPresets.push_back( IntParameter::Preset( "Max", Max ) );
	operationPresets.push_back( IntParameter::Preset( "Min", Min ) );
	operationPresets.push_back( IntParameter::Preset( "Multiply", Multiply ) );

	m_operationParameter = new IntParameter(
		"operation",
		"operation description",
		Over,
		operationPresets
	);

	StringVectorDataPtr defaultChannels = new StringVectorData;
	defaultChannels->writable().push_back( "R" );
	defaultChannels->writable().push_back( "G" );
	defaultChannels->writable().push_back( "B" );

	m_channelNamesParameter = new StringVectorParameter(
		"channels",
		"The names of the channels to modify.",
		defaultChannels
	);

	m_alphaChannelNameParameter = new StringParameter(
		"alphaChannelName",
		"The name of the channel which holds the alpha. This is used for both images.",
		"A"
	);

	m_imageAParameter = new ImagePrimitiveParameter(
		"imageA",
		"imageA is the second image operand of the composite. It is named such that operation names like 'A over B' make sense. "
		"Therefore parameter named 'input' represents imageB",
		new ImagePrimitive()
	);

	IntParameter::PresetsContainer inputModePresets;
	inputModePresets.push_back( IntParameter::Preset( "Premultiplied", Premultiplied ) );
	inputModePresets.push_back( IntParameter::Preset( "Unpremultiplied", Unpremultiplied ) );

	m_inputModeParameter = new IntParameter(
		"inputMode",
		"States whether the input images are premultiplied by their alpha.",
		Premultiplied,
		inputModePresets
	);

	parameters()->addParameter( m_operationParameter );
	parameters()->addParameter( m_channelNamesParameter );
	parameters()->addParameter( m_alphaChannelNameParameter );
	parameters()->addParameter( m_imageAParameter );
	parameters()->addParameter( m_inputModeParameter );
}
void YUVImageWriter::constructParameters()
{
	IntParameter::PresetsContainer formatPresets;
	formatPresets.push_back( IntParameter::Preset( "yuv420p", YUV420P ) );
	formatPresets.push_back( IntParameter::Preset( "yuv422p", YUV422P ) );
	formatPresets.push_back( IntParameter::Preset( "yuv444p", YUV444P ) );

	m_formatParameter = new IntParameter(
	        "format",
	        "Specifies the desired layout of the output file",
	        YUV420P,
	        formatPresets
	);

	V2fParameter::PresetsContainer kBkRPresets;
	kBkRPresets.push_back( V2fParameter::Preset( "rec601", V2f( 0.114,  0.299  ) ) );
	kBkRPresets.push_back( V2fParameter::Preset( "rec709", V2f( 0.0722, 0.2126 ) ) );
	m_kBkRParameter = new V2fParameter(
		"kBkR",
		"Defines the constants kB/kR for calculating YUV (Y'CbCr) components",
		V2f( 0.0722, 0.2126 ),
		kBkRPresets,
		false
	);

	Box3f defaultRange = Box3f( V3f( 0.0f, 0.0f, 0.0f ), V3f( 1.0f, 1.0f, 1.0f ) );

	Box3fParameter::PresetsContainer rangePresets;
	rangePresets.push_back( Box3fParameter::Preset( "zeroToOne", defaultRange ) );
	rangePresets.push_back( Box3fParameter::Preset( "standardScaling", Box3f(
		V3f(
			16.0f / 255.0f,
			16.0f / 255.0f,
			16.0f / 255.0f
		),
		V3f(
			235.0f / 255.0f,
			240.0f / 255.0f,
			240.0f / 255.0f
		)
	) ) );

	m_rangeParameter = new Box3fParameter(
		"range",
		"Specifies the floating-point min/max of the YUV components, to allow rescaling due to addition of head-room and/or toe-room. The standardScaling preset "
		"gives, in 8-bit representation, a standard range of 16-235 for Y, and 16-240 for U and V",

		defaultRange,
		rangePresets
	);

	parameters()->addParameter( m_formatParameter );
	parameters()->addParameter( m_kBkRParameter );
	parameters()->addParameter( m_rangeParameter );
}
示例#5
0
MedianCutSampler::MedianCutSampler()
	:
	Op(
		"Performs importance sampling of an image.",
		new ObjectParameter( "result",
			"A CompoundObject containing a vector of areas which cover the image, and all of which "
			"represent the same amount of energy, and a vector of weighted centroids of these areas.",
			NullObject::defaultNullObject(),
			CompoundObject::staticTypeId()
		)
	)
{
	m_imageParameter = new ImagePrimitiveParameter(
		"image",
		"The image to sample from.",
		new ImagePrimitive
	);

	m_channelNameParameter = new StringParameter(
		"channelName",
		"The name of a channel to use when computing the point distribution.",
		"Y"
	);

	m_subdivisionDepthParameter = new IntParameter(
		"subdivisionDepth",
		"The number of times to subdivide the image. This controls how many "
		"points will be created.",
		4
	);

	IntParameter::PresetsContainer projectionPresets;
	projectionPresets.push_back( IntParameter::Preset( "rectilinear", Rectilinear ) );
	projectionPresets.push_back( IntParameter::Preset( "latLong", LatLong ) );
	m_projectionParameter = new IntParameter(
		"projection",
		"The projection the image represents. When in latLong mode the "
		"image intensities are weighted to account for pinching towards the ."
		"poles, and the splitting criteria is also weighted to account for "
		"changing box widths towards the poles.",
		2,
		1,
		2,
		projectionPresets,
		true
	);

	parameters()->addParameter( m_imageParameter );
	parameters()->addParameter( m_channelNameParameter );
	parameters()->addParameter( m_subdivisionDepthParameter );
	parameters()->addParameter( m_projectionParameter );

}
ToMayaImageConverter::ToMayaImageConverter( ConstImagePrimitivePtr image )
	:	ToMayaConverter( "Converts image types.", IECore::ImagePrimitiveTypeId )
{
	srcParameter()->setValue( constPointerCast<ImagePrimitive>( image ) );

	IntParameter::PresetsContainer typePresets;
	typePresets.push_back( IntParameter::Preset( "Float", Float ) );
	typePresets.push_back( IntParameter::Preset( "Byte", Byte ) );
	m_typeParameter = new IntParameter(
		"type",
		"Type of image to convert to",
		Byte,
		typePresets );

	parameters()->addParameter( m_typeParameter );
}
TruelightColorTransformOp::TruelightColorTransformOp()
	:	ColorTransformOp( "Applies truelight transforms." ), m_instance( 0 )
{

	m_profileParameter = new StringParameter(
		"profile",
		"The name of a truelight profile to define the transformation.",
		"Kodak"
	);
	m_displayParameter = new StringParameter(
		"display",
		"The name of a display calibration to define the transformation.",
		"monitor"
	);

	IntParameter::PresetsContainer inputSpacePresets;
	inputSpacePresets.push_back( IntParameter::Preset( "log", TL_INPUT_LOG ) );
	inputSpacePresets.push_back( IntParameter::Preset( "linear", TL_INPUT_LIN ) );
	inputSpacePresets.push_back( IntParameter::Preset( "video", TL_INPUT_VID ) );
	m_inputSpaceParameter = new IntParameter(
		"inputSpace",
		"The colorspace of the input to the transform.",
		TL_INPUT_LIN,
		inputSpacePresets
	);

	m_rawTruelightOutputParameter = new BoolParameter(
		"rawTruelightOutput",
		"If disabled, applies an sRGB->Linear conversion after the Truelight LUT.",
		true
	);

	parameters()->addParameter( m_profileParameter );
	parameters()->addParameter( m_displayParameter );
	parameters()->addParameter( m_inputSpaceParameter );
	parameters()->addParameter( m_rawTruelightOutputParameter );

	init( "" );

	m_instance = TruelightCreateInstance();
	if( !m_instance )
	{
		throw( Exception( TruelightGetErrorString() ) );
	}
	assert( m_instance );
}
void FromHoudiniGroupConverter::constructCommon()
{
	IntParameter::PresetsContainer groupingModePresets;
	groupingModePresets.push_back( IntParameter::Preset( "PrimitiveGroup", PrimitiveGroup ) );
	groupingModePresets.push_back( IntParameter::Preset( "NameAttribute", NameAttribute ) );
	
	IntParameterPtr groupingMode = new IntParameter(
		"groupingMode",
		"The mode used to separate Primitives during conversion",
		NameAttribute,
		PrimitiveGroup,
		NameAttribute,
		groupingModePresets,
		true
	);
	
	parameters()->addParameter( groupingMode );
}
示例#9
0
LimitSmoothSkinningInfluencesOp::LimitSmoothSkinningInfluencesOp()
	: ModifyOp(
		"The LimitSmoothSkinningInfluencesOp zeros the weight values of SmoothSkinningData for certain influences.",
		new SmoothSkinningDataParameter( "result", "The result", new SmoothSkinningData ),
		new SmoothSkinningDataParameter( "input", "The SmoothSkinningData to modify", new SmoothSkinningData )
	)
{
	IntParameter::PresetsContainer modePresets;
	modePresets.push_back( IntParameter::Preset( "WeightLimit", LimitSmoothSkinningInfluencesOp::WeightLimit ) );
	modePresets.push_back( IntParameter::Preset( "MaxInfluences", LimitSmoothSkinningInfluencesOp::MaxInfluences ) );
	modePresets.push_back( IntParameter::Preset( "Indexed", LimitSmoothSkinningInfluencesOp::Indexed ) );
	
	m_modeParameter = new IntParameter(
		"mode",
		"The mode of influence limiting. Options are to impose a minimum weight, a maximum number of influences per point, or to zero specific influences for all points",
		LimitSmoothSkinningInfluencesOp::WeightLimit,
		LimitSmoothSkinningInfluencesOp::WeightLimit,
		LimitSmoothSkinningInfluencesOp::Indexed,
		modePresets,
		true
	);
	
	m_compressionParameter = new BoolParameter(
		"compressResult",
		"True if the result should be compressed using the CompressSmoothSkinningDataOp",
		true
	);
	
	m_minWeightParameter = new FloatParameter(
		"minWeight",
		"The minimum weight an influence is allowed per point. This parameter is only used in WeightLimit mode",
		0.001f,
		0.0f
	);
	
	m_maxInfluencesParameter = new IntParameter(
		"maxInfluences",
		"The maximum number of influences per point. This parameter is only used in MaxInfluences mode",
		3,
		0
	);
	
	m_influenceIndicesParameter = new FrameListParameter(
		"influenceIndices",
		"The indices of influences to zero corresponding to the names in input.influenceNames(). This parameter is only used in Indexed mode",
		""
	);
	
	m_useLocksParameter = new BoolParameter(
		"applyLocks",
		"Whether or not influenceLocks should be applied",
		true
	);
	
	m_influenceLocksParameter = new BoolVectorParameter(
		"influenceLocks",
		"A per-influence list of lock values",
		new BoolVectorData
	);
	
	parameters()->addParameter( m_modeParameter );
	parameters()->addParameter( m_compressionParameter );
	parameters()->addParameter( m_minWeightParameter );
	parameters()->addParameter( m_maxInfluencesParameter );
	parameters()->addParameter( m_influenceIndicesParameter );
	parameters()->addParameter( m_useLocksParameter );
	parameters()->addParameter( m_influenceLocksParameter );
}
MeshPrimitiveImplicitSurfaceOp::MeshPrimitiveImplicitSurfaceOp() : MeshPrimitiveOp( "A MeshPrimitiveOp to make an offset mesh using an implicit surface" )
{
	m_thresholdParameter = new FloatParameter(
		"threshold",
		"The threshold at which to generate the surface.",
		0.0
	);

	m_resolutionParameter = new V3iParameter(
		"resolution",
		"The resolution",
		V3i( 10, 10, 10 )
	);

	m_boundExtendParameter = new FloatParameter(
		"boundExtend",
		"The bound's radius, even if calculated by automatic bounding, is increased by this amount.",
		0.05,
		0.0
	);

	m_automaticBoundParameter = new BoolParameter(
		"automaticBound",
		"Enable to calculate the bound automatically. Disable to specify an explicit bound.",
		true
	);

	m_boundParameter = new Box3fParameter(
		"bound",
		"The bound",
		Box3f( V3d( -1, -1, -1 ), V3d( 1, 1, 1 ) )
	);

	IntParameter::PresetsContainer gridMethodPresets;
	gridMethodPresets.push_back( IntParameter::Preset( "Resolution", Resolution ) );
	gridMethodPresets.push_back( IntParameter::Preset( "Division Size", DivisionSize ) );

	m_gridMethodParameter = new IntParameter(
		"gridMethod",
		"s",
		Resolution,
		Resolution,
		DivisionSize,
		gridMethodPresets,
		true
	);

	m_divisionSizeParameter = new V3fParameter(
		"divisionSize",
		"The dimensions of each element in the grid",
		V3f( 10, 10, 10 )
	);

	parameters()->addParameter( m_thresholdParameter );
	parameters()->addParameter( m_gridMethodParameter );
	parameters()->addParameter( m_resolutionParameter );
	parameters()->addParameter( m_divisionSizeParameter );
	parameters()->addParameter( m_automaticBoundParameter );
	parameters()->addParameter( m_boundExtendParameter );
	parameters()->addParameter( m_boundParameter );
}
HitMissTransform::HitMissTransform()
	:	ChannelOp( "Performs a hit and miss transformation of an image." )
{
	FloatParameterPtr thresholdParameter = new FloatParameter(
		"threshold",
		"The threshold above which pixels are considered to be part of the foreground.",
		0.5f
	);
	
	parameters()->addParameter( thresholdParameter );
	
	CompoundParameterPtr operationParameter = new CompoundParameter(
		"operation",
		"Parameters which specify the morphological operation applied to the image."
	);
	parameters()->addParameter( operationParameter );
	
	// structuring elements
	
	M33fVectorParameter::PresetsContainer structuringElementsPresets;
	
	std::vector<M33f> thinningElements;
	thinningElements.push_back(
		
		M33f(
			 0.f, 0.f,  0.f,
			-1.f, 1.f, -1.f,
			 1.f, 1.f,  1.f
		)
	
	);
	thinningElements.push_back(
		
		M33f(
			 -1.f, 0.f,  0.f,
			  1.f, 1.f,  0.f,
			 -1.f, 1.f, -1.f
		)
	
	);

	std::vector<M33f> dilatingElements;
	dilatingElements.push_back(
		
		M33f(
			 1.f, -1.f, -1.f,
			-1.f,  0.f, -1.f,
			-1.f, -1.f, -1.f
		)
		
	);
	
	dilatingElements.push_back(
		
		M33f(
			-1.f,  1.f, -1.f,
			-1.f,  0.f, -1.f,
			-1.f, -1.f, -1.f
		)
		
	);
	
	std::vector<M33f> pruningElements;
	pruningElements.push_back(
		
		M33f(
			 0.f,  0.f,  0.f,
			 0.f,  1.f,  0.f,
			 0.f, -1.f, -1.f
		)
		
	);
	
	pruningElements.push_back(
		
		M33f(
			 0.f,  0.f,  0.f,
			 0.f,  1.f,  0.f,
			-1.f, -1.f,  0.f
		)
		
	);
	
	structuringElementsPresets.push_back( M33fVectorParameter::Preset( "thinning", thinningElements ) );
	structuringElementsPresets.push_back( M33fVectorParameter::Preset( "dilation", dilatingElements ) );
	structuringElementsPresets.push_back( M33fVectorParameter::Preset( "pruning", pruningElements ) );
	
	M33fVectorParameterPtr structuringElementsParameter = new M33fVectorParameter(
		
		"structuringElements",
		
		"The structuring elements are 3x3 matrices specifying patterns of "
		"pixels to be detected. Values of 1 specify foreground pixels, values of 0 "
		"specify background pixels and values of -1 specify pixels whose value is irrelevant. "
		"For example the following pattern could be used to detect corner points : \n\n"

		"-1 1 -1"
		"0  1  1"
		"0  0  0",
		
		thinningElements,
		structuringElementsPresets
		
	);
	
	operationParameter->addParameter( structuringElementsParameter );
	
	// rotate structuring elements parameter
	BoolParameter::PresetsContainer rotateElementsPresets;
	rotateElementsPresets.push_back( BoolParameter::Preset( "thinning", true ) );
	rotateElementsPresets.push_back( BoolParameter::Preset( "dilation", true ) );
	rotateElementsPresets.push_back( BoolParameter::Preset( "pruning", true ) );
	
	BoolParameterPtr rotateElementsParameter = new BoolParameter(
		"rotateStructuringElements",
		"When this is true, each structuring element will be duplicated for each of "
		"the possible 90 degree rotations.",
		true,
		rotateElementsPresets
	);
	
	operationParameter->addParameter( rotateElementsParameter );
	
	// value parameter
	
	FloatParameter::PresetsContainer valuePresets;
	valuePresets.push_back( FloatParameter::Preset( "thinning", 0.0f ) );
	valuePresets.push_back( FloatParameter::Preset( "dilation", 1.0f ) );
	valuePresets.push_back( FloatParameter::Preset( "pruning", 0.0f ) );
	
	FloatParameterPtr valueParameter = new FloatParameter(
		"value",
		"The value to set a pixel to if it matches the structuring element.",
		0.0f,
		Imath::limits<float>::min(),
		Imath::limits<float>::max(),
		valuePresets
	);
	
	operationParameter->addParameter( valueParameter );
	
	// border value parameter
	
	FloatParameter::PresetsContainer borderValuePresets;
	borderValuePresets.push_back( FloatParameter::Preset( "thinning", 0.0f ) );
	borderValuePresets.push_back( FloatParameter::Preset( "dilation", 0.0f ) );
	borderValuePresets.push_back( FloatParameter::Preset( "pruning", 0.0f ) );
	
	FloatParameterPtr borderValueParameter = new FloatParameter(
		"borderValue",
		"The that pixels outside of the data window are considered to hold.",
		0.0f,
		Imath::limits<float>::min(),
		Imath::limits<float>::max(),
		borderValuePresets
	);
	
	operationParameter->addParameter( borderValueParameter );
	
	// iterations parameter
	
	IntParameter::PresetsContainer iterationsPresets;
	iterationsPresets.push_back( IntParameter::Preset( "thinning", 0 ) );
	iterationsPresets.push_back( IntParameter::Preset( "dilation", 5 ) );
	iterationsPresets.push_back( IntParameter::Preset( "pruning", 5 ) );
	
	IntParameterPtr iterationsParameter = new IntParameter(
		"iterations",
		"Specifies how many times to apply the transformation to the image. "
		"When left at 0 the process is iterated until it has no further effect.",
		0,
		0,
		Imath::limits<int>::max(),
		iterationsPresets
	);
	
	operationParameter->addParameter( iterationsParameter );
	
	// apply structuring elements alternately parameter
	BoolParameter::PresetsContainer applyElementsAlternatelyPresets;
	applyElementsAlternatelyPresets.push_back( BoolParameter::Preset( "thinning", true ) );
	applyElementsAlternatelyPresets.push_back( BoolParameter::Preset( "dilation", false ) );
	applyElementsAlternatelyPresets.push_back( BoolParameter::Preset( "pruning", false ) );
	
	BoolParameterPtr applyElementsAlternatelyParameter = new BoolParameter(
		"applyElementsAlternately",
		"When this is true, only one element is considered per iteration. When "
		"this is false all elements are considered on every iteration.",
		true,
		applyElementsAlternatelyPresets
	);
	
	operationParameter->addParameter( applyElementsAlternatelyParameter );
}